SA-MP Forums Archive
[Include] AFK Auto-Detector[v0.1] - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] AFK Auto-Detector[v0.1] (/showthread.php?tid=525585)



AFK Auto-Detector[v0.2] - Mihaitza97 - 12.07.2014

AFK Auto-Detector[v0.2]
Introduction
This include will show you in console when a player is on pause mode or when a player resume the game after he went AFK. All of this, automatically, without commands like /afk; /sleep ...
The include detects the player after 6 seconds in Pause mode.

This include can detect:
- When a player is AFK.
- When a player is no longer AFK.


Screenshot:



New functions:
pawn Код:
public OnPlayerPause(playerid) //Called when the player is AFK
public OnPlayerUnpause(playerid) //Called when the player is back in game or left the game when is AFK.
IsPlayerPause(playerid) //Show the value 1(AFK) or 0('NON-AFK')
TimeSincePaused(playerid) //Show the current AFK time from a player when he's afk or when is no longer afk, shows last AFK time.
You can see the AFK players by using this command.
pawn Код:
CMD:afklist(playerid)
{
    new count,name[32],string[100];
    SendClientMessage(playerid,0x17A631FF,"________ AFK Players ________");
    foreach(Player, i) {
        if(IsPlayerPause(i)) {
            GetPlayerName(i,name,sizeof(name));
            format(string,sizeof(string),"%s [%d]",name,i);
            SendClientMessage(playerid,-1,string);
        }
    }
    return 1;
}

DOWNLOAD
- Pastebin
- GitHub

If you want me to add others specific features, post bellow.


Respuesta: AFK Auto-Detector[v0.1] - Swedky - 12.07.2014

Your include can be more optimized.


Re: AFK Auto-Detector[v0.1] - Mihaitza97 - 12.07.2014

I will try to do it in the next update. I wanted to highlight the idea of detection.

It's just 0.1 version.


Re: AFK Auto-Detector[v0.1] - friezakinght - 12.07.2014

Waiting for the next version, love this, I will +rep. Btw, I'm romanian too.


Re: AFK Auto-Detector[v0.1] - mathuusho - 12.07.2014

Nice idea!


Re: AFK Auto-Detector[v0.1] - SickAttack - 12.07.2014

2 seconds isn't enough. The player will get detected when the player isn't even paused, constantly. Note that the player also gets detected while moving and shooting as a passenger. I'll suggest that you increase the delay time, perhaps to 5-10 seconds.


Re: AFK Auto-Detector[v0.1] - Mihaitza97 - 12.07.2014

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
2 seconds isn't enough. The player will get detected when the player isn't even paused, constantly. Note that the player also gets detected while moving and shooting as a passenger. I'll suggest that you increase the delay time, perhaps to 5-10 seconds.
It's already 6+ seconds.


Re: AFK Auto-Detector[v0.1] - SickAttack - 12.07.2014

Quote:
Originally Posted by Mihaitza97
Посмотреть сообщение
It's already 6+ seconds.
I can see that, he didn't update the thread.
Anyway, use a bool for the variable that tells the server if a player is paused or not.


Re: AFK Auto-Detector[v0.1] - Mihaitza97 - 21.07.2014

Updated.

The messages will show automatically when functions OnPlayerPause or OnPlayerUnpause are called.


Re: AFK Auto-Detector[v0.1] - n0minal - 22.07.2014

Epic! I'll use this.