ULX

Author Topic: utime editing  (Read 6549 times)

0 Members and 1 Guest are viewing this topic.

Offline justinboggs

  • Newbie
  • *
  • Posts: 8
  • Karma: -1
utime editing
« on: August 27, 2011, 01:03:56 PM »
i edit the SV.DB that has the utime in it alot updating peoples hours (server stuff is based on hours and old hours were lost....)
its a pain to have to shut the server off to update the db. i know it is possable to update it from in game in real time, my friend did it when i was on his server after old one was lost due to hard drive failing
i would love to have a menu with everyone in the user.txt where you can see them by name and steamid and uniqueid that would make life so much easier also  two friends of mine have this request if you do the utime thing and if its possable they want to make it so that you can make select people's hours not go up
i hope someone can do this

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: utime editing
« Reply #1 on: August 27, 2011, 02:19:09 PM »
I made a ulx command that you can use to set a players time.  You can find that in this post.  It'll help but it's no menu.

Offline justinboggs

  • Newbie
  • *
  • Posts: 8
  • Karma: -1
Re: utime editing
« Reply #2 on: August 29, 2011, 02:20:35 AM »
i added your code to utime edit.lua and put in it this
C:\Program Files (x86)\Steam\steamapps\justinboggs0\garrysmod\garrysmod\addons\ulx\lua\ulx\modules\sh

and ulx saids its not there
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" )
what am i doing wrong

Offline pineappleplays

  • Newbie
  • *
  • Posts: 12
  • Karma: 0
Re: utime editing
« Reply #3 on: July 01, 2015, 09:28:47 PM »
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 )
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." )

the // commands you put in there are not sup-post to be there, but i'm not sure

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: utime editing
« Reply #4 on: July 01, 2015, 09:44:40 PM »
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 )
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." )

the // commands you put in there are not sup-post to be there, but i'm not sure
Probably not a good idea to bump a 4 year old topic and not contribute anything super useful to it.