function serverCmdafk(%client)
{
if(isObject(%client.player)){
if(%client.isafk==0){
%client.player.emote(afkImage);
%client.isafk=1;
echo("AFK works");
}else{
%client.player.emote(hateImage);
%client.isafk=0;
}}
}
Try it. If 'AFK works' shows up in your console, the code works.
Unless, of course, I did it wrong.