SA-MP Forums Archive
AFK System - 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: AFK System (/showthread.php?tid=345558)



AFK System - Edin Black - 25.05.2012

Can anyone make me a AFK system, when i go afk, then comes over your head: "Player is AFK" and the time, how long he is afk.


Re: AFK System - FalconX - 25.05.2012

Quote:
Originally Posted by Edin Black
Посмотреть сообщение
Can anyone make me a AFK system, when i go afk, then comes over your head: "Player is AFK" and the time, how long he is afk.
You can use the following script, I posted this some time ago for helping a guy in the forum

pawn Код:
forward Checking();

forward OnPlayerPause(playerid);
 
new iAFKp[MAX_PLAYERS];
 
public OnFilterScriptInit() // or game mode init
{
        SetTimer("Checking", 1000, true);
        return 1;
}

public Checking()
{
    for(new x = 0; x < MAX_PLAYERS; x++)
    {
        iAFKp[x]++;
        if(iAFKp[x] > 3)
        {
                        OnPlayerPause(x);
        }
    }
}
 

public OnPlayerPause(playerid)
{
        new tmpstring[128];
        format(tmpstring, sizeof(tmpstring), "PAUSED for %d seconds", iAFKp[playerid]);
        SetPlayerChatBubble(playerid, tmpstring, COLOR, 10.0, 1000);
        return 1;
}

public OnPlayerUpdate(playerid) // to check if he is paused, onplayerupdate stops if a player press ESC so it's best to do this way
{
        iAFKp[playerid] = 0;
        return 1;
}
Original link: http://forum.sa-mp.com/showpost.php?...96&postcount=7
-FalconX


Re: AFK System - Ugaustin - 04.03.2015

it starts with 4 second?? make it start from 1 second..