16.10.2011, 17:25
I doubt setting timers constantly in OnPlayerUpdate is a good idea. Instead you should have something more simple:
Something similar to how I do it. Anything wrong or such? By the way I just use the one toggle per player for easier manipulation. I'm sure you get it.
pawn Код:
new AFK[MAX_PLAYERS char];
public OnGameModeInit()
{
SetTimer("checkAFK", 1000, true);
}
public OnPlayerUpdate(playerid)
{
AFK{playerid} = 0;
}
forward checkAFK();
public checkAFK()
{
foreach(Player, i)
{
if(AFK{i} < 3)
{
AFK{i} ++;
}
else if(AFK{i} != 10)
{
// Player went AFK
AFK{i} = 10;
}
}
}