idle kicker
#4

pawn Код:
new bool:Afk[MAX_PLAYERS];
new AfkTimer[MAX_PLAYERS];
new Float:LastPos[MAX_PLAYERS][3];

forward SetPlayerAfk(playerid);

public OnPlayerConnect(playerid)
{
    Afk[playerid] = false;
    AfkTimer[playerid] = SetTimerEx("SetPlayerAfk",10000,1,"d",playerid);//10 seconds?
}

public OnPlayerDisconnect(playerid,reason)
{
    KillTimer(AFKTimer[playerid]);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    GetPlayerPos(playerid,LastPos[playerid][0],LastPos[playerid][1],LastPos[playerid][2]);
    return 1;
}

public SetPlayerAfk(playerid)
{
    new Float:Pos[3];
    GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
    if(Pos[0] == LastPos[playerid][0] && Pos[1] == LastPos[playerid][1] && Pos[2] == LastPos[playerid][2])
    {
        SendClientMessage(playerid, 0xFFFFFF, "You are AFK.");
        Afk[playerid] = true;
    }
    else
    {
        Pos[0] = LastPos[playerid][0];
        Pos[1] = LastPos[playerid][1];
        Pos[2] = LastPos[playerid][2];
    }
    return 1;
}
Reply


Messages In This Thread
idle kicker - by xDeadlyBoy - 16.08.2011, 15:03
Re: idle kicker - by =WoR=Varth - 16.08.2011, 15:06
Re: idle kicker - by xDeadlyBoy - 16.08.2011, 15:17
Re: idle kicker - by =WoR=Varth - 16.08.2011, 15:26
Re: idle kicker - by xDeadlyBoy - 16.08.2011, 15:36
Re: idle kicker - by =WoR=Varth - 16.08.2011, 15:43
Re: idle kicker - by xDeadlyBoy - 16.08.2011, 15:47
Re: idle kicker - by =WoR=Varth - 16.08.2011, 15:55
Re: idle kicker - by xDeadlyBoy - 16.08.2011, 16:05
Re: idle kicker - by =WoR=Varth - 16.08.2011, 16:14

Forum Jump:


Users browsing this thread: 1 Guest(s)