ESP Help

I’m working on an ESP derived from [A-Hack], but I’m having some problems… The person’s health isn’t showing above their heads. Is getting health as a value not available or something? Here’s the code:
[lua]enabled = true

if enabled == true then
for _,v in ipairs (player.GetAll()) do
local pos = v:GetPos() + Vector(0,0,90)
pos = pos:ToScreen()
if v:Nick() == LocalPlayer():Nick() then
name = “”
dead = “”
else
name = v:Nick()
health = v:Health()
dead = “DEAD
end

if v:Health() > 0 then
    color = Color(255,255,255,255)
elseif v:Health() < 1 then
    color = Color(0,0,0,255)

end
draw.DrawText(dead, "ScoreboardText", pos.x, pos.y + 10, color,1)
draw.DrawText(name, "ScoreboardText", pos.x, pos.y - 10, color,1)
draw.DrawText(health, "ScoreboardText", pos.x, pos.y - 10, color,1)

end

end[/lua]

I cant test it but I believe you were missing a hook, but I decided to edit some of it for you, I’m hoping your not going to go minging.
I added a toggle console command and localized the variables.

[lua]
local enabled = true

function FailHax()
if(enabled) then
for _,v in pairs (player.GetAll()) do
if(v==LocalPlayer()) then return end
local pos = v:GetPos() + Vector(0,0,90)
pos = pos:ToScreen()

        	local name = v:Nick()
        	local health = v:Health()

		if(v:Alive()) then 
		local dead = ""
			local color = Color(0,255,0,255) -- If target is alive colour will be green
		else 
			local dead = "*DEAD*"
			local color = Color(255,0,0,255) -- If target is dead the colour will be red
		end

    		draw.DrawText(dead, "ScoreboardText", pos.x, pos.y + 10, color,1)
    		draw.DrawText(name, "ScoreboardText", pos.x, pos.y - 10, color,1)
    		draw.DrawText(health, "ScoreboardText", pos.x, pos.y - 10, color,1)

    	end

end

end
hook.Add(“HUDPaint”, “FailHaxDraw”, FailHax)

function FailhaxToggle()
if(enabled==true) then
enabled = false
else
enabled = true
end
end
concommand.Add(“toggle_failhax”, FailhaxToggle)
[/lua]

Got a bit confused with tabs, only have notepad at the moment.

Please don’t go and abuse the hax. :keke:

Edit:

Just read your post again, was there an error, dont understand it too well, if there is can you please post it.

I figured it out, but your code looks a bit better. This is going to be for my server’s admins only, so it wouldn’t be used for minging…