• Print

Author Topic: Utime -- Show how long your players have been connected this session and total  (Read 725654 times)

0 Members and 1 Guest are viewing this topic.

Offline monkeymacman

  • Newbie
  • *
  • Posts: 44
  • Karma: 13
Hi, I use this for my murder server... Is there a permission or setting that I can set that it removes it from certain players being able to view it? I know utime_enable 0 but I want the players not able to use that command.

Thanks

M21z
I'm sure there's a better way but what you can do is: In addons/utime/lua/autorun go to cl_utime.lua in the first section of code look for this chunk of code, it is in the think() function
Code: Lua
  1. if not utime_enable:GetBool() or not IsValid( LocalPlayer() ) or
  2.          (IsValid( LocalPlayer():GetActiveWeapon() ) and LocalPlayer():GetActiveWeapon():GetClass() == "gmod_camera") then
  3.       gpanel:SetVisible( false )
  4.    else
  5.       gpanel:SetVisible( true )
  6.    end
  7.  
You should be able to simply change the part that says gpanel:SetVisible( true ) to gpanel:SetVisible( false ) . After doing so no matter if the player has utime_enable 1 or Utime_enable 0 the box should not show. This is useful if you want to make alternative methods of checking times, because in some gamemodes it just looks bad, or it ruins a part of the gamemode (like looking at somebody with a disguiser on ttt)
« Last Edit: November 26, 2015, 05:20:37 am by monkeymacman »

Offline M21z

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
There's no configurable way to do that at the moment. Are you trying to set it up for admins only?

If possible, yes.

Offline M21z

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
I'm sure there's a better way but what you can do is: In addons/utime/lua/autorun go to cl_utime.lua in the first section of code look for this chunk of code, it is in the think() function
Code: Lua
  1. if not utime_enable:GetBool() or not IsValid( LocalPlayer() ) or
  2.          (IsValid( LocalPlayer():GetActiveWeapon() ) and LocalPlayer():GetActiveWeapon():GetClass() == "gmod_camera") then
  3.       gpanel:SetVisible( false )
  4.    else
  5.       gpanel:SetVisible( true )
  6.    end
  7.  
You should be able to simply change the part that says gpanel:SetVisible( true ) to gpanel:SetVisible( false ) . After doing so no matter if the player has utime_enable 1 or Utime_enable 0 the box should not show. This is useful if you want to make alternative methods of checking times, because in some gamemodes it just looks bad, or it ruins a part of the gamemode (like looking at somebody with a disguiser on ttt)

I'm sure there's a better way but what you can do is: In addons/utime/lua/autorun go to cl_utime.lua in the first section of code look for this chunk of code, it is in the think() function
Code: Lua
  1. if not utime_enable:GetBool() or not IsValid( LocalPlayer() ) or
  2.          (IsValid( LocalPlayer():GetActiveWeapon() ) and LocalPlayer():GetActiveWeapon():GetClass() == "gmod_camera") then
  3.       gpanel:SetVisible( false )
  4.    else
  5.       gpanel:SetVisible( true )
  6.    end
  7.  
You should be able to simply change the part that says gpanel:SetVisible( true ) to gpanel:SetVisible( false ) . After doing so no matter if the player has utime_enable 1 or Utime_enable 0 the box should not show. This is useful if you want to make alternative methods of checking times, because in some gamemodes it just looks bad, or it ruins a part of the gamemode (like looking at somebody with a disguiser on ttt)

Is there a way to only allow it in other gamemodes but not in murder and/or TTT?


I really need to learn lua coding :P
« Last Edit: November 28, 2015, 02:00:05 am by M21z »

Offline pieman88

  • Newbie
  • *
  • Posts: 10
  • Karma: 1
Apologies for such a large bump, but is there an easy way to get a player's playtime?

Edit: I suppose I should say it has to be clientside.
« Last Edit: January 13, 2016, 12:46:11 pm by pieman88 »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Yes. Look at the shared file for the function name.
Experiencing God's grace one day at a time.

Offline Ciank33

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Is this incompatible with pointshop2?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
No
Experiencing God's grace one day at a time.

Offline TT=open again Isabella Jazzlyn

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
how to fix this

addons/utime/lua/autorun/cl_utime.lua:310: attempt to index local 'cpanel' (a nil value)
  1. buildCP - addons/utime/lua/autorun/cl_utime.lua:310
   2. resetCvars - addons/utime/lua/autorun/cl_utime.lua:305
    3. fn - addons/utime/lua/autorun/cl_utime.lua:334



Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
how to fix this

addons/utime/lua/autorun/cl_utime.lua:310: attempt to index local 'cpanel' (a nil value)
  1. buildCP - addons/utime/lua/autorun/cl_utime.lua:310
   2. resetCvars - addons/utime/lua/autorun/cl_utime.lua:305
    3. fn - addons/utime/lua/autorun/cl_utime.lua:334




We've never been able to figure out why some users get that error occasionally, but it's harmless.
Experiencing God's grace one day at a time.

Offline Canne

  • Newbie
  • *
  • Posts: 41
  • Karma: -9
We've never been able to figure out why some users get that error occasionally, but it's harmless.
Heey can i get some help? when i restart my server the Utime resets total time etc...... whats the point of it if resets when i restart my server?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Sounds like you may have some permission problems with your server database. The times are saved to sv.db in the garry's mod root. Make sure that the file is writable.
Experiencing God's grace one day at a time.

Offline Canne

  • Newbie
  • *
  • Posts: 41
  • Karma: -9
Sounds like you may have some permission problems with your server database. The times are saved to sv.db in the garry's mod root. Make sure that the file is writable.
I put the folder of the Utim in my addons that's it anything else i need to do?

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
anything else i need to do?
Canne, please read Megiddo's precise instructions. He doesn't use many words, but when he does, they are important.
permission problems with your server database. The times are saved to sv.db in the garry's mod root. Make sure that the file is writable.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Canne

  • Newbie
  • *
  • Posts: 41
  • Karma: -9
Canne, please read Megiddo's precise instructions. He doesn't use many words, but when he does, they are important.
The reason why i ask what to do is because i have idea what you meaning by that..... what i need to do? i put the folder in the addons folder everytime i restart my server it resets the timers.... what i need to do else? what do u mean by " Make sure that the file is writable. " how to get it writable it's in my addons folder what i need to do more? please explain in details i go to my host go to addons than what i put it there aand after that wat i need to do else? screenshot: http://puu.sh/mDo1t/3c7ae7864e.png
« Last Edit: January 20, 2016, 03:00:29 pm by Canne »

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
The reason why i ask what to do is because i have idea what you meaning by that..... what i need to do? i put the folder in the addons folder everytime i restart my server it resets the timers.... what i need to do else? what do u mean by " Make sure that the file is writable. " how to get it writable it's in my addons folder what i need to do more? please explain in details i go to my host go to addons than what i put it there aand after that wat i need to do else?
Contact your hosting provider if you're having trouble making the file sv.db in the root directory of your server writeable. It's your best bet, from what I can tell.
bw81@ulysses-forums ~ % whoami
Homepage

  • Print