• Overriding hud?
    8 replies, posted
Hi, I want to override the hud in the gm I use, how can I do this?
At least tell us what gamemode and what you want to override the HUD with.
It is F2S: Stronghold and I want to replace it with a hud on the workshop. I didn't tell you because I thought the method would apply to all hud's
Overwrite GM:HUDPaint
This is the code I have so far: [code] local hide = { CHudHealth = true, CHudAmmo = true, } self.BaseClass:HUDPaint() hook.Add( "HUDShouldDraw", "HideHUD", function() if ( hide[ name ] ) then return false end end) [/code]
[QUOTE=mattymoo142;48379963]This is the code I have so far: [code] local hide = { CHudHealth = true, CHudAmmo = true, } self.BaseClass:HUDPaint() hook.Add( "HUDShouldDraw", "HideHUD", function() if ( hide[ name ] ) then return false end end) [/code][/QUOTE] [code] local hide = { CHudHealth = true, CHudBattery = true, } hook.Add( "HUDShouldDraw", "HideHUD", function( name ) if ( hide[ name ] ) then return false end -- Don't return anything here, it may break other addons that rely on this hook. end ) [/code] is better. That will overwrite the ugly default hud and then you can get working. Put that in cl_init.lua or whatever hud file you're using.
[QUOTE=CGHippo;48379992][code] local hide = { CHudHealth = true, CHudBattery = true, } hook.Add( "HUDShouldDraw", "HideHUD", function( name ) if ( hide[ name ] ) then return false end -- Don't return anything here, it may break other addons that rely on this hook. end ) [/code] is better. That will overwrite the ugly default hud and then you can get working. Put that in cl_init.lua or whatever hud file you're using.[/QUOTE] Thankyou, but I am unable to test it at the moment as I keep getting a really strange error with my gamemode, I have added custom weapons to it, it worked great, then I restarted the server, it still works for everyone else but I get the following error: [ERROR] gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:237: attempt to concatenate a boolean value 1. OnRowSelected - gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:237 2. DoRefreshLicenses - gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:371 3. Refresh - gamemodes/stronghold/gamemode/vgui/sh_loadoutmenu.lua:44 4. Open - gamemodes/stronghold/gamemode/vgui/sh_loadoutmenu.lua:62 5. unknown - gamemodes/stronghold/gamemode/cl_panels.lua:147 6. unknown - lua/includes/modules/concommand.lua:54
[QUOTE=mattymoo142;48380028]Thankyou, but I am unable to test it at the moment as I keep getting a really strange error with my gamemode, I have added custom weapons to it, it worked great, then I restarted the server, it still works for everyone else but I get the following error: [ERROR] gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:237: attempt to concatenate a boolean value 1. OnRowSelected - gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:237 2. DoRefreshLicenses - gamemodes/stronghold/gamemode/vgui/sh_loadoutpanel.lua:371 3. Refresh - gamemodes/stronghold/gamemode/vgui/sh_loadoutmenu.lua:44 4. Open - gamemodes/stronghold/gamemode/vgui/sh_loadoutmenu.lua:62 5. unknown - gamemodes/stronghold/gamemode/cl_panels.lua:147 6. unknown - lua/includes/modules/concommand.lua:54[/QUOTE] Post the code.
[QUOTE=CGHippo;48380042]Post the code.[/QUOTE] I already have another post open for the error: [url]http://facepunch.com/showthread.php?t=1479670[/url]
Sorry, you need to Log In to post a reply to this thread.