02.07.2012, 20:54
There is an easier way to check for ESC. Under a timer (preferably 1000ms, but you can do whatever you like), set a variable (something like ESC[playerid]) to 1, without a reason. Then, under OnPlayerUpdate, set the variable to 0.
Logic: OnPlayerUpdate isn't called when the player is in escape mode.
--Edit--
Example script:
Good luck, this system for AFK when ESC is also included in my AFK system thread.
Logic: OnPlayerUpdate isn't called when the player is in escape mode.
--Edit--
Example script:
pawn Код:
new ESC_Check_Timer;
new ESC[MAX_PLAYERS] = 0;
forward ESC_Check();
//OnGameModeInIt:
ESC_Check_Timer = SetTimer("ESC_Check", 1000, true);
//OnGameModeExit:
KillTimer(ESC_Check_Timer);
//OnPlayerUpdate:
ESC[playerid] = 0;
//ESC Timer:
public ESC_Check()
{
for(new i = 0, ii = GetMaxPlayers(); i < ii; i++)
{
if(IsPlayerConnected(i))
{
ESC[i] = 1;
}
}
}