ULX

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

0 Members and 3 Guests are viewing this topic.

Offline tsmelinda

  • Newbie
  • *
  • Posts: 40
  • Karma: 1
ok i found it.
is there a way to make it point to a sql server or is that a separate version?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Use UTimeM for MySQL
Experiencing God's grace one day at a time.

Offline tinyanimations

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
I'm getting a problem with this utime. It doesn't save total time and shows the session time for both. We are using the ULX SVN if that makes any difference.

i have the same problem on my server how do i resolve this??

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
i have the same problem on my server how do i resolve this??

Do you have the sv.db file set to read-only?
Experiencing God's grace one day at a time.

Offline tinyanimations

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
where do i find the sv.db file? and is there aparticular way to check if its read only?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
where do i find the sv.db file? and is there aparticular way to check if its read only?


It's in the garrysmod root, check the properties of the file.
Experiencing God's grace one day at a time.

Offline tinyanimations

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
ive checked the file and it isnt read only, im using admin mod exsto if that makes a difference?

Offline Botman

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
I have a question. After messing around with some glitchy mods my playing time on my server has been reset to 0. I removed said mods yet it seems to have saved. Is there any way of setting my play time manually?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
I have a question. After messing around with some glitchy mods my playing time on my server has been reset to 0. I removed said mods yet it seems to have saved. Is there any way of setting my play time manually?

Not without a good understanding of SQL...
Experiencing God's grace one day at a time.

Offline Botman

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Ugh, wouldn't it at least be possible to run some Lua command that orders an edit in the SQL file?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Ugh, wouldn't it at least be possible to run some Lua command that orders an edit in the SQL file?

Yes, but you'd still need to know SQL. :P
Experiencing God's grace one day at a time.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
I have a simple setting command that I'd be willing to give you.

Offline Botman

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
I have a simple setting command that I'd be willing to give you.

I would greatly appreciate it.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
I have a simple setting command that I'd be willing to give you.

If you don't mind Aaron113, would you post it here for the future benefit of everyone? :)
Experiencing God's grace one day at a time.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Code: [Select]
local CATEGORY_NAME = "Custom"

function ulx.setutime( ply, targ, time )
if not targ:IsValid() then return end
targ:SetUTimeStart( CurTime() )
targ:SetUTime( time*3600 )
sql.Query( "INSET into utime( player, totaltime, lastvisit ) VALUES( ".. targ:UniqueID() ..",".. time*3600 ..",".. os.time() .." );" )
ulx.fancyLogAdmin( ply, "#A set the hour's for #T to #i", targ, time )
//return true
end
local setutime = ulx.command( CATEGORY_NAME, "ulx setutime", ulx.setutime, "!setutime" )
setutime:addParam{ type=ULib.cmds.PlayerArg, hint="player" }
setutime:addParam{ type=ULib.cmds.NumArg, default = 0, min = 0, max = 9999, hint="hours" }
setutime:defaultAccess( ULib.ACCESS_SUPERADMIN )
setutime:help( "Sets a player's hours." )
//setutime:logString( "#1s set the hour's for #2s to #3i" )
Goes in your ULX/lua/ulx/modules/sh/

The commented out lines are for a few revisions back before the logging changed.