02.09.2012, 19:12
Hey guys. I try to fix this command - /afklist . When get typed the command i want to show the afk'ers.
But when i test it with my friend it shows the player's name. Example: Im Nork and my friend is Garry.
Garry goes afk and Nork type /afklist. But it says: Nork is afk. Actually he isn't.
Here is the AFK system.
And here is what i tried to build to create /afklist .
+REP for the dude who help me.
But when i test it with my friend it shows the player's name. Example: Im Nork and my friend is Garry.
Garry goes afk and Nork type /afklist. But it says: Nork is afk. Actually he isn't.
Here is the AFK system.
pawn Код:
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
if(AFK[playerid] == 0)
{
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, 280, "%s has gone AFK.", pname);
SendClientMessageToAll(COLOR_PINK, string);
TogglePlayerControllable(playerid,0);
AFK[playerid] = 1;
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: You are already AFK.");
return 1;
}
if (strcmp("/back", cmdtext, true, 10) == 0)
{
if(AFK[playerid] == 1)
{
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, 280, "%s is now back from being AFK.", pname);
SendClientMessageToAll(COLOR_PINK, string);
TogglePlayerControllable(playerid,1);
AFK[playerid] = 0;
}
else return SendClientMessage(playerid, COLOR_RED, "ERROR: You aren't AFK.");
return 1;
}
pawn Код:
if (strcmp("/afklist", cmdtext, true, 10) == 0)
{
new pString[MAX_PLAYER_NAME], pName3[MAX_PLAYER_NAME];
for(new pID = 0; pID < MAX_PLAYERS; pID ++)
{
if(IsPlayerConnected(pID))
{
if(AFK[pID] == 1)
{
SendClientMessage(playerid, COLOR_CYAN, "==============================");
SendClientMessage(playerid, COLOR_PURPLE, "AFK List:");
GetPlayerName(playerid, pName3, sizeof(pName3));
format(pString, sizeof(pString), "%s", pName3);
SendClientMessage(playerid, COLOR_PINK, pString);
SendClientMessage(playerid, COLOR_CYAN, "==============================");
}
}
}
return 1;
}