Detect if a player is in a certain map area

Hi guys,

I’m working on a script and I just wanted to get opinions on facepunch about the best way this can be scripted, here’s what I want to do:

  • Detect if a player is in a certain area of the map
  • Detect when they enter or leave the area
  • From reading the gmod wiki I can see comparing vector distances can be quite in-efficent, so what is the most efficent way to do it

Thanks for your help in advance!

If the area is a large area then don’t run this every think hook. Do it every second or two.
Only do this if you cannot think of any problems if they enter and leave the area after they have physically entered/exited.