Theoretically, it'd work, yes. But since you are bringing up gmaps, no. Was
Hit doesn't work on gmaps. At least it did not on Atlantis a couple months back. You can use something similar to this though:
PHP Code:
//#CLIENTSIDE
function onKeyPressed() {
if (player.freezetime > 0 || player.paused)
return;
if (!keydown(5) || player.ani.name != "sword")
return;
temp.tx = player.x + 1.5 + vecx(player.dir) * 2;
temp.ty = player.y + 2 + vecy(player.dir) * 2;
triggerAction(temp.tx, temp.ty, "Sword", player.account);
}
Old piece of code I've been using in the past. Triggers onActionSword(acc) in NPCs in range.