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

0 Members and 1 Guest are viewing this topic.

Offline TeoTown

  • Newbie
  • *
  • Posts: 2
  • Karma: -1
I'm very nooby with Lua. :c

I'm trying to add this to give the players experience points by how long they have played. I made a DarkRP chat command to check the total time but it appears as zero.

Code: [Select]
local function CheckTime(ply)
ply:PrintMessage(HUD_PRINTTALK,"[UTime] You have played on the server for: " .. ply:GetNWInt("TotalUTime") .. ".")
return ""
end
AddChatCommand("/time", CheckTime)

Is ply:GetNWInt("TotalUTime") wrong?

Offline TweaK

  • Jr. Member
  • **
  • Posts: 80
  • Karma: 14
    • Garry's Mod Engineers
I think ply:GetUTimeTotalTime() is what you're looking for.


Offline JackYack13

  • Newbie
  • *
  • Posts: 28
  • Karma: -1
Will there be a working release of this for GMod 13?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Will there be a working release of this for GMod 13?

Is it not already working?
Experiencing God's grace one day at a time.

Offline JackYack13

  • Newbie
  • *
  • Posts: 28
  • Karma: -1
Is it not already working?

It spams my console and the blue box in the corner is white and doesn't show any text. Serverside stuff is probably working though.

Offline Milk_

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
I don't even get a box, no errors in rcon or console.. nothing.

Offline Glider

  • Newbie
  • *
  • Posts: 6
  • Karma: -1
Spams the server with

[ERROR] addons/utime/lua/autorun/cl_utime.lua:138: attempt to index global 'utilx' (a nil value)
  1. unknown - addons/utime/lua/autorun/cl_utime.lua:138

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1264
  • Karma: 164
  • open(my $file, "<README") or die;
    • XGUI
This is on our radar-- we'll get around to it as soon as we have the time.
"The stupidity of an individual on the Internet is generally matched only the by size of their ego, unless the individual in question is unaware of both." - Me

Offline TweaK

  • Jr. Member
  • **
  • Posts: 80
  • Karma: 14
    • Garry's Mod Engineers
Serverside part already works, here's a fixed cl_utime.lua for now until an official update.
https://dl.dropbox.com/u/7934790/cl_utime.lua


Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Serverside part already works, here's a fixed cl_utime.lua for now until an official update.
https://dl.dropbox.com/u/7934790/cl_utime.lua

Thanks you kindly, we'll put these changes up on GitHub in the near future...
Experiencing God's grace one day at a time.

Offline pa1n

  • Newbie
  • *
  • Posts: 19
  • Karma: -1
I get this in console but it works.

Code: [Select]
[ERROR] lua/includes/extensions/debug.lua:41: bad argument #4 to 'format' (string expected, got nil)
1. format - [C]:-1
2. Trace - lua/includes/extensions/debug.lua:41
3. Get - lua/includes/modules/controlpanel.lua:13
4. resetCvars - addons/utime/lua/autorun/cl_utime.lua:305
5. fn - addons/utime/lua/autorun/cl_utime.lua:334
6. unknown - addons/ulib/lua/ulib/shared/hook.lua:168
7. GetAll - [C]:-1
8. fn - addons/ulx/lua/ulx/modules/sh/chat.lua:245
9. Call - addons/ulib/lua/ulib/shared/hook.lua:168
10. fn - addons/ulib/lua/ulib/cl_init.lua:40
11. unknown - addons/ulib/lua/ulib/shared/hook.lua:168
12. LocalPlayer - [C]:-1
13. fn - addons/ulib/lua/ulib/cl_init.lua:39
14. unknown - addons/ulib/lua/ulib/shared/hook.lua:168

Offline Milk_

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
I don't understand what I'm doing wrong, when I add this to my addons, and apply the cl_utime fix mentioned above, it doesn't even recognize the addon.

Code: [Select]
Adding Legacy Addon 'd:\userfiles\singularityservers\864\orangebox\garrysmod\addons\newliferule'
Adding Legacy Addon 'd:\userfiles\singularityservers\864\orangebox\garrysmod\addons\rpname'
Adding Legacy Addon 'd:\userfiles\singularityservers\864\orangebox\garrysmod\addons\ulib'
Adding Legacy Addon 'd:\userfiles\singularityservers\864\orangebox\garrysmod\addons\ulx'
Adding Legacy Addon 'd:\userfiles\singularityservers\864\orangebox\garrysmod\addons\UWSVN'
Adding Legacy Addon 'd:\userfiles\singularityservers\864\orangebox\garrysmod\addons\wire'
Adding Legacy Addon 'd:\userfiles\singularityservers\864\orangebox\garrysmod\addons\wiremod-AdvDuplicator-56811b2'
Server logging enabled.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Don't forget to rename info.txt to addon.txt
Experiencing God's grace one day at a time.

Offline Milk_

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
Silly me, I got it working by just adding the .lua files to the modules folder of ULX anywho. Thanks.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Official fix is now on GitHub. It's mostly unmodified from what TweaK had, though. Thanks, TweaK!
Experiencing God's grace one day at a time.