Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Eficiente Anti-ESC (detect pause)
- // Criado por Bruno da Silva
- // Agradecimentos a The Moddler
- // www.ips-team.blogspot.com
- // ================ [ Máximo de segundos em AFK ] =======================
- #define MAX_AFK 2
- // =============== [ Declarar variáveis ] ===============================
- new
- updateTime[MAX_PLAYERS],
- bool:playerPaused[MAX_PLAYERS];
- // ================== [ Iniciar a checagem de upTimers ] ==================
- main()
- {
- return SetTimer("updateTimers", 999, true), true;
- }
- // ================ [ Armarzenar update do Jogador ] ======================
- public OnPlayerUpdate(playerid)
- {
- return updateTime[playerid] = gettime(), true;
- }
- //================= [ Checar última OnPlayerUpdate ] =======================
- updateTimers();
- public updateTimers()
- {
- for(new i; i != MAX_PLAYERS; ++i) if(IsPlayerConnected(i))
- {
- if((GetPlayerPing(i) / 1000) < gettime() - updateTime[playerid] > MAX_AFK && !playerPaused[i] && GetPlayerState(i) && GetPlayerState(i) != 7)
- {
- CallRemoteFunction("OnPlayerPaused", "i", i);
- playerPaused[i] = true;
- }
- else
- if(playerPaused[i] && gettime() - updateTime[playerid] < MAX_AFK) CallRemoteFunction("OnPlayerUnpaused", "i", i), playerPaused[playerid] = false;
- }
- return true;
- }
- //=============== [ Declarar variáveis publicas ] ===========================
- OnPlayerPaused(playerid);
- OnPlayerUnpaused(playerid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement