Afk detect
#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


Messages In This Thread
Afk detect - by iBots - 15.01.2014, 20:02
Re: Afk detect - by erminpr0 - 15.01.2014, 20:09
Re: Afk detect - by iBots - 16.01.2014, 13:55

Forum Jump:


Users browsing this thread: 1 Guest(s)