afk system
#5

pawn Код:
new Float:AFKPos[MAX_PLAYERS][3], AFK[MAX_PLAYERS]; // At the top of your script.

public OnPlayerConnect(playerid)
{
    AFK[playerid] = 0;
    SetTimerEx("AFKCheck", 1000, true, "i", playerid);
    return 1;
}

forward AFKCheck(playerid);
public AFKCheck(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, 2.0, AFKPos[playerid][0], AFKPos[playerid][1], AFKPos[playerid][2])) AFK[playerid]++;
    if(AFK[playerid] >= 60)
    {
        new string[65];
        format(string, sizeof(string), "%s Nejudejo minute ir gavo jobana kicka.", GetPlayerNameEx(playerid));
        SendClientMessage(playerid, GREEN, string);
        //SendClientMessageToAll(COLOR_WHITE, string);
        ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "AFK", "TESTINAMSUKOS", "Aљ gryћau", "Atљaukti");
        //Kick(playerid); // Note that if you want to be able to see messages, use a delayed kick.
        AFK[playerid] = 0;
        return 1;
    }
    GetPlayerPos(playerid, AFKPos[playerid][0], AFKPos[playerid][1], AFKPos[playerid][2]);
    return 1;
}
This is for a 'position' afk system.
Reply


Messages In This Thread
afk system - by Karolukas123 - 05.07.2015, 21:12
Re: afk system - by nmader - 05.07.2015, 21:42
Re: afk system - by Karolukas123 - 05.07.2015, 21:43
Re: afk system - by Karolukas123 - 05.07.2015, 22:18
Re: afk system - by Threshold - 06.07.2015, 05:51

Forum Jump:


Users browsing this thread: 1 Guest(s)