gamelaster Posted January 10, 2012 Share 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... Link to comment
Al3grab Posted January 10, 2012 Share 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 ) Link to comment
Thelastride Posted January 10, 2012 Share Posted January 10, 2012 You putting it client side or server side? Link to comment
Al3grab Posted January 10, 2012 Share Posted January 10, 2012 have you added it server-side ? Link to comment
Thelastride Posted January 10, 2012 Share 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 Link to comment
Kenix Posted January 10, 2012 Share 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 ) Link to comment
gamelaster Posted January 10, 2012 Author Share 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 Link to comment
Kenix Posted January 10, 2012 Share 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. Link to comment
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