how make date and time for last login time for user
#1

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.
Reply
#2

Which database do you use?
Reply
#3

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;
}
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)