afk system
#1

why his not working if i stand in game 1min and not move ??

}
forward AFKCheck();
public AFKCheck()
{
new Float:Pos[3], string[50];
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i,Pos[0],Pos[1],Pos[2]);
if(IsPlayerInRangeOfPoint(i,2,Pos[0],Pos[1],Pos[2]))
{
AFK[i]++;
}
if(AFK[i] == 60)
{
AFK[i] = 0;
format(string,sizeof(string),"%s Nejudėjo minute ir gavo jobana kicką.",GetPlayerNameEx(i));
SendClientMessage(i, GREEN, string);
//SendClientMessageToAll(COLOR_WHITE,string);
ShowPlayerDialog(i, 9999,DIALOG_STYLE_MSGBOX,"AFK","TESTINAMSUKOS","Aљ gryћau","Atљaukti");
//Kick(i);
}
}
return 1;

SetTimer("AFKCheck",1000, true);
Reply
#2

Where do you have this line placed?:
pawn Код:
SetTimer("AFKCheck", 1000, true);
Reply
#3

Quote:
Originally Posted by nmader
Посмотреть сообщение
Where do you have this line placed?:
pawn Код:
SetTimer("AFKCheck", 1000, true);
public OnGameModeInit()
Reply
#4

up, i need help
Reply
#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


Forum Jump:


Users browsing this thread: 2 Guest(s)