Poll

Was this module useful, and helpful?

Yes :)
134 (93.7%)
No :(
9 (6.3%)

Total Members Voted: 143

Author Topic: Utime Hour Changer Addon :) [2.18v]  (Read 83552 times)

0 Members and 6 Guests are viewing this topic.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Utime Hour Changer Addon :)
« Reply #45 on: November 15, 2014, 05:39:02 PM »
Bytewave, I've changed the appearance of your name on our forums, at the request of your signature.
I've also deleted your last post.
This thread isn't the place to question such things. I honestly don't think he meant ill-will.
Take it private if you truly wish to question a possible mis-understanding.
Right.
My apologies, and thank you. I'll attempt to refrain from such things later on.
bw81@ulysses-forums ~ % whoami
Homepage

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Utime Hour Changer Addon :)
« Reply #46 on: November 17, 2014, 04:37:13 PM »
Assuming that what I said was most likely taken offensively. Though looking through what I said, I assume that the phrase, 'Princess Brony Person' had offended you. It was not meant to offend you, I had said it more or less as a light joke. Seeing as your signature said something similiar to it, and when I was writing that post, I wrote it on my phone, and I didn't want to check your exact name as the page could crash (iPhone.. 4g), so I decided to just use the name that I really can you remember for. So if what I said offended you, I apologize for that.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Utime Hour Changer Addon :)
« Reply #47 on: November 17, 2014, 04:44:40 PM »
Assuming that what I said was most likely taken offensively. Though looking through what I said, I assume that the phrase, 'Princess Brony Person' had offended you. It was not meant to offend you, I had said it more or less as a light joke. Seeing as your signature said something similiar to it, and when I was writing that post, I wrote it on my phone, and I didn't want to check your exact name as the page could crash (iPhone.. 4g), so I decided to just use the name that I really can you remember for. So if what I said offended you, I apologize for that.
it's fine... Not sure if it's the best idea to continue taking here, as Jam previously noted...
bw81@ulysses-forums ~ % whoami
Homepage

Offline Shalmendo

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
Re: Utime Hour Changer Addon :)
« Reply #48 on: November 18, 2014, 07:55:39 AM »
Chaos,

The adjustments you made to your mod now have it working properly on a linux dedicated when it was not before.
We swapped to a dedicated linux server the owner is hosting directly in his home, and the same modules didn't want to work again. HOWEVER, whatever change(s) you made has yours working.

Can you give me a rundown on what you did so that I can try to replicate it with the other modules?

Edit:

I decided to do the non-lazy thing and review your earlier post. You changed the folder/file names to be lowercase without spaces. This has fixed the other modules!
It might be a good idea to put this in a FAQ somewhere since it's a minor and subtle difference that makes a huge impact on what actually works! A lot of windows users will find this very confusing.
« Last Edit: November 18, 2014, 08:18:06 AM by Shalmendo »

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Utime Hour Changer Addon :)
« Reply #49 on: November 18, 2014, 04:04:08 PM »
Chaos,

The adjustments you made to your mod now have it working properly on a linux dedicated when it was not before.
We swapped to a dedicated linux server the owner is hosting directly in his home, and the same modules didn't want to work again. HOWEVER, whatever change(s) you made has yours working.

Can you give me a rundown on what you did so that I can try to replicate it with the other modules?

Edit:

I decided to do the non-lazy thing and review your earlier post. You changed the folder/file names to be lowercase without spaces. This has fixed the other modules!
It might be a good idea to put this in a FAQ somewhere since it's a minor and subtle difference that makes a huge impact on what actually works! A lot of windows users will find this very confusing.

To be honest, I didn't even know that linux ("being as complex as it is"), can't handle a simple uppercase... but oh well.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Utime Hour Changer Addon :)
« Reply #50 on: November 18, 2014, 04:29:31 PM »
To be honest, I didn't even know that linux ("being as complex as it is"), can't handle a simple uppercase... but oh well.
I do believe this is Garry/Facepunch's issue, if not Lua or the Source engine. *nix systems ought to handle capital letters in file/directory names fine.
bw81@ulysses-forums ~ % whoami
Homepage

Offline Shalmendo

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
Re: Utime Hour Changer Addon :)
« Reply #51 on: November 18, 2014, 06:14:38 PM »
I do believe this is Garry/Facepunch's issue, if not Lua or the Source engine. *nix systems ought to handle capital letters in file/directory names fine.

Yeah it doesn't make sense to me either. Nor to the other people I'm working with (one of which who's rather expert in linux.)

It's probably one of those stupid differences between the windows and linux versions of gmod that I've had to deal with. One of our admins plays on linux and quite few addons and such have odd or unusual behaviors on linux, according to his experiences.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Utime Hour Changer Addon :)
« Reply #52 on: November 18, 2014, 06:32:17 PM »
Yeah it doesn't make sense to me either. Nor to the other people I'm working with (one of which who's rather expert in linux.)

It's probably one of those stupid differences between the windows and linux versions of gmod that I've had to deal with. One of our admins plays on linux and quite few addons and such have odd or unusual behaviors on linux, according to his experiences.
All I can say is... blame Garry.
Anyway, enough tan(x)...
/OT
bw81@ulysses-forums ~ % whoami
Homepage

Offline Shalmendo

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
Re: Utime Hour Changer Addon :)
« Reply #53 on: November 29, 2014, 09:24:31 AM »
Chaos,

