20.02.2013, 07:27
With what function you can check to see if the player is AFK?
Checking the position is not suitable
Checking the position is not suitable
new AFK[MAX_PLAYERS];
for(new i = 0; i< MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(AFK[i] == 1)
new AFK [MAX_PLAYERS];
if(AFK[playerid] == 1)
{
return GameTextForPlayer(playerid, "You are already in AFK. Use /back",3000,3);
}
forward AFK();
new afk[MAX_PLAYERS];
public AFK()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
afk[i]++;
}
}
public OnGameModeInit()
{
SetTimer("AFK", 1000, true);
}
public OnPlayerUpdate(playerid)
{
afk[playerid] = 0;
}
CMD: afk(playerid)
{
new name[28];
new string[128]
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(afk[i] = 3;
{
format(string, sizeof(string), "%s is AFK.",GetPlayerName(i, name, sizeof(name));
SendClientMessage(playerid, -1, string);
}
}
return 1;
}