Disabling HUD and Crosshair

For the same script as the Voice Chat, I want to disable HUD and Crosshair. This is the Code:
[lua] function AntiRandomatNoHUD()
AntiRandomatBroadcast("AntiRandomat: ", Color(255,255,255), “Mal gucken, wie ihr ohne HUD zurecht kommt!”)
for k, v in pairs(player.GetAll()) do
if v:IsPlayer then
v:CrosshairDisable
local hide = {
CHudHealth = true,
CHudBattery = true,
}
end

hook.Add( “HUDShouldDraw”, “HideHUD”, function( AwayWithIt )
if ( hide[ AwayWithIt ] ) then return false end
end)
timer.Simple(480, function()
for k, v in pairs(self:GetAlivePlayers()) do
v:CrosshairEnable
hook.Remove( “HUDShouldDraw”, “HideHUD” )
end)
end
end
end[/lua]

But it seems that this is not working. I don´t know what I am doing wrong. I don´t the Errors right now, because I closed the Console, but maybe you can find my mistake with this Intel.
Thanks for help.

That code is a completely mess, can you try to set tabs correctly?

Roger that.

I don’t really know what other parts of the HUD you want disabled besides the crosshair, or when you want them disabled. But, adding


 CHudCrosshair = true, 

in the hide table above should do the trick.

That will completely disable it though. Which I’m not sure you want to do or not.

Reading the error in the console and fixing it would have taken less time than posting here and waiting for a response.