Remove part of default HUD

Please, tell me, how i can remove for DarkRP, this part of HUD:

http://img267.imageshack.us/img267/3160/15320992.png

So, if you know how to remove the health and armor you will know were to put this.
[LUA]
“CHudAmmo”
“CHudSecondaryAmmo”
[/LUA]

This is the current code I use to remove those two elements from my HUD.

[lua]
local tohide = {
[“CHudAmmo”] = true,
[“CHudSecondaryAmmo”] = true
}
local function HUDShouldDraw(name)

if (tohide[name]) then
	return false;  
end

end
hook.Add(“HUDShouldDraw”, “HUD Hide”, HUDShouldDraw)
[/lua]

Thanks, it works.

No problem, Nibbler. If you need any more help related in Lua please, don’t hesitate to PM me on the forums. :wink:

[lua]
local tohide = {
[“CHudAmmo”] = false,
[“CHudSecondaryAmmo”] = false
}
local function HUDShouldDraw(name)
return tohide[name] or true
end
hook.Add(“HUDShouldDraw”, “HUD Hide”, HUDShouldDraw)
[/lua]

This is wrong for 2 reasons.

First, this will always return true, it prevents other hooks from being called.

Just do this and it will work.
[LUA]
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”, “HideHUD”, hidehud)
[/LUA]

Although I agree with the second, why would it always return true?

because no matter what tohide[name] will be either false or nil - and Lua will then take the next part ie true