Looking for a Timespent mod/addon

Hello guys,

I help host a Garrysmod TTT server and we are going to be holding a contest sometime in the future but for it we need a timespent mod that works with gmod13 and TTT. I found a few on Garrysmod.org, like this one but it’s just too clunky and I don’t think it would work with TTT. I am pretty much just looking for a server total time played counter that won’t get in the way of TTT’s stuff.

Do you guys know of any other ones that might be good? If not, I guess the next step would be for me to get one made instead.

If you use ULX, uTime will be a great addition to your server.

I do use ulx and that one does look great, I’ll try it out later on and get back to you guys if it works!

If you are going to use utime the box fits the best for TTT at x= 20 y= 4.

Is there any way to do that in the code(unless that is for it) instead of clientside?

Yes, the code is really easy to edit for your liking. Including colors.

To change the position all you’d have to change is this, right?

[lua]gpanel:SetPos( (ScrW() - gpanel:GetWide()) * utime_pos_x:GetFloat() / 100, (ScrH() - gpanel.Large) * utime_pos_y:GetFloat() / 100 ) [/lua]

Just change line 23, 24 and 303, 304 in cl_utime.lua. So easy to manage. xD

And the client side player can change hes location with the utime_pos_x and utime_pos_y as well.

[lua]
local utime_pos_x = CreateClientConVar( “utime_pos_x”, “20.0”, true, false )
local utime_pos_y = CreateClientConVar( “utime_pos_y”, “4.0”, true, false )
[/lua]

[lua]
RunConsoleCommand( “utime_pos_x”, “20” )
RunConsoleCommand( “utime_pos_y”, “4” )
[/lua]
The lines 303 and 304 is where the box goes if utime_reset is used.

Alright, thanks for the help and information!

I will fool with the code later on and see how everything works, but you really saved me some time with the positioning.

**Edit: **Is there a way to force the utime_reset for everyone? Cause it was in the wrong position and that’s the only way it will move for the people who already joined before the changes, even when updating those variable above.

Don’t know, just been ignoring that problem after the re-positioning i have done. :stuck_out_tongue:
Just ask them to do it i guess.

Yeah, I forced them with ulx, problem is it creates script errors and disconnects them for lua errors which can get pretty annoying.

Will deleting the database file reset it easily?

What errors?

I get this error when using the command:


] utime_reset
Warning: vgui.Create failed to create the VGUI component (ControlPanel)

Trace: 
    1: Line 32    "Trace"    lua/includes/extensions/debug.lua
    2: Line 13    "Get"    lua/includes/modules/controlpanel.lua
    3: Line 305    "nil"    addons/utime/lua/autorun/cl_utime.lua
    4: Line 69    "nil"    lua/includes/modules/concommand.lua


controlpanel.Get() - Error creating a ControlPanel!
You're calling this function too early! Call it in a hook!

[ERROR] 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. unknown - addons/utime/lua/autorun/cl_utime.lua:305
    3. unknown - lua/includes/modules/concommand.lua:69

Disconnect: "Too many Lua Errors! Sorry!".
Disconnect: "Too many Lua Errors! Sorry!".



I don’t really see that command as a problem(might be stopping it from resetting as some people are getting lua errors on connect, but can join again) when used as they can just rejoin and it works as intended, except for being dropped from the server but I just need an easy method to reset it for all clients when they join. I’m wondering if deleting the sv(database) file will reset all config or is there also a client version of the file made too? **Edit: **​Nope, just resets the time, not the positioning.

Also, I edited the code for my own positioning and my players are mentioning it is covering the preparing timer(due to resolution differences when I set it to be a little beside it. How do you counter this?

Example:
Mine:
http://cloud-2.steampowered.com/ugc/1119412561814368440/F012A5E6E60F812E6F59CDC6FC821C96A72AC7C5/ [/t]
His: [t] http://cloud.steampowered.com/ugc/1119412561814346767/50CE8357A867D592C3C43087F60928432CEA363C/

Sorry for asking so many questions by the way…

It tries to create a control panel for the Q menu. It’s removed in TTT so you will have to remove line 309 - 320.
[lua]
function buildCP( cpanel )
cpanel:ClearControls()
cpanel:AddControl( “Header”, { Text = “UTime by Megiddo (Team Ulysses)” } )
cpanel:AddControl( “Checkbox”, { Label = “Enable”, Command = “utime_enable” } )
cpanel:AddControl( “Slider”, { Label = “Position X”, Command = “utime_pos_x”, Type = “Float”, Min = “0”, Max = “100” } )
cpanel:AddControl( “Slider”, { Label = “Position Y”, Command = “utime_pos_y”, Type = “Float”, Min = “0”, Max = “100” } )
cpanel:AddControl( “Color”, { Label = “Outside Color”, Red = “utime_outsidecolor_r”, Green = “utime_outsidecolor_g”, Blue = “utime_outsidecolor_b”, ShowAlpha = “0”, ShowHSV = “1”, ShowRGB = “1”, Multiplier = “255” } )
cpanel:AddControl( “Color”, { Label = “Outside Text Color”, Red = “utime_outsidetext_r”, Green = “utime_outsidetext_g”, Blue = “utime_outsidetext_b”, ShowAlpha = “0”, ShowHSV = “1”, ShowRGB = “1”, Multiplier = “255” } )
cpanel:AddControl( “Color”, { Label = “Inside Color”, Red = “utime_insidecolor_r”, Green = “utime_insidecolor_g”, Blue = “utime_insidecolor_b”, ShowAlpha = “0”, ShowHSV = “1”, ShowRGB = “1”, Multiplier = “255” } )
cpanel:AddControl( “Color”, { Label = “Inside Text Color”, Red = “utime_insidetext_r”, Green = “utime_insidetext_g”, Blue = “utime_insidetext_b”, ShowAlpha = “0”, ShowHSV = “1”, ShowRGB = “1”, Multiplier = “255” } )
cpanel:AddControl( “Button”, { Text = “Reset”, Label = “Reset colors and position”, Command = “utime_reset” } )
end
[/lua]
In cl_utime.lua

Oh I see thanks!

Also, is there any way to counter the resolution differences for the utime box? The images I posted above show an example of what was happening and I can’t figure out how to counter it.

Don’t know. Never experienced that problem.

I was wondering if anyone could possibly provide me with a guide on how to make custom chat commands that allow me to call a console command like “utime_enable 1” and “utime_enable 0” with chat commands(which makes it so that the player can easily disable it clientside only).

I’m not really asking for someone to give me code but instead asking if anyone may know where to get a guide for this. I tried with some of my own code before but sadly when adding the numbers after the console command, it was unrecognized so I decided to remove the code.