Inactive time
#3

This can be done using Unix Timestamps. Store the time they last logged off, and when you need to get it, fetch that variable, and then subtract the stored timestamp from the current timestamp.

Then convert the milliseconds to weeks, days, etc, formats.

Example:
pawn Код:
CMD:lastlogged(playerid, params[])
{
    new string[75];
    new tmp = LastLogged[playerid] - gettime();
    tmp = tmp/1000;
    format(string, sizeof(string), "Last online: %d seconds ago", tmp);
    SendClientMessage(playerid, -1, string);
    return 1;
}
Reply


Messages In This Thread
Removed - by MasonSFW - 16.11.2014, 00:19
Re: Inactive time - by ZenBish - 16.11.2014, 00:38
Re: Inactive time - by Abagail - 16.11.2014, 00:47
Re: Inactive time - by Threshold - 16.11.2014, 01:04
Re: Inactive time - by MasonSFW - 16.11.2014, 01:23

Forum Jump:


Users browsing this thread: 1 Guest(s)