Making a Box

Hi, I am trying to make a box in a certain area and if someone is in it it runs a function. Sorta like a radar.

I tried .

Any clue?

Is it the function you dont understand, or how to use it or how to get the cordinates right, or…? You dont post any information.

Sorry, about the lack of explanation.

I don’t really understand any of it and was hoping someone could explain it to me or give me a really small slit of sample data.

Like, how do I make the box?
How do I find the x, y, z coordinates in the map?
After I make the box how do I run a function inside it?

You need to create an entity, and probably do something like:

function ENT:Think()
	for k, v in pairs (player.ents.FindInSphere( Vector(0, 0, 0), 50 )) do
		-- stuff

This should do stuff to players, inside a radius of 50 from the given point.

Type GetPos in console to get the cordinates of your current location.

You need to create an entity and put in the given code.

So, how would I make a box, not a Sphere?

function ENT:Think()
for k, v in pairs (player.ents.FindInBox( Vector(0, 0, 0), 50 )) do
– stuff

Is the Vector different at all?

Well, I dont know with the box.

ents.FindInBox( Vector(-32,-32,-32), Vector(32,32,32) )

I’m guessing the cordinates given are upper-left corner to lower-right corner, or something like that.

That is what I’d assume also BusyMoney. So with the bit of code in the example on the wiki, I’m guessing the box would be 64 x 64 x 64. Also I believe the description is incorrect.

This is implying that the maps origin is at (0, 0, 0) which we know most map origins are not at 0, 0, 0.
I dont know if you know, but with vectors you are only giving it the end coordinates. The vector start coordinates always start at (0, 0, 0)

Why are you doing it this way though? Wouldn’t you be better off putting a trigger in the map and then finding players that way? Maybe if you told us the application of this we might be more helpful.