Quote:
Originally posted by Stefan
Serverside scripting functions:
NPC Code:
pindex = getnearestplayer(x,y)
with (players[pindex]) {
distance = ((x-playerx)^2+(y-playery)^2)^0.5;
if (distance<2)
// do stuff
}
or
NPC Code:
pindexes = getnearestplayers(x,y,playerhearts>=3)
for (i=0; i<arraylen(pindexes); i++) {
with (players[pindexes[i]]) {
distance = ((x-playerx)^2+(y-playery)^2)^0.5;
if (distance<2)
// do stuff
}
}
|
Why isnt there a ; at the end of the getnearestplayers?