View Single Post
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 02-05-2022 , 14:00   Re: Time played ( First seen & Last seen )
Reply With Quote #6

Quote:
Originally Posted by bigdaddy424 View Post
Isn't this better that a looping task?
You got end var as current timeframe in seconds
Code:
public client_putinserver(){     new start = get_systime() } public client_disconnected(){     new end = get_systime() // this will read time when the user get disconnected     end -= start // so i need to return the time played when user disconnected but if is it the first time for the user it will be like this 0 -= join time and i think you know what this mean }
You missed something read this again:
Quote:
I see this way is better than saves get_user_time so if i used that way it gonna be like this g_iPlayer[ id ][ Time_Played ] += get_user_time( id ) / 60 and i need to use this way everytime when return it
But using task for check the time every second when connected to the server is faster and better
Edit: There are some ways to get time played of the player
  1. This way: g_iPlayer[ id ][ Time_Played ] += get_user_time( id ) / 60
  2. The way that i used
  3. Your way, but you have an issue in your code it shuld be ( start -= end ) because if this is the first time player has connected to the server and tryed to check his time played will be like 0 -= start and this mean - num also with this way i gonna use get_systime() four times and this is not faster
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 02-05-2022 at 15:32.
Supremache is offline