Problem with HUD in Nutscript


function HUDPaint()

local lp = LocalPlayer()
local wep = LocalPlayer():GetActiveWeapon()
--Layer: 1

draw.RoundedBox(4, 0, ScrH()/1.3, ScrW()/8, ScrH()/4.17, Color(0, 0, 0, 231))

--Layer: 2
draw.RoundedBox(0, ScrW()/128, ScrH()/1.24, ScrW()*(lp:Health()/940), ScrH()/48, Color(191, 0, 0, 255))
draw.RoundedBox(0, ScrW()/128, ScrH()/1.15, ScrW()*(lp:Armor()/940), ScrH()/48, Color(0, 98, 191, 255))
draw.DrawText("Health", "Arial24", ScrW()/128, ScrH()/1.29, Color(255, 255, 255, 255))
draw.DrawText("Armor", "Arial24", ScrW()/128, ScrH()/1.19, Color(255, 255, 255, 255))
end
hook.Add("CharacterLoaded", "NameLMAO", HUDPaint)

I have this function to draw the hud
But if i hook onto CharaterLoaded it won’t gonna work, if i hook onto HUDPaint it gonna work but it will show even on the character selection menu which i don’t want to
And any idea how do i get stamina value in nutscript?

[editline]11th January 2017[/editline]

Nvm fixed by add a var check


function HUDPaint()

local lp = LocalPlayer()
local wep = LocalPlayer():GetActiveWeapon()
--Layer: 1
if lmao == true then
draw.RoundedBox(4, 0, ScrH()/1.3, ScrW()/8, ScrH()/4.17, Color(0, 0, 0, 231))

--Layer: 2
draw.RoundedBox(0, ScrW()/128, ScrH()/1.24, ScrW()*(lp:Health()/940), ScrH()/48, Color(191, 0, 0, 255))
draw.RoundedBox(0, ScrW()/128, ScrH()/1.15, ScrW()*(lp:Armor()/940), ScrH()/48, Color(0, 98, 191, 255))
draw.RoundedBox(0, ScrW()/128, ScrH()/1.07, ScrW()*(lp:getLocalVar("stm", 0)/940), ScrH()/48, Color(255, 255, 0, 255))
draw.DrawText("Health", "Arial24", ScrW()/128, ScrH()/1.29, Color(255, 255, 255, 255))
draw.DrawText("Armor", "Arial24", ScrW()/128, ScrH()/1.19, Color(255, 255, 255, 255))
draw.DrawText("Stamina", "Arial24", ScrW()/128, ScrH()/1.11, Color(255, 255, 255, 255))
end
end
hook.Add("HUDPaint", "NameLMAO", HUDPaint)
hook.Add("CharacterLoaded", "CharacterLMAO", function()
	lmao = true
	end)