23.02.2014, 13:16
I'm currently in the way to create a command called "checkafk", which checks for AFK players (here's what I've done now)
But, how can i stop the "gettime" function, when he comes back?
pawn Код:
/*As Local*/
new AFKTime[MAX_PLAYERS];
/*Command and stuff*/
public OnPlayerPause(playerid)
{
//scripts here
AFK{ playerid } = true;
AFKTime[playerid] = gettime();
return 1;
}
public OnPlayerResume(playerid, time)
{
//scripts here
//stopping the GETTIME Function
return 1;
}
CMD:checkafk(playerid,params[] ){
new count = 0;
new string[128];
new names[MAX_PLAYER_NAME];
GetPlayerName(playerid, names, sizeof(names));
SendClientMessage(playerid, COLOR_ORANGE,"* AFK(paused) players;");
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
if( AFK{ i } )
{
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "* %s[%d]", name, i);
SendClientMessage(playerid, COLOR_YELLOW, string);
count++;
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_ORANGE,"* Nobody is AFK(paused)!");
}
return 1;
}