• cl_init.lua not being read?
    2 replies, posted
Third post today because I'm a simpleton, yay. I started a gamemode a while back that works just fine at the moment but I started a new one recently (hopefully one that I can monetize) and for some reason it seems as though 'cl_init.lua' isn't being recognized. I don't get any errors, but all that happens when I start a new game is it hides the default hud (as it should) but doesn't show anything that I've added myself. from my first game mode, this one works [lua] function gunname() if LocalPlayer():GetActiveWeapon():IsValid() then draw.DrawText( ""..LocalPlayer():GetActiveWeapon().PrintName, "BudgetLabel", ScrW() * 0.9, ScrH() * 0.75, Color( 255,255,255,255 ), TEXT_ALIGN_CENTER ) draw.DrawText( ""..LocalPlayer():GetActiveWeapon():Clip1(), "BudgetLabel", ScrW() * 0.88, ScrH() * 0.77, Color( 255,255,255,255 ), TEXT_ALIGN_CENTER ) draw.DrawText( "/"..LocalPlayer():GetActiveWeapon():Ammo1(), "BudgetLabel", ScrW() * 0.9, ScrH() * 0.77, Color( 255,255,255,255 ), TEXT_ALIGN_CENTER ) end end hook.Add("HUDPaint", "Weapon stats", gunname) [/lua] From my current gamemode, this does not work (I've tried several different ways of adding to the hud, this example is straight from the gmod wiki) [lua] function GM:HUDShouldDraw(x) if x == "CHudHealth" or "CHudAmmo" or "CHudBattery" or "CHudWeapon" then return false end end hook.Add( "HUDDraw", "HelloThere", function() draw.DrawText( "Hello there!", "TargetID", ScrW() * 0.5, ScrH() * 0.25, Color( 255,255,255,255 ), TEXT_ALIGN_CENTER ) end ) [/lua] anyone know how to solve this issue?
HUDDraw should be HUDPaint [editline]23rd February 2014[/editline] I fixed the silly wiki mistake [editline]23rd February 2014[/editline] Your if statement won't work as anticipated, you have to compare each string with x individually: [code]if x == "CHudHealth" or x == "CHudAmmo" or x == "CHudBattery" ...[/code]
Fixed it, thanks.
Sorry, you need to Log In to post a reply to this thread.