PHP Code:
function onKeyPressed( code, key)
{
switch ( temp.code)
{
case "65": //a
Grab();
break;
}
}
function Grab()
{
frontPosition = { player.x + 1.5 + vecx(player.dir) * 2, player.y + 1.5 + vecy(player.dir) * 2};
canGrab = ( testplayer(frontPosition[0], frontPosition[1]) || testnpc(frontPosition[0], frontPosition[1]));
if ( canGrab)
triggerAction(frontPosition[0], frontPosition[1], "Grabbed", player.account, player.guild);
}
Here what I use, forgot where I got it though. :/