• Removing hud in custom gamemode
    4 replies, posted
Hey all, Just started getting into lua and I'm not exactly sure how to remove the ugly hud from the gamemode, I am deriving the gamemode off sandbox, and using the code below to attempt to remove the hud and it's not working. I've included it in files and, I dunno, it's just not working, any help? [lua] function GM:HUDShouldDraw( name ) if ( name == "CHudHealth" or name == "CHudBattery" ) then return false end return true end [/lua] Probably not right, but that's what gmod wiki told me to do.
[code] function hidehud(name) for k, v in pairs({"CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo"}) do if name == v then return false end end end hook.Add("HUDShouldDraw", "HideOurHud:D", hidehud) [/code] Found here: [url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4bb6.html[/url]
That's not working either. It's still showing that yellow health bar.
[CODE]function hidehud(name) -- Removing the default HUD for k, v in pairs({"CHudHealth", "CHudBattery"})do if name == v then return false end end end hook.Add("HUDShouldDraw", "HideOurHud:D", hidehud)[/CODE]
Oh wait, nevermind it did work, I forgot to put include ( "cl_hud.lua" ) into cl_init whoops THanks guys!
Sorry, you need to Log In to post a reply to this thread.