Jump to content

Hide a custom made hud


..:D&G:..

Recommended Posts

Posted

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?

  • Moderators
Posted
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.

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...