20.11.2016, 19:27
Quote;
The rest is yours.
Код:
new bool: IsPlayerPausedx[MAX_PLAYERS], PlayerPausedCount[MAX_PLAYERS], Paused_Timer, AFkMi[MAX_PLAYERS] ; public OnGameModeInit() { Paused_Timer = SetTimer("OnPlayersPaused", 1000, true); return 1; } public OnGameModeExit() { KillTimer(Paused_Timer); return 1; } public OnPlayerConnect(playerid) { IsPlayerPausedx[playerid] = false; PlayerPausedCount[playerid] = 0; return 1; } public OnPlayerUpdate(playerid) { PlayerPausedCount[playerid] = 0; if(IsPlayerPausedx[playerid]) { CallLocalFunction("OnPlayerUnpaused", "i", playerid); IsPlayerPausedx[playerid] = false; } return 1; } forward OnPlayerPaused(playerid); public OnPlayerPaused(playerid) { AFkMi[playerid] = 1; // If the player is AFK. // AFK operations. } forward OnPlayerUnpaused(playerid); public OnPlayerUnpaused(playerid) { AFkMi[playerid] = 0; // Afk player leaves. // AFK operations. } forward OnPlayersPaused(); public OnPlayersPaused() { foreach(new playerid : Player) { if(PlayerPausedCount[playerid] < 2 ) PlayerPausedCount[playerid]++; else { CallLocalFunction("OnPlayerPaused", "i", playerid); IsPlayerPausedx[playerid] = true; } } }