Need Help replacing default DR Hud for server

I need help I’m trying to install the pepate health hud for my server and i’m having trouble getting rid of the old deathrun HUD I have inputted the this code into healthhud.lua

function GM:HUDShouldDraw( pepate_health_hud )
if ( name == “CHudHealth” or name == “CHudBattery” ) then
return false
end
return true
end

But the code isn’t working when restarting the server and going back into game the default DR hud is still in front of the HUD i want can you guys help me please thanks.


function GM:HUDShouldDraw( name )
if ( name == "CHudHealth" or name == "CHudBattery" ) then
return false
end
return true
end


name isnt a set variable.


if ( pepate_health_hud == "CHudHealth" or pepate_health_hud == "CHudBattery" ) then

I have edited the code now but now i’m getting this [ERROR] addons/papate health hud/lua/autorun/healthhud.lua:194: ‘)’ expected (to close ‘(’ at line 15) near ‘end’

  1. unknown - addons/papate health hud/lua/autorun/healthhud.lua:0

And now the HUD is not appearing up

No offence but have you tried reading the error? That one is one of the easiest to understand, it’s literally saying exactly what’s wrong and where to fix it


 ')' expected (to close '(' at line 15) 

[noparse][LUA]put your code in lua tags, like so[/LUA][/noparse]

How about posting your current code now?
I am sure its just an simple af to solve code.
Just as the error said.

While you are on the right track by not using table.HasValue in the HUDShouldDraw hook… here’s an alternative ( Lua is a language built around tables… tables are VERY efficient when you use direct-access; HasValue unfortunately doesn’t, and looks at n values while direct = 1 )

This also includes a description of what each element is for ( and includes some samples of how I named some of my huds )
https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/proper_hud_creation.lua.html

You can always grab the hook.GetTable( )[ “HUDPaint” ] and nullify them by hook.Remove’ing them; this along with your other method of HUDShouldDraw should ensure the other huds are gone. ( make sure you add an _id clause for your huds )


local _name = "HUDPaint";
for _id, _func in pairs( ( hook.GetTable( )[ _name ] || { } ) ) do
	hook.Remove( _name, _id );
end