Jump to content

hide hud


5150

Recommended Posts

i have this script for hiding huds but when i respawn, the hud appears again. whats wrong?

local hudTable = 
{ 
"radar", 
"ammo", 
"weapon", 
"area_name", 
"wanted", 
"money", 
"health", 
"clock", 
"vehicle_name" 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
    for id, hudComponents in ipairs(hudTable) do 
        showPlayerHudComponent(hudComponents, false) 
    end 
    end 
) 
  
addEventHandler("onClientResourceStop", resourceRoot, 
    function() 
    for id, hudComponents in ipairs(hudTable) do 
        showPlayerHudComponent(hudComponents, true) 
    end 
    end 
) 

Link to comment
local hudTable = 
{ 
"radar", 
"ammo", 
"weapon", 
"area_name", 
"wanted", 
"money", 
"health", 
"clock", 
"vehicle_name" 
} 
  
function hideHUD(enable) 
     for _, hud in ipairs(hudTable) do 
          showPlayerHudComponent(hud, enable) 
     end 
end 
  
addEventHandler("onClientResourceStart", resourceRoot, function() 
     hideHUD(false) 
end) 
  
addEventHandler("onClientPlayerSpawn", getLocalPlayer(), function() 
     hideHUD(false) 
end) 
  
addEventHandler("onClientResourceStop", resourceRoot, function() 
     hideHUD(true) 
end) 

Link to comment
    local hudTable = 
    { 
    "radar", 
    "ammo", 
    "weapon", 
    "area_name", 
    "wanted", 
    "money", 
    "health", 
    "clock", 
    "vehicle_name" 
    } 
      
    function hideHUD(enable) 
         for _, hud in ipairs(hudTable) do 
              showPlayerHudComponent(hud, enable) 
         end 
    end 
      
    addEventHandler("onClientResourceStart", resourceRoot, function() 
         hideHUD(false) 
    end) 
      
    addEventHandler("onClientPlayerSpawn", getLocalPlayer(), function() 
        setTimer ( hideHUD, 2000, 1, false ) 
    end) 
      
    addEventHandler("onClientResourceStop", resourceRoot, function() 
         hideHUD(true) 
    end) 

Adds that small delay needed for the client to utilize the hud and stuff.

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