When a command is pressed it teleports a player in a particular place [https://postimg.org/image/72a26gjpln/] As you can see at the image a above when the command is executed the player in the red area (1000x1000-500x500) will be teleported to the 500x500 green area (safespawn) but if the person. Is inside the 500x500 area and 100x100 they're not gonna be teleported. And so on
First, let's make a function which checks whether a Vector3 lies in between two Vector2 points. PHP: public function inVector2(Vector3 $vec3, Vector2 $vec2a, Vector2 $vec2b) : bool{ $v2x = [$vec2a->x, $vec2b->x];//x-value of the Vector2s $v2y = [$vec2a->y, $vec2b->y];//y-value of the Vector2s (corresponds to vec3->z) return $vec3->x > min($v2x) && $vec3->x < max($v2x) && $vec3->z > min($v2y) && $vec3->z < max($v2y);} Basic math, pretty easy to understand. Now, lets make functions for checking if the Vector3 lies in the three regions. 100x100 would be: PHP: public function in100x100(Vector3 $object) : bool{ return $this->inVector2($object, new Vector2(-50, -50), new Vector2(50, 50));} 500x500 would be: PHP: public function in500x500(Vector3 $object) : bool{ return !$this->in100x100($object) //check if object is not in 100x100 because 100x100 lies in 500x500 && $this->inVector2($object, new Vector2(-250, -250), new Vector2(250, 250));} Similarly, you can guess what 1000x1000 would be. You just need to connect the dots now. You have got everything. PHP: $canBeTeleported = $this->in1000x1000($player) && !$this->in500x500($player);if(!$canBeTeleported){ if($this->in500x500($player)){ echo "Could not teleport $player because they are in the green region."; } if($this->in100x100($player)){ echo "Could not teleport $player because they are in the blue region."; }} Yeah, it's somewhat annoying to call in100x100() function multiple times in some instances. Maybe have a second argument for in{!=100}x{!=100}() functions that would control checking areas inside an area.