Ulysses

General => Off-Topic => Topic started by: imtiara on July 24, 2018, 06:44:58 AM

Title: Pause UTime timer for specific players
Post by: imtiara on July 24, 2018, 06:44:58 AM
Hiya! So i'm making a afk detection script that basicly tells the whole server that this user is now afk etc.
However, I would love to pause the utime counter for the afk player so they wont idle just to get more playtime on my server.
Is this possible in any way? Thanks!

-Tiara
Title: Re: Pause UTime timer for specific players
Post by: JamminR on July 24, 2018, 03:42:33 PM
No pause.
UTime, at least Megiddo's original version, and I presume every other "improved" one made after, uses oldtime + playerleft system time - playerjoined system time (https://github.com/TeamUlysses/utime/blob/1d41a3a41486e0d35a90c37ac30c7870d94b4784/lua/autorun/sh_utime.lua#L31).

There is no timer other than the computer clock.

(The currently only way) I imagine you could prevent idlers from being counted would be similiar to what UTime does now.
Keep a running cumulative variable of a players afk time during the session.
Then actually modify the sh_utime file function, likely the GetUTimeTotalTime to subtract totalidle of the player.
oldtime + playerleft system time - playerjoined system time - session_afk