ULX

Author Topic: Getting all ULX ranks  (Read 2476 times)

0 Members and 1 Guest are viewing this topic.

Offline Promptitude

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Getting all ULX ranks
« on: December 18, 2015, 12:43:31 AM »
How would I check all ULX ranks inside of a .lua file?

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Getting all ULX ranks
« Reply #1 on: December 18, 2015, 01:12:24 AM »
All groups (and their permissions) are stored in ULib.ucl.groups.

Code: [Select]
for group in pairs(ULib.ucl.groups) do
    print(group)
end

Offline Promptitude

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Re: Getting all ULX ranks
« Reply #2 on: December 18, 2015, 04:29:34 AM »
Is it stored anywhere without permissions so I don't have to take them out?

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Getting all ULX ranks
« Reply #3 on: December 18, 2015, 04:53:34 AM »
Yes! It looks like the group names are also stored in ulx.group_names.
https://github.com/TeamUlysses/ulx/blob/40274fe877c970a71437c583c9640a718ebb80ba/lua/ulx/modules/sh/user.lua#L24

Code: [Select]
> PrintTable(ulx.group_names)...
1       =       superadmin
2       =       operator
3       =       user
4       =       admin

Edit: But you'd have to make sure your script executes after ulx/lua/ulx/modules/sh/user.lua, which could be annoying.
« Last Edit: December 18, 2015, 05:01:38 AM by Timmy »

Offline Promptitude

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Re: Getting all ULX ranks
« Reply #4 on: December 18, 2015, 05:20:27 AM »
It executes on command. Just a derma menu.

Also, thanks a heap for the help.
« Last Edit: December 18, 2015, 05:27:26 AM by Promptitude »

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Getting all ULX ranks
« Reply #5 on: December 18, 2015, 05:47:50 AM »
Ah, that won't be be an issue then. Glad I could help! :)