COMMAND:afklist(playerid,params[]) { #pragma unused params new count = 0; new string[128]; new IsAfkPlayer[MAX_PLAYER_NAME]; SendClientMessage(playerid, COLOR_GREEN, " "); SendClientMessage(playerid, COLOR_GREEN, "___________ |- Online Admins -| ___________"); SendClientMessage(playerid, COLOR_GREEN, " "); for(new i = 0; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { if(IsAfk[playerid] == 1) { GetPlayerName(IsAfk[playerid],IsAfkPlayer,sizeof(IsAfkPlayer)); format(string, "AFK: %s",IsAfkPlayer); SendClientMessage(playerid, COLOR_WHITE, string); count++; } } } if (count == 0) SendClientMessage(playerid,COLOR_BRIGHTRED,"No one is AFK here buddy."); SendClientMessage(playerid, COLOR_GREEN, " _______________________________________"); return 1; }
format(string, "AFK: %s",IsAfkPlayer);
// top of script:
new IsAfkPlayer[MAX_PLAYER_NAME];
// in your /afk command
IsAfkPlayer[playerid] = 1;
// command:
COMMAND:afklist(playerid,params[])
{
#pragma unused params
new count = 0;
new string[128];
SendClientMessage(playerid, COLOR_GREEN, " ");
SendClientMessage(playerid, COLOR_GREEN, "___________ |- Online Admins -| ___________");
SendClientMessage(playerid, COLOR_GREEN, " ");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsAfkPlayer[playerid] == 1)
{
count++;
new name[24];
GetPlayerName(playerid,name,24);
format(string, "AFK PLAYERS: %s",name);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
if(count == 0)
{
SendClientMessage(playerid,COLOR_BRIGHTRED,"No one is AFK here buddy.");
SendClientMessage(playerid, COLOR_GREEN, " _______________________________________");
}
return 1;
}
SendClientMessage(playerid, COLOR_GREEN, "___________ |- Online Admins -| ___________");
the problem is here -> format(string, "AFK PLAYERS: %s",name); and was already solved.
|
Also Grand Theft -
pawn Код:
|
GetPlayerName(IsAfk[playerid],IsAfkPlayer,sizeof(IsAfkPlayer));
GetPlayerName( i ,IsAfkPlayer,sizeof(IsAfkPlayer));
if(IsAfk[playerid] == 1)
if(IsAfk[i] == 1)