Afk detect
#1

Guys i always request a good way to detect afk people but you guys only give me an idea to check pos
I have made the position thing before you guys tell me and i am not asking for that,i am asking for a system that detects afk automatic,or whats the system that SAMP used to detect the afk and put an icon on his head automaticly ....
Because i have seen a server doing the same thing,a timer appears at the same time when the samp icon appears,abovr the players head...HOW??
Reply
#2

OnPlayerUpdate is not calling while player is paused, it is being called whenever player updates server with his status (Pos,Weapon,Skin etc.)
So you can do this:

pawn Код:
#define MAX_AFK_MINUTES 10

public OnPlayerUpdate(playerid)
{
    SetPVarInt(playerid, "AFK", 0);
    SetPVarInt(playerid, "AFKMinutes", 0);
    return 1;
}

forward AddAfk();
public AddAfk()
{
    foreach(Player, playerid)
    {
        SetPVarInt(playerid, "AFK", 1);
        SetPVarInt(playerid, "AFKMinutes", GetPVarInt(playerid, "AFKMinutes")+1);
        if(GetPVarInt(playerid, "AFKMinutes") > MAX_AFK_MINUTES)
        {
            Kick(playerid);
        }
    }
    return 1;
}

public OnGameModeInit()
{
    SetTimer("AddAfk", 1000*60, true);
    return 1;
}
P.S. sorry I don't have any other idea. xD
Reply
#3

i am looking for another system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)