LastLogged -
Ugaustin - 17.06.2016
hi can someone help me, I want too see, last login so when the player logins to appear in dialog ... but dosent work..first time nothing appears, and second time it appears, and if server restarts nothing appears and after login it appears, I just want to see LastLogin in dialog at OnPlayerRequestClass
OnPlayerLogin:
PHP код:
new year, month, day, hour, minute, second;
getdate(year, month, day);
gettime(hour, minute, second);
format(PlayerInfo[playerid][pLastSeen], 20, "%02d.%02d.%d %02d:%02d", day, month, year, hour, minute);
new query[256];
format(query, sizeof(query), "UPDATE users SET LastLogged = '%s' WHERE Name = '%s'", PlayerInfo[playerid][pLastSeen], GetName(playerid));
mysql_tquery(mysql_db, query);
Re: LastLogged -
StaticYey - 17.06.2016
The piece you quoted above is showing how you saving the information to the database. I don't see anything that would cause an error.
Can you post how you retrieve the information from the database and feed the to the dialog?
Re: LastLogged -
Ugaustin - 17.06.2016
no error, but if I restart server in dialog Last Logged : nothing appears, but after if I log it appears, would it work if I select LastLogged from users??
Re: LastLogged -
Nin9r - 17.06.2016
Put that code in public OnGameModeExit().
Use a loop:
Код HTML:
foreach(Player, i)
{
new year, month, day, hour, minute, second;
getdate(year, month, day);
gettime(hour, minute, second);
format(PlayerInfo[i][pLastSeen], 20, "%02d.%02d.%d %02d:%02d", day, month, year, hour, minute);
new query[256];
format(query, sizeof(query), "UPDATE users SET LastLogged = '%s' WHERE Name = '%s'", PlayerInfo[i][pLastSeen], GetName(i));
mysql_tquery(mysql_db, query);
}
Re: LastLogged -
Ugaustin - 17.06.2016
but I need to select it at dialog..don't I??because in MySQL it gets saved only in dialog it dosent get saved ..
Re: LastLogged -
Ugaustin - 17.06.2016
I get this, in LastLogged in MySQL Panel..
17.06.2016 17:48
and if I start my server first time in dialog I get nothing .. only second time I get..
Re: LastLogged -
Stinged - 17.06.2016
It would be nice if you show where you show the dialog.
Re: LastLogged -
Ugaustin - 17.06.2016
OnPlayerRequestClass
PHP код:
if (gPlayerAccount[playerid] != 0)
{
new loginstring[256];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"%s You can now log on {FFFFFF}!\n\n {FFFFFF}Last login: %s",loginname,PlayerInfo[playerid][pLastSeen]);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD,"Log-in",loginstring,"Log-in","");
}
else
{
gPlayerAccount[playerid] = 0;
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
//------------------------------------------------------
//
format(regstring,sizeof(regstring),"You dont have an account",regname);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"Register",regstring,"Register","");
}
Re: LastLogged -
Stinged - 17.06.2016
If you're not loading the player's pLastSeen before he goes to that stage, of course it's not going to work.
You need to load it before showing the dialog.
Re: LastLogged -
Ugaustin - 17.06.2016
but cant I see, last time he logged in??