• Delete entity if not in zone
    5 replies, posted
Here's what to do: When the entity from the list in zone then nothing happen but when entity leave from zone then entity removed. Sorry for my english.
http://wiki.garrysmod.com/page/ents/FindInBox You can use this to get all of the entities within an area and go from there.
i tried use it but it's dont working , i dont know how to make entity was removed if not ents.FindInBox
I won't spoon feed you. Here's my final gift to you Entity/Remove Are you a Lua beginner? Perhaps you need more of a foundation which enables you to learn. Learning Lua and GLua
double efficiency by doing things directly: function RemoveEntsOutBounds(vector1, vector2)     OrderVectors(vector1, vector2)     for _, ent in pairs(ents.GetAll()) do         if not IsValid(ent) then return end         if ent:GetPos():WithinAABox(vector1, vector2) then ent:Remove() end     end end
local vecto = FindMetaTable( "Vector" ) function vecto:InBox(vec1,vec2)     OrderVectors(vec1,vec2)     return self:WithinAABox(vec1,vec2) end local pos1 = Vector(0,0,0) local pos2 = Vector(0,0,5) hook.Add("PlayerSpawnedProp","DisablePropSpawnZone",function(ply,model,ent) if not ent:GetPos():InBox(pos1,pos2) then     ent:Remove() end end) Example for props All you need to change is hook https://files.facepunch.com/forum/upload/108574/1141fd83-ba03-4f33-a065-ddd07b41c6a3/Screenshot_15.png You can use this one
Sorry, you need to Log In to post a reply to this thread.