I am coding an entity that finds players within a spherical radius of it.
It works great but I need to figure out if the players leave the radius or find every player that is NOT in its radius.
I am having some complications figuring the logic on this one.
Here is the think I have for the ent.
function ENT:Think() local entpos = self:GetPos() for _,targ in pairs(ents.FindInSphere(entpos, 1000)) do local class = targ:GetClass() if (class == "player") then targ:SetHazardous() end end end
so how would I find all the players not in the sphere?
Thank you in advance!
Found solution to the issue.
Anyone wondering what I did I used the player to search for the entity instead of using the entity to find players.
Here is how I solved it:
for con,entfound in pairs (ents.FindInSphere(self:GetPos(), 200)) do if entfound:GetClass() == "habitatdestroyer" then