• Help finding a specific entity within range of player
    0 replies, posted
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. [CODE]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[/CODE] so how would I find all the players not in the sphere? Thank you in advance! -EDIT- 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: [CODE] for con,entfound in pairs (ents.FindInSphere(self:GetPos(), 200)) do if entfound:GetClass() == "habitatdestroyer" then[/CODE]
Sorry, you need to Log In to post a reply to this thread.