You might also want to move some of that code to functions. I.e:
PHP Code:
function sendTrigger(pl) {
triggeraction(pl.x+0.5, pl.y+0.5, "Damage", this.effects, player.account, {temp.damage, temp.criton}, temp.accuracy, "Physical", 100, temp.armorpierce, temp.attackerlevel, ax, ay, az, ad);
if (client.showhits){
triggerserver("gui", this.name, "putnpc", "testblock",pl.x+0.5, pl.y+0.5);
}
}
Other functions may include:
PHP Code:
function inHittingRange(pl, maxdist) {
if (pl == player) {
return false;
}
if (dist(player.x + 1, player.y + 1.5, pl.x + 1, pl.y + 1.5) <= maxdist) {
if (player.dir == 0) {
if (pl.y < player.y + 0.5) {
return true;
}
}
else if (player.dir == 1) {
if (pl.x < player.x + 0.5) {
return true;
}
}
else if (player.dir == 2) {
if (pl.y > player.y + 0.5) {
return true;
}
}
else if (player.dir == 3) {
if (pl.x > player.x + 0.5) {
return true;
}
}
return false;
} else {
return false;
}
}
function inParty(pl) {
return (pl.account in clientr.party);
}
Also I would store the tokens in it's own variable, for clarity reasons and it's slightly more efficient.
Your code can then be re-factored to:
PHP Code:
temp.weapondata = wdata[5].tokenize(",");
temp.weapontype = temp.weapondata[1];
temp.weapondist = temp.weapondata[2];
if (temp.weapontype == "arc") {
for (temp.pl: findNearestPlayers(player.x, player.y)) {
if (!inParty(temp.pl)) {
if (inHittingRange(temp.pl, temp.weapondist)) {
sendTrigger(temp.pl);
}
}
}
}