SA-MP Forums Archive
Last time when player was online - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Last time when player was online (/showthread.php?tid=449204)



Last time when player was online - Luca12 - 07.07.2013

How can I make when a type some command then print my a last date when player was online if you know what I mean. Thanks


Re: Last time when player was online - GiamPy. - 07.07.2013

gettime() returns the UNIX timestamp.
Use it when disconnecting, save it somewhere and use an include to convert the UNIX timestamp to a human-readable date.


Re: Last time when player was online - Luca12 - 07.07.2013

more details


Re: Last time when player was online - GiamPy. - 07.07.2013

..?

pawn Код:
public OnPlayerDisconnect(playerid)
{
    // Then save this variable somewhere in your user system file, most likely in the user's file.
    new disconnect = gettime();
    return 1;
}
Use this for UNIX to timestamp: https://sampforum.blast.hk/showthread.php?tid=254915


Re: Last time when player was online - JJB562 - 07.07.2013

There's no need for an include as long as you don't want to know the time. If you just need the date, all you need to do is:

pawn Код:
new year, month, day;
getdate(year, month, day);
Then save those values in your player's saving system.

Then after a player logs in do something like this:
pawn Код:
new string[64];
format(string, sizeof(string), "You last logged in on: %i/%i/%i", month, day, year); // Change month, day, and year to the variables you saved the values to.
SendClientMessage(playerid, -1, string);



Re: Last time when player was online - Luca12 - 07.07.2013

I don't understand I have player vaariable lastlogged in yini file

LastLogged = 24/7/2014 that is example how i want that if you know what I mean