Quote:
Originally Posted by Emera
[...]
|
I'm sure he ment how to find players within a certain range, not how to get the range. You could do that the following way using
findNearestPlayers():
PHP Code:
function attackPlayers(from_x, from_y, distance_max) {
for (temp.pl: findNearestPlayers(temp.from_x, temp.from_y) {
temp.dx = temp.pl.x - temp.from_x;
temp.dy = temp.pl.y - temp.from_y;
temp.distance = (dx^2 + dy^2) ^ 0.5; //calculate distance
echo("Distance to " @ temp.pl.account @ ": " @ temp.distance);
if (temp.distance > temp.distance_max) continue; //ignore players that are further away than you want them to be
//do stuff to the players within the given range
}
}