I don't post on the Graal forums anymore and I shouldn't care, but I was just checking in and it irked me that such a simple question wasn't fully answered yet. There's several ways to do this. As Callimuc mentioned, one of the nicer ways is using a triggeraction.
Clientside, you'll specify a x,y as well as an "action" name (for when the object/player gets hit) and the action's parameters.
Example:
PHP Code:
//#CLIENTSIDE
// triggeraction(hit x, hit y, action name, action parameter(s))
triggeraction(player.x + 1.5 + vecx(player.dir) * 1.5, player.y + 2 + vecy(player.dir) * 1.5, "Hit", player.account);
Here, the "hitter" will "trigger an action" on anything that is at the specified hit x and hit y. In this case, it is directly in front of the hitter. We should also pass the hitter's account to the object/player being hit.
For an explanation on vecx and vecy and how they work in the above example, see a post of mine from a couple of years ago:
http://forums.graalonline.com/forums....php?p=1649547
Now, the object being hit can expect to have the following to handle the action:
PHP Code:
function onActionHit(acct) {
this.chat = "I've been hit by " @ acct;
}