shadowndacorner

Spawn protection

Apr 16th, 2012
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. -- Obviously change these to your area
  2. local startpos=Vector(0, 0, 0)
  3. local endpos=Vector(1, 1, 1)
  4. local interval=0.2 -- You should probably leave this above 0 because I don't know how taxing ents.FindInBox is, but play with it.  If 0 works, put it to 0, as that'll be the best thing you can do
  5.  
  6. local nextThink=0
  7. hook.Add("Think", "removeSpawnAreaorWhatever", function()
  8.     if (CurTime()>nextThink) then
  9.         for f,v in pairs(ents.FindInBox(startpos, endpos)) do
  10.             if v:GetClass()=="prop_physics" then
  11.                 --Do whatever you want to run before removal here, obviously
  12.                 v:Remove()
  13.             end
  14.         end
  15.         nextThink=CurTime()+0.2
  16.     end
  17. end)
Advertisement
Add Comment
Please, Sign In to add comment