ULX

Author Topic: Pause UTime timer for specific players  (Read 2875 times)

0 Members and 1 Guest are viewing this topic.

Offline imtiara

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Pause UTime timer for specific players
« 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

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Pause UTime timer for specific players
« Reply #1 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.

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

« Last Edit: July 24, 2018, 03:46:06 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming