SA-MP Forums Archive
[HELP] last activity - 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: [HELP] last activity (/showthread.php?tid=504223)



[HELP] last activity - Luca12 - 02.04.2014

Hello how can I make on onplayerdisconnect when player leave a server then in his acc is written the date when he was last on server if you know what I mean? Thanks


Re: [HELP] last activity - Luca12 - 02.04.2014

mysql I try with set as string int and date but nothing it not works


Re: [HELP] last activity - AhmedMohamed - 02.04.2014

you can save the date on the player file " Playername.ini " and onplayerconnect get the date, and it's done.
you can save it with:
1-Dini: http://dracoblue.net/download/dini-16/35/
2-Dutils: http://dracoblue.net/download/dutils-110/30/
3-dudb: http://dracoblue.net/download/dudb-24/31/
4-Double-O-File: http://www.2shared.com/file/WknuA7r2...e-O-Files.html
-------------------------------------------
OH ok wasn't read


Re: [HELP] last activity - zT KiNgKoNg - 02.04.2014

If its a INT it will not work with a string.


Re: [HELP] last activity - Luca12 - 02.04.2014

I also have that but I use string for dates and it give me something.0 993942394 instead 2/4/2014 that is problem aand I don't know what cause that


Re: [HELP] last activity - EiresJason - 02.04.2014

Is the variable storing the date declared as a INT or a VARCHAR in the SQL database?

This is the main thing i can see wrong, I haven't worked with MySQL before.


Re: [HELP] last activity - Luca12 - 02.04.2014

I also was try with int and nothing know it's stored as varchar I tryed also with date but nothing


Re: [HELP] last activity - EiresJason - 02.04.2014

Post the code where you try to save it correctly in the OnPlayerDisconnect callback so someone might see what's wrong.

Not sure if I will be able to help but someone else will hopefully reply.


Re: [HELP] last activity - Luca12 - 02.04.2014

first is this

pawn Код:
new string[128],day,month,year;
    getdate(day,month,year);
    format(string,sizeof(string),"%d/%d/%d",day,month,year);
and here is saving

pawn Код:
mysql_format(mysql,query,sizeof(query),"UPDATE `users` SET `LastActivity` = %s WHERE WHERE `ID` = '%d'",
and heere I try set string beacuse from string is getting date and I try this PlayerInfo[playerid][LastActivity],PlayerInfo[playerid][ID]

and in database it give me this when I disconnect from server

251.750000000000000000 instead of

2/4/2014



Re: [HELP] last activity - EiresJason - 02.04.2014

Try this.
pawn Код:
mysql_format(mysql,query,sizeof(query),"UPDATE `users` SET `LastActivity` = '%s' WHERE WHERE `ID` = '%d'",PlayerInfo[playerid][LastActivity],PlayerInfo[playerid][ID]);