Innactive players
#6

pawn Код:
new PlayaTick[MAX_PLAYERS], bool:PlayerAFK[MAX_PLAYERS char];

// OnGameModeInit
SetTimer("ScanPlayers",1000,true);

// OnPlayerConnect
PlayerAFK{playerid} = false;

// somewhere in GameMode
forward ScanPlayers();
public ScanPlayers()
{
    static string[40], name[MAX_PLAYER_NAME], Tick;
    Tick = GetTickCount();
    foreach(new i : Player)
    {
        if(((Tick - PlayaTick[i)) > 750))
        {
            if(!PlayerAFK{i})
            {
                PlayerAFK{i} = true;
                GetPlayerName(i,name,sizeof(name));
                format(string,sizeof(string),"%s is inactive",name);
                SendClientMessageToAll(-1,string);
            }
        }
        else
        {
            if(PlayerAFK{i})
            {
                PlayerAFK{i} = false; // player is back from AFK
            }
        }
    }
}

public OnPlayerUpdate(playerid)
{
    PlayaTick[playerid] = GetTickCount();
    return 1;
}
Reply


Messages In This Thread
Innactive players - by kalanerik99 - 25.06.2015, 20:52
Re: Innactive players - by Alex Magaсa - 25.06.2015, 20:58
Re: Innactive players - by kalanerik99 - 25.06.2015, 21:04
Re: Innactive players - by Jefff - 25.06.2015, 21:13
Re: Innactive players - by kalanerik99 - 25.06.2015, 21:33
Re: Innactive players - by Jefff - 25.06.2015, 22:01
Re: Innactive players - by kalanerik99 - 25.06.2015, 22:03
Re: Innactive players - by Jefff - 25.06.2015, 22:05
Re: Innactive players - by kalanerik99 - 25.06.2015, 22:08

Forum Jump:


Users browsing this thread: 2 Guest(s)