cl_init problems

Hey this is probably some stupid mistakes I’ve made but I can’t figure it out. When I run my gamemode I get “Could not include cl_init blah blah (file not found)” I know it’s in the right place so I must’ve done something wrong with the code.


include( "shared.lua" )

  function hide_HUD()
     if (name == "CHudHealth" or name == "CHudBattery" or name == "CHudWeaponSelection" or name == "CHudSuitPower" or name == "CHudAmmo" or name == "CHudSecondaryAmmo" or name == "CHudCrosshair" or name == "CHudDamageIndicator" or name == "CHudVoiceStatus" or name == "CHudVoiceSelfStatus") then
        return false
        end
        
    end
        -- We don't return anything here otherwise it will overwrite all other 
        -- HUDShouldDraw hooks.
end
hook.Add( "HUDShouldDraw", "hide_HUD", hide_HUD )

You should be using the gamemode functions equivalent to the hook you are using as you are making a gamemode. You also have too many ends.

[editline]05:31PM[/editline]

**[Gamemode.HUDShouldDraw

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Gamemode.HUDShouldDraw)**

So, use the same names as in that. i did get the actual code from that. Ok I’ll try it and get back to you.

EDIT: Unfortunately, it didn’t work.

You didn’t pass any arguments to the hook, so I’m guessing you didn’t for the gamemode function.

Try this instead, it uses a table because it is better that way.
[lua]local HUDElements = {
“CHudHealth”,
“CHudBattery”,
“CHudWeaponSelection”,
–Add the rest you want to disable here.
}

function GM:HUDShouldDraw(elem)
if table.HasValue(HUDElements, elem) then
return false;
end
end[/lua]

Ok I’ll try it when I’m back on the pc and off the laptop. thanks.

Edit: Unfortunatly. It didn’t work.