Code:
--LIFE CHECK [ESP]
local function MESPCheck(v)
if v:Alive() == true && v:Health() ~= 0 && v:Health() >= 0 && v ~= LocalPlayer() && LocalPlayer():Alive() then
return true
else
return false
end
end
-- NAME / ARMOUR / HP
local check_key, do_draw_esp = false
local function check_ins()
local key_down = input.IsKeyDown( KEY_INSERT )
if key_down and !check_key then
check_key = true
do_draw_esp = !do_draw_esp
elseif !key_down and check_key then
check_key = false
end
end
local function draw_esp()
if ( not do_draw_esp )
then
for k, v in pairs( player.GetAll() ) do
if ( v == LocalPlayer() ) then continue end
local pos = ( v:GetPos() + Vector( 0, 0, 80 ) ):ToScreen()
draw.SimpleText( v:Health(), "DebugFixedSmall", pos.x, pos.y - 5, Color( 255, 0, 200 ), 1, 1, 2, Color( 0, 0, 0, 255 ) )
draw.SimpleText( v:Nick(), "DebugFixedSmall", pos.x, pos.y - 20, Color( 255, 0, 200 ), 1, 1, 2, Color( 0, 0, 0, 255 ) )
end
end
end
local function drawing_hook()
check_ins()
draw_esp()
end
hook.Add( "HUDPaint", "", drawing_hook )
-- CUSTOM CROSSHAIR
local shouldDraw = true
local hzCross = CreateClientConVar("HZ_Crosshair","0",false)
function Crosshair1()
surface.SetDrawColor(team.GetColor(LocalPlayer():Team()))
surface.DrawLine(ScrW() / 2 - 10, ScrH() / 2, ScrW() / 2 + 11 , ScrH() / 2)
surface.DrawLine(ScrW() / 2 - 0, ScrH() / 2 - 10, ScrW() / 2 - 0 , ScrH() / 2 + 11)
end
hook.Add("HUDPaint","CustomCross",Crosshair1)
local function coordinates( ent )
local min, max = ent:OBBMins(), ent:OBBMaxs()
local corners = {
Vector( min.x, min.y, min.z ),
Vector( min.x, min.y, max.z ),
Vector( min.x, max.y, min.z ),
Vector( min.x, max.y, max.z ),
Vector( max.x, min.y, min.z ),
Vector( max.x, min.y, max.z ),
Vector( max.x, max.y, min.z ),
Vector( max.x, max.y, max.z )
}
local minX, minY, maxX, maxY = ScrW() * 2, ScrH() * 2, 0, 0
for _, corner in pairs( corners ) do
local onScreen = ent:LocalToWorld( corner ):ToScreen()
minX, minY = math.min( minX, onScreen.x ), math.min( minY, onScreen.y )
maxX, maxY = math.max( maxX, onScreen.x ), math.max( maxY, onScreen.y )
end
return minX, minY, maxX, maxY
end
hook.Add("HUDPaint", "Example", function()
for k,v in pairs(player.GetAll()) do
local x1,y1,x2,y2 = coordinates(v)
print(tostring(team.GetColor(v:Team())))
surface.SetDrawColor(255, 0, 200)
check_ins()
draw_esp()
if ( not do_draw_esp )
then
surface.DrawLine( x1, y1, math.min( x1 + 100, x2 ), y1 )
surface.DrawLine( x1, y1, x1, math.min( y1 + 200, y2 ) )
surface.DrawLine( x2, y1, math.max( x2 - 100, x1 ), y1 )
surface.DrawLine( x2, y1, x2, math.min( y1 + 200, y2 ) )
surface.DrawLine( x1, y2, math.min( x1 + 100, x2 ), y2 )
surface.DrawLine( x1, y2, x1, math.max( y2 - 200, y1 ) )
surface.DrawLine( x2, y2, math.max( x2 - 100, x1 ), y2 )
surface.DrawLine( x2, y2, x2, math.max( y2 - 200, y1 ) )
end
end
end)
[/SPOILER]