..:D&G:.. Posted February 14, 2014 Posted February 14, 2014 Hey, I recently made a hud, and with the help of some scripters from the forum, I made it so people can toggle it. I don't know how to make it hide when people join, so they have to type "/showhud" for the hud to appear. local renderHud = function () local munitie = getPedTotalAmmo ( localPlayer) local clip = getPedAmmoInClip ( localPlayer) local IDarma = getPedWeapon(localPlayer) local arma = getWeaponNameFromID(IDarma) local viata = getElementHealth (localPlayer) local armura = getPedArmor (localPlayer) local bani = getPlayerMoney()-- "thePlayer" this shouldn't be there. -- put your dx stuff here-- -------------------------------- end local handler = true addEventHandler("onClientRender",root,renderHud) addCommandHandler("showhud", function () if handler then removeEventHandler("onClientRender",root,renderHud) handler = false else addEventHandler("onClientRender",root,renderHud) handler = true end end) I tried to change the local handler = true into local handler = false but no luck... any ideas? MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
Karuzo Posted February 14, 2014 Posted February 14, 2014 I think you should remove the EventHandler in Line 20.
Moderators Citizen Posted February 14, 2014 Moderators Posted February 14, 2014 I think you should remove the EventHandler in Line 20. Yeah and set handler to true at line 19 too, otherwise the player would have to enter that command twice to show it. The rEvolution is coming ...
..:D&G:.. Posted February 16, 2014 Author Posted February 16, 2014 Done it, thanks MTA:Rust Pre-Alpha Build v.0.3: https://forum.mtasa.com/viewtopic.php?f=114&t=97848 2Pac: ''Only God can judge me!''
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