Online time bugged in /stats
#5

This can be done without even a timer.

When a player logins, use GetTickCount and store it in a temporary variable.
When a player disconnects, use GetTickCount again minus the variable you used before.

You've got the milliseconds of the online time for the player. That can be easily converted to seconds/minutes/hours. The last step is to add the previous results (those you loaded on login) with the converted results and you get the sum of the online time.

If you want to display the current online time, then follow: "use GetTickCount again minus the variable you used before." and there you go!
Reply


Messages In This Thread
Online time bugged in /stats - by stormchaser206 - 24.09.2013, 16:50
Re: Online time bugged in /stats - by Finn - 24.09.2013, 17:05
Re: Online time bugged in /stats - by stormchaser206 - 24.09.2013, 17:12
Re: Online time bugged in /stats - by Champ - 24.09.2013, 17:42
Re: Online time bugged in /stats - by Konstantinos - 24.09.2013, 17:56
Re: Online time bugged in /stats - by stormchaser206 - 24.09.2013, 18:45
Re: Online time bugged in /stats - by stormchaser206 - 24.09.2013, 21:01
Re: Online time bugged in /stats - by stormchaser206 - 25.09.2013, 20:56

Forum Jump:


Users browsing this thread: 1 Guest(s)