Whats wrong with Afk Check?
#10

Quote:
Originally Posted by ue_falconx
Посмотреть сообщение
Come on admingo why are you even using Pvars when you can do with simple method

pawn Код:
forward Checking();

forward OnPlayerPause(playerid);
 
new iAFKp[MAX_PLAYERS];
 
public OnFilterScriptInit() // or game mode init
{
        SetTimer("Checking", 1000, true);
        return 1;
}

public Checking()
{
    for(new x = 0; x < MAX_PLAYERS; x++)
    {
        iAFKp[x]++;
        if(iAFKp[x] > 3)
        {
                        OnPlayerPause(x);
        }
    }
}
 

public OnPlayerPause(playerid)
{
        new tmpstring[128];
        format(tmpstring, sizeof(tmpstring), "PAUSED for %d seconds", iAFKp[playerid]);
        SetPlayerChatBubble(playerid, tmpstring, COLOR, 10.0, 1000);
        return 1;
}

public OnPlayerUpdate(playerid) // to check if he is paused, onplayerupdate stops if a player press ESC so it's best to do this way
{
        iAFKp[playerid] = 0;
        return 1;
}
I dont want to know how much seconds a player is paused. I want to have a paused label above his head and when he is back in game it will be removed.
Reply


Messages In This Thread
Whats wrong with Afk Check? - by Admigo - 14.04.2012, 18:48
Re: Whats wrong with Afk Check? - by mineralo - 14.04.2012, 19:02
Re: Whats wrong with Afk Check? - by Admigo - 14.04.2012, 19:12
Re: Whats wrong with Afk Check? - by Cypress - 14.04.2012, 19:22
Re: Whats wrong with Afk Check? - by Admigo - 14.04.2012, 23:10
Re: Whats wrong with Afk Check? - by MP2 - 14.04.2012, 23:16
Re: Whats wrong with Afk Check? - by FalconX - 14.04.2012, 23:30
Re: Whats wrong with Afk Check? - by MP2 - 14.04.2012, 23:34
Re: Whats wrong with Afk Check? - by FalconX - 14.04.2012, 23:37
Re: Whats wrong with Afk Check? - by Admigo - 15.04.2012, 06:49

Forum Jump:


Users browsing this thread: 1 Guest(s)