Saving current time of a timer (y_timers)
#3

You could use a unix timestamp for this.

When a player logs in:

pawn Код:
SetPVarInt(playerid, "LoginTime", gettime());
When the player leaves:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new how_long_he_played = (gettime()-GetPVarInt(playerid, "LoginTime"))/60;
    // This will return the amount of time in minutes the player was online.
    printf("Player was online for %d minutes", how_long_he_played);
}
Reply


Messages In This Thread
Saving current time of a timer (y_timers) - by Schocc - 14.03.2014, 19:12
Re: Saving current time of a timer (y_timers) - by Schocc - 16.03.2014, 21:26
Re: Saving current time of a timer (y_timers) - by Jakku - 16.03.2014, 21:42
Re: Saving current time of a timer (y_timers) - by Schocc - 16.03.2014, 21:49

Forum Jump:


Users browsing this thread: 1 Guest(s)