How do I stop my player and other players from drawing with my entity ESP
3 replies, posted
Hello, I made some code to draw a square on every entity known on the map. It works for the most part but it also draws me and other players.
How will I make it stop from drawing a square on players.
local entity_esp = CreateClientConVar("ent_esp_enable", "1", true, false)
local function entesp()
if !entity_esp:GetBool() then return end
for k, v in pairs(ents.GetAll()) do
function DrawLine(pos1,pos2,pos3,pos4)
surface.SetDrawColor(0,255,0,255) surface.DrawLine(pos1,pos2,pos3,pos4) end
btr = v:OBBMaxs()+v:GetPos() fbl = v:OBBMins()+v:GetPos()
x = btr.x y= btr.y z= btr.z x1=fbl.x y1=fbl.y z1=fbl.z rz = z1-z1
DrawLine(btr:ToScreen().x,btr:ToScreen().y,fbl:ToScreen().x,btr:ToScreen().y)
DrawLine(btr:ToScreen().x,btr:ToScreen().y,btr:ToScreen().x,fbl:ToScreen().y)
DrawLine(fbl:ToScreen().x,fbl:ToScreen().y,btr:ToScreen().x,fbl:ToScreen().y)
DrawLine(fbl:ToScreen().x,fbl:ToScreen().y,fbl:ToScreen().x,btr:ToScreen().y)
end
end
hook.Add("HUDPaint", "entesp", entesp)
if v:IsPlayer() then continue end
I've never used continue yet. And I'm still learning gmod lua. But thanks for help.
I prefer not to nest if checks, all you had to do was if !v:IsPlayer() then ... end
Instead you just copied from [Lua] Ambush
Sorry, you need to Log In to post a reply to this thread.