Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error
- [ERROR] gamemodes/test/gamemode/testhud.lua:25: attempt to call method 'GetPrintName' (a nil value)
- 1. v - gamemodes/test/gamemode/testhud.lua:25
- 2. unknown - lua/includes/modules/hook.lua:84
- function HUD()
- local client = LocalPlayer()
- if !client:Alive() then
- return
- end
- draw.RoundedBox(1, 0, ScrH() - 100, 250, 100, Color(255,140,0,200) )
- draw.RoundedBox(1, 2, ScrH() - 98, 246, 96, Color(30,30,30,255) )
- draw.SimpleText("Health: "..client:Health(), "DermaDefaultBold", 10 , ScrH() - 90, Color(255,255,255,255), 0, 0 )
- draw.RoundedBox(0,10,ScrH() - 75, 100*2.25, 15, Color(255,0,0,30) )
- draw.RoundedBox(0, 10, ScrH() - 75, math.Clamp(client:Health(), 0, 100) * 2.3, 15, Color(255,0,0,255) )
- draw.RoundedBox(0, 10, ScrH() - 75, math.Clamp(client:Health(), 0 , 100) * 2.3, 5, Color(225,30,30,255) )
- draw.SimpleText("Armor: "..client:Armor(), "DermaDefaultBold", 10 , ScrH() - 45, Color(255,255,255,255), 0, 0 )
- draw.RoundedBox(0,10,ScrH() - 30, 100*2.25, 15, Color(0,0,255,30) )
- draw.RoundedBox(0, 10, ScrH() - 30, math.Clamp(client:Armor(), 0, 100) * 2.3, 15, Color(0,0,255,255) )
- draw.RoundedBox(0, 10, ScrH() - 30, math.Clamp(client:Armor(), 0, 100) * 2.3, 5, Color(30,30,255,255) )
- draw.RoundedBox(1,255,ScrH() - 70, 125, 70, Color(255,140,0,200) )
- draw.RoundedBox(0,257,ScrH() - 68, 121, 66, Color(30,30,30,255) )
- if (client:GetActiveWeapon():GetPrintName() != nil)then -- This is where the error is
- draw.SimpleText(client:GetActiveWeapon():GetPrintName(), "DermaDefaultBold", 260, ScrH() - 60, Color(255,255,255,255, 0, 0) )
- end
- if (client:GetActiveWeapon():Clip1() != -1) then
- draw.SimpleText("Ammo: "..client:GetActiveWeapon():Clip1() .. "/" .. client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()), "DermaDefaultBold", 260, ScrH() - 40, Color(255,255,255,255), 0, 0)
- else
- draw.SimpleText("Ammo: " .. client:GetAmmoCount(client:GetActiveWeapon():GetPrimaryAmmoType()), "DermaDefaultBold", 260, ScrH() - 40, Color(255,255,255,255), 0, 0)
- end
- if (client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType()) > 0) then
- draw.SimpleText("Seconday Ammo: ".. client:GetAmmoCount(client:GetActiveWeapon():GetSecondaryAmmoType()), "DermaDefaultBold", 260, ScrH() - 25, Color(255,255,255,255), 0, 0)
- end
- local expToLevel = (client:GetNWInt("playerLvl") * 100) * 2
- draw.RoundedBox(1, 0, ScrH() - 145, 250, 40, Color(255,140,0,200) )
- draw.RoundedBox(0, 2, ScrH() - 143, 246, 36, Color(30,30,30,255))
- draw.SimpleText("Level " .. client:GetNWInt("playerLvl"), "DermaDefaultBold", 10, ScrH() - 140, Color(255,255,255,255), 0, 0)
- draw.SimpleText("EXP: ".. client:GetNWInt("playerMoney") .. "/" .. expToLevel , "DermaDefaultBold", 10, ScrH() - 125, Color(255,255,255,255), 0, 0)
- draw.RoundedBox(1,255, ScrH() - 100, 125, 25, Color(255,140,0,200) )
- draw.RoundedBox(0,257, ScrH() - 98, 121, 21, Color(30,30,30,255) )
- draw.SimpleText("$ " .. client:GetNWInt("playerMoney"), "DermaDefaultBold", 263, ScrH() - 95, Color(255,255,255,255), 0, 0)
- end
- hook.Add("HUDPaint", "TestHud", HUD)
- 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", "HideDefaultHud", HideHud)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement