View Single Post
  #4  
Old 05-30-2014, 08:17 PM
i8bit i8bit is offline
Registered User
Join Date: Jul 2013
Posts: 146
i8bit is an unknown quantity at this point
Quote:
Originally Posted by callimuc 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
  
}


I may be doing it wrong.. but the way I did it seems so much simpler...

in the action-
PHP Code:
  triggeraction(player.1.5 vecx(player.dir) * 4player.vecy(player.dir) * 4"Lighthurt"player.dmgplayer.z+3player.z-3); 
in the hurt function-
PHP Code:
if (player.params[1]){
if (
player.params[2]){ 
Reply With Quote