LastLogged
#1

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 yearmonthdayhourminutesecond;
                    
getdate(yearmonthday);
                    
gettime(hourminutesecond);
                    
format(PlayerInfo[playerid][pLastSeen], 20"%02d.%02d.%d %02d:%02d"daymonthyearhourminute);
                    new 
query[256];
                    
format(querysizeof(query), "UPDATE users SET LastLogged = '%s' WHERE Name = '%s'"PlayerInfo[playerid][pLastSeen], GetName(playerid));
                    
mysql_tquery(mysql_dbquery); 
Reply
#2

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?
Reply
#3

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??
Reply
#4

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

but I need to select it at dialog..don't I??because in MySQL it gets saved only in dialog it dosent get saved ..
Reply
#6

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

It would be nice if you show where you show the dialog.
Reply
#8

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","");
                    } 
Reply
#9

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

but cant I see, last time he logged in??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)