AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get playing time from server (https://forums.alliedmods.net/showthread.php?t=244465)

GuskiS 07-18-2014 15:45

Get playing time from server
 
1 Attachment(s)
How can I get played time from server itself? Look at picture.
Server somehow/somewhere saves that, so it don't change after mapchange. How to retrieve it?

fysiks 07-18-2014 15:47

Re: Get playing time from server
 
Have you tried get_user_time()? I can't remember if that is limited to the time playing the map or the time playing on the server.

GuskiS 07-18-2014 15:59

Re: Get playing time from server
 
I read in a thread that said it was only getting time from connect to disconnect. So, reseting after map change.

Backstabnoob 07-19-2014 06:29

Re: Get playing time from server
 
Disconnect doesn't necessarily happen on mapchange, FM_ClientDisconnect doesn't catch it. At least try it please

vlad_slick 07-19-2014 17:29

Re: Get playing time from server
 
get_user_time doesn't return the full time (it's reset by reconnects or on mapchange).

The time in your screenshot is calculated (and stored) by the steam libraries (steamclient.so/steamclient.dll) in servers without dproto.
You shouldn't try to get it from the server because it's much harder than just calculating it yourself with a plugin.


But .... if you really want to get it from the server you could do it with orpheu. The way I came up with is by getting the address of the client_t structure and substracting the connect_time member from the last_received member from the netchan_t struct of each client. But as you can see it's overkill and I don't recommend it, unless you have specific reasons to do so.


All times are GMT -4. The time now is 12:55.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.