How can i make a box and check if a player is in?

How can i make a box and check if a player is in?

I know it’s a noob question but i tried everything and couldn’t do it :frowning:
Than you :slight_smile:

**[Ents.FindInBox

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Ents.FindInBox)** is what you need.

I need a Captain Obvious rating :-D.

I won’t loop through all entities in the box, i will do it with a range of coordinates and check if the player position is in the range. Thank you anyway

Ents.FindInBox is so much easier.

Also, from what I know you can set a argument to only check for players.

If not I could even do that.

[editline]10th March 2011[/editline]

My bad. No filters.

Ignore my comments, I’m an idiot.

I have tryed with

[lua]if (player:GetPos(1) > -6966 && player:GetPos(1) < -6866 && player:GetPos(2) > -9685 && player:GetPos(2) < -9620) then
return true
else
return false
end;[/lua]

and I’v got this :frowning:
[lua]…lua:1] attempt to compare number with userdata[/lua]

How can i compare it?
Thanks you :confused:

I’m not exactly sure how you’d do that, but I can point out the mistakes you did in this: Ent:GetPos() does not take any arguments and if it would you’d still be comparing vector to a number.

Fixed :slight_smile:

It works with
[lua]player:GetPos().x[/lua]
not with
[lua]player:GetPos(1)[/lua]

You don’t need to do the whole “if myBoolean then return true else return false end”

Just do “return myBoolean”