How can i filter all players inside a ents.FindInBox to all players on the server, so i get all players that is OUTSIDE that box? Im talking about Lua ofc. Im working with loops and such but really, it shouldent be this hard, could anyone help me?
Get out. Seriously, do it.
SVN Tutorial
My SVN:Get dropbox and get 250 MB extra space: DropboxCode:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Clever answer, but lets say i want to split up those guys that is inside and those that is outside into 2 tables. I have been lurking with loops and stuff for hours, i still dont find it out :<
Also, your uses ApplyClip function which i have no idea how it works.
Get out. Seriously, do it.
Here you go!
Note: untested.
Code:-- handy inrange function local function inrange( vec, min, max ) if (vec.x < min.x) then return false end if (vec.y < min.y) then return false end if (vec.z < min.z) then return false end if (vec.x > max.x) then return false end if (vec.y > max.y) then return false end if (vec.z > max.z) then return false end return true end local function Find( classname, min, max ) -- if it's players you're after, it's simple: -- local targets = player.GetAll() -- and then you can remove the "classname" argument as well -- if it's not just players... local targets = ents.FindByClass(classname) -- set up tables local inbox = {} local notinbox = {} -- loop time! for _, e in pairs( targets ) do -- check using our handy function if (inrange( e:GetPos(), min, max )) then -- if it's inside the box table.insert( inbox, e ) else -- if it isn't table.insert( notinbox, e ) end end -- maybe you want to send it somewhere? return inbox, notinbox end
Last edited by Divran; 03-16-2010 at 04:38 PM.
SVN Tutorial
My SVN:Get dropbox and get 250 MB extra space: DropboxCode:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Your code seems to work Divran, but how does it remove players that have changed from inside to outside the box, or players that have left the server?
By reseting the Table as i seen you do, wouldent that be quite a pain, couse it needs to fill it back up all the time?
Get out. Seriously, do it.
SVN Tutorial
My SVN:Get dropbox and get 250 MB extra space: DropboxCode:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Anyways, i shall try it out, Thanks alot :3
Edit: It works perfectly. You sure will get credits when this is done![]()
Last edited by Donkie; 03-17-2010 at 06:27 AM.
Get out. Seriously, do it.
Bookmarks