Help about vector and player position

Hello i’m trying to make something.
If player are in an specific arena he can’t do an commands for example.

I have never worked with vector on gmod and i’m totally blocked. How can i make an simple cube arena who show on my screen ?

Thanks you in advance.

This is the easy way if you can’t do simple vector logic:

Keep in mind that the first vector must have all the minimal values you want to check and second all the largest values of a vector. ( Or just see second example )

Thanks you,i love you.

[editline]12th May 2016[/editline]

I have another problem,i wrote an small code :

concommand.Add( "voirvector", function(ply)
local PlayerPos = ply:GetPos()
print(PlayerPos:WithinAABox( Vector(7078, -7154, 0),Vector(7663,-7663, 96)))
end )

When i launch the command on the middle of my spawn area it print me this :
7517.074707 -7522.984863 0.031250

ply:GetPos() return an vector value who are in the box but PlayerPos:WithinAABox still return me false.

So i have to invert the two previous vector ? Like that ?
print(PlayerPos:WithinAABox(Vector(7663,-7663, 96),Vector(7078, -7154, 0)))
because it still print me false

Yeah, I got confused with WithinAABox as well. The first vector argument needs to be smaller IN ALL OF ITS VALUES than the second one. So x1 < x2 y1 < y2 z1 < z2 etc.

-7154 > -7663

There is a function that helps you with this.

Yeah but my getpos always return an value who are > -7663

[editline]12th May 2016[/editline]

I finally done it,thanks google !

local vCenter = Vector( 7517, -7507, 0) //center of the box
local boxSize = Vector(150,170,95)
local corner1 = vCenter-Vector(boxSize.x,boxSize.y, 0)
local corner2 = vCenter+boxSize
local telePos = Vector()

hook.Add("PostDrawOpaqueRenderables", "PDOR.TeleBoxDebug", function()
render.DrawWireframeBox(vCenter, Angle(), -Vector(boxSize.x,boxSize.y, 0), boxSize, Color(0,0,255), true)