Ok, I’m trying to make a hud. It’s not workin. It won’t show up in GMod and it just uses the default HL2 HUD.
Here’s my code:
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)
function myhud()
local client = LocalPlayer()
if !client:Alive() then return end
// Don't draw the HUD if you're holding the camera or you're dead
if(client:GetActiveWeapon() == NULL) or (client:GetActiveWeapon() == "gmod_camera") then return end
// Make the fuckin font
surface.CreateFont("coolvetica",32,400,true,false,"GTA")
// Ammo shitz
local mag_left = client:GetActiveWeapon():Clip1()
local mag_extra = client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType())
local secondary_ammo = client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType())
if mag_left == -1 then mag_left = 0 end
draw.SimpleText( ..mag_left .. " " .. mag_extra, "GTA", ScrW()*0.85, ScrH()*0.1, Color(255,255,255,255))
draw.SimpleText("Secondary:"..secondary_ammo, "GTA", ScrW()*0.85, ScrH()*0.2, Color(88,88,88,255))
end
hook.Add("HUDPaint", "myhud", myhud)
Any help is appreciated.