15.07.2009, 11:34
The code works fine but it wont change the players name to '[AFK] <name>' it just says there away and leaves the name as it was:
pawn Код:
if(strcmp("/afk",cmdtext,true)==0)
{
if(!IsPlayerConnected(playerid)) return SysMsg(playerid,"Please wait until you are fully connected!");
if(IsAFK[playerid] == 0)
{
format(string,sizeof(string),"[AFK] %s",Name(playerid));
SetPlayerName(playerid,string);
IsAFK[playerid] = 1;
format(string,sizeof(string),"%s is now Away From Keyboard (AFK)",Name(playerid));
SendClientMessageToAll(COLOUR_GREEN,string);
printf("[Cmd] %s Is Now AFK",Name(playerid));
}else{
new nName[256],nFile[128];
nFile = GetPlayersFile(playerid);
nName = dini_Get(File,"Account Name");
SetPlayerName(playerid,nName);
format(string,sizeof(string),"%s is no longer Away From Keyboard (AFK)",Name(playerid));
SendClientMessageToAll(COLOUR_GREEN,string);
IsAFK[playerid] = 0;
printf("[Cmd] %s Is No Longer AFK",Name(playerid));
}
return 1;
}