how make date and time for last login time for user - 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: how make date and time for last login time for user (
/showthread.php?tid=519976)
how make date and time for last login time for user -
kinggta - 16.06.2014
hi all,
I need help for make a msg box for player ,when they login show they last login time and date.
sorry for my bad english.
Re: how make date and time for last login time for user -
kamiliuxliuxliux - 16.06.2014
Which database do you use?
Re: how make date and time for last login time for user -
Jack_Leslie - 17.06.2014
Refer to:
https://sampwiki.blast.hk/wiki/Getdate
https://sampwiki.blast.hk/wiki/Gettime
If you want us to make the code for you, we need to know what file system you\'re using. How ever for an example, it would all look something like this:
pawn Code:
enum pData {
LastLoginD,
LastLoginM,
LastLoginY,
LastLoginH,
LastLoginM,
LastLoginS
}
new PlayerData[MAX_PLAYERS][pData];
public OnPlayerDisconnect(playerid, reason)
{
new day,year,month,hour,minute,second;
getdate(year,month,day);
gettime(hour,minute,second);
PlayerData[playerid][LastLoginD] = day;
PlayerData[playerid][LastLoginM] = month;
PlayerData[playerid][LastLoginY] = year;
PlayerData[playerid][LastLoginH] = hour;
PlayerData[playerid][LastLoginM] = minute;
PlayerData[playerid][LastLoginS] = second;
return 1;
}
Re: how make date and time for last login time for user -
Snipa - 17.06.2014
Use gettime() with no parameters to get the unix timestamp, store it in your database, and convert it to a date when you need it.