ULX

Author Topic: TempAdd (v2.4) - Add a user to another group for a set amount of time  (Read 95636 times)

0 Members and 4 Guests are viewing this topic.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #30 on: February 13, 2013, 11:17:30 PM »
really cool Mr. President. Karam for you.
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline datgregofag

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #31 on: February 14, 2013, 04:34:50 AM »
Well thank you for all your help MrPresident. i will now use your tempadd in my server.Bye.

Offline DeathRowDave201

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #32 on: February 14, 2013, 09:54:36 AM »
MrPresident is there anyway to get this working with steamid, would be really helpful for the automatic donation system and would love to use this on my server but atm I have no need for it unless it was done by the steamid rather than just the username.

Offline datgregofag

  • Newbie
  • *
  • Posts: 25
  • Karma: 0
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #33 on: February 14, 2013, 11:59:05 AM »
Quote
MrPresident is there anyway to get this working with steamid, would be really helpful for the automatic donation system and would love to use this on my server but atm I have no need for it unless it was done by the steamid rather than just the username.
I like that idea if you can make that Mr.President it would be great. TY.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #34 on: February 14, 2013, 05:32:49 PM »
Yeah, I will have to figure out a way to convert steamids into the 64 bit steamids which I know is possible with some math. Then this could be a possibility. Just don't expect it for a while. I don't plan on doing any more work until after my surgery in a few days,

Offline DeathRowDave201

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #35 on: February 14, 2013, 05:48:57 PM »
Yeah, I will have to figure out a way to convert steamids into the 64 bit steamids which I know is possible with some math. Then this could be a possibility. Just don't expect it for a while. I don't plan on doing any more work until after my surgery in a few days,

Thanks for the reply, nice to hear youll look into sorting it out and I hope you do figure it out because it would be a nice feature and will more than likely attract more users to this addon. Thanks again and I hope your surgery goes to plan!

Regards,
Dave

Offline Bo98

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #36 on: March 24, 2013, 04:11:24 PM »
Suggestion:

Option to temp add user until they disconnect.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #37 on: March 25, 2013, 01:59:22 PM »
Suggestion:

Option to temp add user until they disconnect.

Code: [Select]
ulx luarun Entity(<player's ent number>):SetUserGroup("superadmin")
:P
Experiencing God's grace one day at a time.

Offline Bo98

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #38 on: March 25, 2013, 04:07:07 PM »
Code: [Select]
ulx luarun Entity(<player's ent number>):SetUserGroup("superadmin")
:P

Never thought about using entity numbers. Thanks.

Offline lua_error

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #39 on: March 26, 2013, 01:48:51 PM »
I got error at line 40

Code: [Select]
if os.time() >= exptime then
Failed to compare string with nubmer

What the reason of this?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #40 on: March 26, 2013, 08:40:05 PM »
You are sure that is the right line? Neither one of those should be a string.

os.time() is an integer

and exptime is also an integer.

Offline Bo98

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #41 on: March 27, 2013, 11:42:52 AM »
Code: [Select]
ulx luarun Entity(<player's ent number>):SetUserGroup("superadmin")
:P

Hmm, it's not working for me. Does it not work with Entities?

Code: [Select]
attempt to call method 'SetUserGroup' (a nil value)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #42 on: March 27, 2013, 12:30:31 PM »
Hmm, it's not working for me. Does it not work with Entities?

Code: [Select]
attempt to call method 'SetUserGroup' (a nil value)

Without going into too many details, a player is-a entity (inheritance relationship). Are you sure you're using the right entity number? They'll always be in the range 1-<max players>.
Experiencing God's grace one day at a time.

Offline Bo98

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #43 on: March 27, 2013, 12:36:50 PM »
Without going into too many details, a player is-a entity (inheritance relationship). Are you sure you're using the right entity number? They'll always be in the range 1-<max players>.

Yeah, I'm aware of the player-entity relationship, just thought for a moment it might've not counted here.

And it doesn't work whatever way I do it:

Code: [Select]
Entity(ply:EntIndex()):SetUserGroup("superadmin")
Code: [Select]
print(Entity(1):GetName()) -- prints my nick correctly
Entity(1):SetUserGroup("superadmin") -- error

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: TempAdd (v2.2) - Add a user to another group for a set amount of time
« Reply #44 on: March 27, 2013, 03:51:53 PM »
Works for me. Something's wrong in your Lua environment, perhaps?

Code: [Select]
lua_run print(Entity(1))
> print(Entity(1))...
Player [1][[ULX]Megiddo]
lua_run Entity(1):SetUserGroup("superadmin")
> Entity(1):SetUserGroup("superadmin")...
Experiencing God's grace one day at a time.