SA-MP Forums Archive
Is there anyway to Detect ESC.[REP+] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Is there anyway to Detect ESC.[REP+] (/showthread.php?tid=539504)



Is there anyway to Detect ESC.[REP+] - SWGamer - 28.09.2014

I want to know if there is any way to Detect Player Pressing ESC.


Reward:REP+



Re: Is there anyway to Detect ESC.[REP+] - Rudy_ - 28.09.2014

Use timer to detect if onPlayerUpdate is called or not, If not than the player is AFK.


Re: Is there anyway to Detect ESC.[REP+] - SWGamer - 28.09.2014

Can you gimme a Example Dude.


Re: Is there anyway to Detect ESC.[REP+] - SickAttack - 28.09.2014

pawn Код:
new bool:PlayerPaused[MAX_PLAYERS] = false,
InactiveTime[MAX_PLAYERS];

public OnGameModeInit()
{
    SetTimer("CheckForPausedPlayers", 1000, true);
    return 1;
}

public OnPlayerUpdate(playerid)
{  
    if(InactiveTime[playerid] >= 5) PlayerPaused[playerid] = false; // Player has unpaused their game.
    InactiveTime[playerid] = 0;
    return 1;
}

forward CheckForPausedPlayers();
public CheckForPausedPlayers()
{
    foreach(new i: Player)
    {
        if(PlayerPaused[i] == false)
        {
            InactiveTime[i] ++;
            if(InactiveTime[i] == 5) PlayerPaused[i] = true; // Player has paused their game.
        }
    }
}



Re: Is there anyway to Detect ESC.[REP+] - SWGamer - 29.09.2014

Thanks REP+ Both