Checking time a player is online
#2

make a timer without parameters with an interval of 1 second and run it, and then increase a value that will count as the seconds. this way you can determine how many seconds each player has been online during their session.

pawn Код:
#include a_samp
public OnGameModeInit()
{
    SetTimer("CountPlayersTime", 1000, true);
    return;
}

forward CountPlayersTime();
public CountPlayersTime()
{
    foreach(Player, i)
    {
        SetPVarInt(i, "OnlineSeconds", GetPVarInt(playerid, "OnlineSeconds"));
        if(GetPVarInt(i, "OnlineSeconds") == 3600*2) // 3600 secs = 1 hour
        {
            Kick(i);
        }
    }
    return;
}
CMD:myonlinetime(playerid,params[])
{
    new output[32];
    format(output, sizeof (output), "%d seconds online", GetPVarInt(playerid, "OnlineSeconds"));
    SendClientMessage(playerid, -1, output);
    return 1;
}
Reply


Messages In This Thread
Checking time a player is online - by Glint - 29.08.2012, 07:54
Respuesta: Checking time a player is online - by admantis - 29.08.2012, 07:57
Re: Checking time a player is online - by Glint - 29.08.2012, 08:02
Re: Checking time a player is online - by clarencecuzz - 29.08.2012, 08:10
Re: Checking time a player is online - by Glint - 29.08.2012, 08:12
Re: Checking time a player is online - by iggy1 - 29.08.2012, 08:18

Forum Jump:


Users browsing this thread: 1 Guest(s)