ULX

Author Topic: ULib groups  (Read 4412 times)

0 Members and 1 Guest are viewing this topic.

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
ULib groups
« on: July 09, 2008, 08:36:40 PM »
What is the name of the table that the ULib groups are stored under?

==EDIT==

Found it in the defines.lua file.
« Last Edit: July 09, 2008, 08:41:34 PM by jay209015 »
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: ULib groups
« Reply #1 on: July 09, 2008, 09:08:48 PM »
What I was looking for is a way to get a full list of allows for each group.
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULib groups
« Reply #2 on: July 10, 2008, 04:26:24 PM »
You may have already found your answers, but I'll answer what I think it would be for anyone else that stumbles here.

ucl.groups[ <group_your_checking> ].allow

Pseudo-non checked lua code - I trust I'll be corrected.

for a, check_group in pairs (ucl.groups) do
    for b, each_allow in pairs ( ucl.groups( check_group ).allow ) do
-- Msg/Print/Whatever ( each_allow )
    end
end
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: ULib groups
« Reply #3 on: July 11, 2008, 01:06:29 AM »
PrintTable(ucl.groups) returned nil :S
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULib groups
« Reply #4 on: July 11, 2008, 04:59:33 AM »
ULib.ucl.groups silly :P
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULib groups
« Reply #5 on: July 11, 2008, 03:54:40 PM »
See, knew I'd be corrected!
I missed that ULib. detail. :P
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: ULib groups
« Reply #6 on: July 11, 2008, 10:11:42 PM »
Is there a table that has the full list of allows, including the ones that are inherited? Like:
 Default, Superadmin has 16, Admin 80, and operator 1

Admin inherits from operator, and superadmin inherits from admin, so that means Superadmin really has 97 and admin has 81.

Right now I'm using this little script to do the job, just wondering if the was an easier way.

Code: [Select]
// UGroup
USort_Temp = 0
UGroups = {}
UpdateAllows = true
for k,v in pairs(ULib.ucl.groups) do
table.insert(UGroups, k )
end
UAllows = {}
for k,v in pairs(UGroups) do
UAllows[v] = #ULib.ucl.groups[v]["allow"]
end

UInherits = {}
function UpdateAllows()
for k,v in pairs(UGroups) do
UInherits[v] = ULib.ucl.groups[v]["inherit_from"]
if #UInherits[v] > 0 then
for k2,v2 in pairs(ULib.ucl.groups[v]["inherit_from"]) do
UAllows[v] = UAllows[v] + UAllows[v2]
if not UInherits[v2] == nil then
UpdateAllows = true
else
UpdateAllows = false
end
end
end
end
if UpdateAllows then
UpdateAllows()
end
end
UpdateAllows()

I'm working on a script so that you can type: UPromote <player>, and it will promote them to the next level :D
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly