gamelaster Posted January 10, 2012 Posted January 10, 2012 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...
Al3grab Posted January 10, 2012 Posted January 10, 2012 function hud ( player , command ) showPlayerHudComponent ( player , "all", false ) outputChatBox ( "HUD bolo uspesne vypnute", player , 0, 255, 0 ) end addCommandHandler ( "hud", hud )
Thelastride Posted January 10, 2012 Posted January 10, 2012 You putting it client side or server side?
Thelastride Posted January 10, 2012 Posted January 10, 2012 (edited) 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 January 10, 2012 by Guest
Kenix Posted January 10, 2012 Posted January 10, 2012 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 )
gamelaster Posted January 10, 2012 Author Posted January 10, 2012 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
Kenix Posted January 10, 2012 Posted January 10, 2012 No problem Read it https://wiki.multitheftauto.com/wiki/Scr ... troduction And it http://www.lua.org/manual/5.1/ You need know it.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now