It is usually best to do the entire thing serverside
PHP Code:
function attack(dx, dy) {
for (temp.pl : findNearestPlayers(dx, dy)) {
if (! (dx in |player.x, player.x + 3| && dy in |player.y, player.y + 3|)) {
continue;
}
if (pl == player) { // if it's the attacking player, skip
continue;
}
pl.hit(0.5, player);
}
}
then in the player class,
PHP Code:
public function hit(damage, pl) {
this.hearts -= damage;
this.chat = "Hurt by: " @ pl.account;
this.setAni("human2_hurt", null);
}
However, if you choose to do it clientside, you will need a weapon to intercept the trigger. Once you intercept it clientside in a weapon, you will need to trigger serverside again in that weapon then call the player function as player.hearts can't be modified clientside.