Ulysses
General => Developers Corner => Topic started by: jay209015 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.
-
What I was looking for is a way to get a full list of allows for each group.
-
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
-
PrintTable(ucl.groups) returned nil :S
-
ULib.ucl.groups silly :P
-
See, knew I'd be corrected!
I missed that ULib. detail. :P
-
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.
// 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