Ulysses Stuff > Suggestions

utime editing

(1/1)

justinboggs:
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

Aaron113:
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.

justinboggs:
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: ---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" )
--- End code ---
what am i doing wrong

pineappleplays:
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

Aaron113:

--- Quote from: pineappleplays 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

--- End quote ---
Probably not a good idea to bump a 4 year old topic and not contribute anything super useful to it.

Navigation

[0] Message Index

Go to full version