Hello, I'm curious to know if it's possible to check if a player is within two sets of coordinates, if so, please give an example, thanks.
I like Iprotect, but what I have noticed if you choose a large area for it to protect, it doesn't protect everything that I have selected. I can have it where half my area is fine, but as soon as you go into the other half it lets players destroy blocks.
You probably know this already, but anyway: Cartesian Plane with logic. PHP: /** * Assuming the region to be a cuboid, you will need * to take the coordinates of two opposite vertices. * * For example (X-coordinate, Y-coordinate, Z-coordinate): * First Vertex: (100, 20, 100) * Second Vertex: (200, 50, 200) *///$x = [x-coordinate of vertex 1, x-coordinate of vertex 2]; same for $y and $z.$x = [100, 200];$y = [20, 50];$z = [100, 200];//min($array) outputs the smallest value stored in $array.//max($array) outputs the largest value stored in $array.$minX = min($x);$minY = min($y);$minZ = min($z);$maxX = max($x);$maxY = max($y);$maxZ = max($z);//To check whether (Player) $player is in the region.$pos = $player->getPosition();if( $pos->x >= $minX and $pos->x <= $maxX and $pos->y >= $minY and $pos->y <= $maxY and $pos->z >= $minZ and $pos->z <= $maxZ){ //$player is inside the region}
You know, you just made it more complicated by introducing the term "Cartesian plane" (while the coordinates system is pretty much common sense, few people know the technical term for it )