View Single Post
  #3  
Old 05-30-2014, 07:50 PM
callimuc callimuc is offline
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
Quote:
Originally Posted by Emera View Post
[...]
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_xfrom_ydistance_max) {
  for (
temp.plfindNearestPlayers(temp.from_xtemp.from_y) {
    
temp.dx temp.pl.temp.from_x;
    
temp.dy temp.pl.temp.from_y;
    
    
temp.distance = (dx^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
  
}

__________________
MEEP!
Reply With Quote