I have another question for you.

Is it possible to edit the hours of somone who's not on the server but who's in one of the ULX groups? We're going to edit peoples times so the auto promoter demotes them next time they get on (for punishment reasons).

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Utime Hour Changer Addon :)
« Reply #54 on: December 01, 2014, 01:30:37 AM »
Chaos,

I have another question for you.

Is it possible to edit the hours of somone who's not on the server but who's in one of the ULX groups? We're going to edit peoples times so the auto promoter demotes them next time they get on (for punishment reasons).

Technically speaking yes. There isn't really an easy way to do it though, I suppose I could technically make a console command for it, but it becomes sketchy and more "breakable". I try to make addons that others can't break and then try to blame me for it.

Anyways, if you really want to edit peoples time, all you need to do is (WARNING, BE CAREFUL IF YOU DECIDE TO GO THROUGH WITH THIS PLAN, IM NOT RESPONSIBLE FOR IF YOU BREAK ANYTHING. (ALSO TURN YOUR SERVER OFF BEFORE YOU DO THIS)) is download a sqlite viewer (such as sqlite admin or sqliteman), and open up your sv.db file located at the cored of your server (garrysmod/garrysmod/sv.db). Then you need to find the table called utime, then find the SteamID of the person you want to edit, and change their total time to 0 as well as lastvisit..

After all that, upload the file back, and turn the server back on.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Utime Hour Changer Addon :)
« Reply #55 on: February 03, 2015, 11:40:20 PM »
Updated addon to current system!
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Stranger Danger

  • Newbie
  • *
  • Posts: 24
  • Karma: 2
Re: Utime Hour Changer Addon :) [2.17v]
« Reply #56 on: March 13, 2015, 11:23:41 AM »
Hey, great module I use it on my server with apromote, people get ranks depending on how long they have played with us. We also give a 4 hour boost to anyone who joins our forums and post an introduction to get more people on there. So I created a module called addtime which I copied a lot of what you had and modified it to, addtime adds the hours specified on top of what they had. This way I can add say 4 hours and they don't lose the 40 min they had into that hour. I hope this is okay and if your interested I can give it to you.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: Utime Hour Changer Addon :) [2.17v]
« Reply #57 on: March 13, 2015, 01:43:58 PM »
Hey, great module I use it on my server with apromote, people get ranks depending on how long they have played with us. We also give a 4 hour boost to anyone who joins our forums and post an introduction to get more people on there. So I created a module called addtime which I copied a lot of what you had and modified it to, addtime adds the hours specified on top of what they had. This way I can add say 4 hours and they don't lose the 40 min they had into that hour. I hope this is okay and if your interested I can give it to you.

I'd like to see what you've done, maybe I can make it official with your credits on it.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Stranger Danger

  • Newbie
  • *
  • Posts: 24
  • Karma: 2
Re: Utime Hour Changer Addon :) [2.17v]
« Reply #58 on: March 13, 2015, 01:54:24 PM »
So a few things, for one I set it so it doesn't round the number so I can add .5 hours for a half an hour. This is for if someone does something extra or we sometimes do trivia for small amounts of time I can add say 15 minutes. If you could add something along the lines of !addtime name 15m for 15m that would be amazing. But feel free to add/modify/delete what ever you want, it basically yours.

Also could there be the potential to add time to a group of people? I am not sure how sql works for utime so wasn't sure if that was possible. But maybe a !addtime * or !addtime user.

Here is the code:
Code: [Select]
---------------------------------add time--------------------------------------
function ulx.addtime( calling_ply, target_ply, time )
 
local affected_plys = {}
function updatePlayer( ply )
sql.Query( "UPDATE utime SET totaltime = " .. math.floor( ply:GetUTimeTotalTime() ) .. " WHERE player = " .. ply:UniqueID() .. ";" )
end
 
function updateAll()
local players = player.GetAll()
 
for _, ply in ipairs( players ) do
if ply and ply:IsConnected() then
updatePlayer( ply )
end
end
end
 
 
local plyID = tostring(target_ply:UniqueID())
local ply = player.GetByUniqueID(plyID)
local ammount = tonumber(tostring(time))
ammount = ammount * 3600
newtime = ply:GetUTimeTotalTime() + ammount
ply:SetUTime( newtime )
ply:SetUTimeStart( CurTime() )
 
  //sql.Query( "UPDATE utime SET totaltime = " ..  math.floor(newtime)  .. " WHERE player = " .. plyID .. ";" )
  updateAll()
table.insert( affected_plys, target_ply )
ulx.fancyLogAdmin( calling_ply, "#A added #s hours to #T", time, affected_plys )
end
 
 
local addtime = ulx.command( CATEGORY_NAME, "ulx addtime", ulx.addtime, "!addtime" )
addtime:addParam{ type=ULib.cmds.PlayerArg }
addtime:addParam{ type=ULib.cmds.NumArg, min=0, default=1, hint="Hours" }
addtime:defaultAccess( ULib.ACCESS_SUPERADMIN )
addtime:help( "Add hours to a players time - !addtime" )
« Last Edit: March 13, 2015, 03:18:35 PM by Stranger Danger »

Offline PotatoMan

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: Utime Hour Changer Addon :) [2.17v]
« Reply #59 on: March 26, 2015, 12:50:58 AM »
Why doesn't this work for me? Someone please help me. I want this because the Utime somehow stuffed up and reset the time:|