How would I remove the HUD, and make everyone have infinite health? I'm making a lounge/hangout type mod, and I can't for the life of me figure out this one simple little thing, driving me nuts!
cl_drawhud 0 for no hud. Don't know about infinite health though.
[QUOTE=Benzo;16465845]cl_drawhud 0[/QUOTE]
Just a server.cfg entry?
[QUOTE=faze;16465865]Just a server.cfg entry?[/QUOTE]
It should be ran on clients I think.
Hm... do you have an example?
Make a cfg for your gamemode with cl_drawhud 0 in it and call it something like hangout.cfg then make the lua script execute the cfg.
Oh just exec is in the init file.. I gotcha. [right?] Just contain the cl_drawhud 0 in the cfg?
-snip-
[code]
if ply:Health() < 1000 then
ply:SetHealth(1000)
end
[/code]
[lua]function GM:HUDShouldDraw( name )
local oldhudshit = {
"CHudHealth",
"CHudBattery",
"CHudAmmo",
"CHudSecondaryAmmo" }
for k,v in pairs( oldhudshit ) do
if name == v then
return false
end
end
return true
end[/lua]
[editline]04:14PM[/editline]
Add more HUD elements you want to remove to the oldhudshit table.
why have infinite health? why not just set no player damage and give god mode.
[lua]ply:GodEnable()[/lua]
Infinite health.
[QUOTE=Squad;16504124][lua]ply:GodEnable()[/lua]
Infinite health.[/QUOTE]
That goes where?
you could just do sbox_godmode 1 or sv_godmode 1 (whichever it is) (In server I think)
I need it within the actual code.
[QUOTE=faze;16867107]I need it within the actual code.[/QUOTE]
[lua]function GM:HUDShouldDraw( name )
local oldhudshit = {
"CHudHealth",
"CHudBattery",
"CHudAmmo",
"CHudSecondaryAmmo"
}
for k,v in pairs( oldhudshit ) do
if name == v then
return false
end
end
return true
end
function GM:PlayerSpawn( pl )
pl:GodEnable()
end[/lua]
I'm getting a buffer overflow error with that.
[QUOTE=CowThing;16868419][lua]function GM:HUDShouldDraw( name )
local oldhudshit = {
"CHudHealth",
"CHudBattery",
"CHudAmmo",
"CHudSecondaryAmmo"
}
for k,v in pairs( oldhudshit ) do
if name == v then
return false
end
end
return true
end
function GM:PlayerSpawn( pl )
pl:GodEnable()
end[/lua][/QUOTE]
Don't return true. It breaks anything that's using the same hook.
[QUOTE=mahalis;16893620]Don't return true. It breaks anything that's using the same hook.[/QUOTE]
Is that why I'm getting the buffer overflow when I try and join? Started happening when I dropped that into the cl_init.
Anyone care to help me? I'm still stuck.
Still can't figure this out... No console errors, but I get a buffer overflow every time I join.
client
[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]
shared
[lua]function GM:PlayerShouldTakeDamage( ply, attacker )
return false
end[/lua]
[editline]10:13AM[/editline]
Double post...
[QUOTE=faze;17014455]Still can't figure this out... No console errors, but I get a buffer overflow every time I join.[/QUOTE]
Try to put the GM:HUDShouldDraw( name ) stuff into cl_init.lua, and the GM:PlayerSpawn( pl ) stuff into init.lua.
[QUOTE=yoBrelliKX;17019396]client
[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]
shared
[lua]function GM:PlayerShouldTakeDamage( ply, attacker )
return false
end[/lua]
[editline]10:13AM[/editline]
Double post...[/QUOTE]
Thanks, I'll try that in a bit and post results.
Works.
Now, last question. How do I totally redo the default scoreboard (tab menu)?
there should be a file called cl_scoreboard.lua , so just edit that. It's like any other vgui , so nothing really new if you've ever made vguis.
[QUOTE=Zencro;17049493]there should be a file called cl_scoreboard.lua , so just edit that. It's like any other vgui , so nothing really new if you've ever made vguis.[/QUOTE]
There's not. I'm making this from scratch.
derive from sandbox/base :geno:
How so? I just started from scratch...
Sorry, you need to Log In to post a reply to this thread.