Posts: 3,934
Threads: 353
Joined: Jan 2010
Reputation:
0
Hello, I have two questions to ask.
1) How would I save the server's uptime since its last restart and show it within a command.
2) How would I save players last online time within mysql.
~ Thanks, Luis.
Posts: 3,793
Threads: 196
Joined: Jan 2010
Reputation:
0
Check out Eclipse, that gamemode has it in SQLite I suppose, a little converting and checking can help out
Posts: 3,934
Threads: 353
Joined: Jan 2010
Reputation:
0
I'll give it a go, thanks Lorenc.
Posts: 1,498
Threads: 19
Joined: Jun 2009
Reputation:
0
1) Save a unix time stamp in OnGameModeInit in a variable and then to get the uptime just get the current timestamp and subtract the startup timestamp from it, and you'll get the uptime in seconds (give or take 1 or 2 seconds).
2) Just create a MySQL query that saves their time when they logout on OnPlayerDisconnect using, again - best way a unix timestamp, since it is easy to convert it into different time formats.
Posts: 3,934
Threads: 353
Joined: Jan 2010
Reputation:
0
Thanks iLinx but I am wondering how I use unix timestamps, I have never used them before.
Posts: 631
Threads: 58
Joined: Jun 2010
Reputation:
0
A unix timestamp is the seconds from January 1970 i believe, so it's basically like a stopwatch, that hasn't stopped.
Posts: 6,129
Threads: 36
Joined: Jan 2009
https://sampforum.blast.hk/showthread.php?tid=254915
A tutorial I made
specifically to explain unix timestamps, not hard to find.