View Single Post
  #3  
Old 06-24-2011, 06:18 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by BrianD View Post
I use findnearestplayers to recognize the closest player, and tokenize it, however this sometimes turns out in client.hurt[1] being my own account, and not the nearest account besides my own. in theory, client.hurt[0] should be my own account, and the second closest player to me besides myself is client.hurt[1]...however it's sporadic and i'm not sure why.
You do need to work on your styling, but anyway... Examine this.
PHP Code:
for (temp.plfindnearestplayers(temp.xtemp.y)) {
  
// make sure the player cannot hit self
  
if (temp.pl == player
    continue;
  
// break the loop if the target is not in range
  
if (vectordist({temp.pl.xtemp.pl.y0}, {temp.xtemp.y0}) > 3
    break;
  
// damage target
  
temp.pl.damageTarget();

Reply With Quote