Jump to content

Dont Hide ALL Huds


gamelaster

Recommended Posts

Hi, code:

  
ja = getLocalPlayer() 
  
  
function hud ( player , command ) 
    showPlayerHudComponent ( ja, "all", false ) 
    outputChatBox ( "HUD bolo uspesne vypnute", ja, 0, 255, 0 ) 
end 
  
addCommandHandler ( "hud", hud ) 
  

If im type /hud, send to chat HUD bolo uspesne vypnute , also nothind unhidet...

Link to comment

Put this server side. type ="server"

you need to do separate to show different huds.

function hud ( player , command ) 
outputChatBox("Hud toggled",player) 
if getElementData(player,"hudshown") == 1 then 
showPlayerHudComponent (player, "ammo", false )   
showPlayerHudComponent (player, "weapon", false )   
showPlayerHudComponent (player, "health", false ) 
showPlayerHudComponent (player, "clock", false )     
showPlayerHudComponent (player, "money", false )     
setElementData(player,"hudshown",0) 
else 
showPlayerHudComponent (player, "all", true ) 
setElementData(player,"hudshown",1) 
end 
  
end 
addCommandHandler ( "hud", hud ) 

Edited by Guest
Link to comment

Client

  
ja = getLocalPlayer() 
local state = false  
  
function hud ( ) 
    if not state then 
        showPlayerHudComponent ( "all", false ) 
        outputChatBox ( "HUD bolo uspesne vypnute", 0, 255, 0 ) 
        state = true 
    else 
        showPlayerHudComponent ( "all", true ) 
        outputChatBox ( "HUD bolo uspesne povolené", 0, 255, 0 ) 
        state = false 
    end      
end 
  
addCommandHandler ( "hud", hud ) 
  

Link to comment

Thx man, im used this:

Client
  
ja = getLocalPlayer() 
local state = false  
  
function hud ( ) 
    if not state then 
        showPlayerHudComponent ( "all", false ) 
        outputChatBox ( "HUD bolo uspesne vypnute", 0, 255, 0 ) 
        state = true 
    else 
        showPlayerHudComponent ( "all", true ) 
        outputChatBox ( "HUD bolo uspesne povolené", 0, 255, 0 ) 
        state = false 
    end      
end 
  
addCommandHandler ( "hud", hud ) 
  

Im programming on lua only 2 days :)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...