Ulysses
Ulysses Stuff => General Chat & Help and Support => Topic started by: Andbusy on October 09, 2006, 01:31:16 PM
-
hi all
how can i get an array like the old "gUsers" ???
gUsers[playerid]=access
cant finde something like this in the new ULib
need it at an AdminImportULX() for some other lua
cant convert something like
...
if (gUsers) then
for k,v in gUsers do
...
n8
-
ULib has a compatibility layer, so just use "gUsers" (a global variable), like you would in ULX v1.1. You can also use hasAccess and hasAccessSteamid.
-
hi
hasAccess and hasAccessSteamid i can only us if player is online if i understand it correct
i need the array for offline and online admins ;)
if i use something like
if (gUsers) then
...
end
it will go in the if only if there are admins in the users.ini ?
and if it dosent go in the if why if i have admins in the users.ini ?
i havend find a way that it gos in all time false this variable :/
if this is only online admins i must make a timer all minut or something like this to import admins if they are onine -.-
n8
-
In ULX v1.1, gUsers would contain all users online or off. In ULib, gUsers only contains users who have logged in on this map change (since you can add users by other things than steamid).
-
Meg, that is what he is asking. What variable stores _all_ admins, logged on or not.
Andbusy...
see ucl_public.lua ... where I found this comment and variable.
--[[
Variable: mainUcl
This holds the default user access list, from the file "lua/ULib/users.ini"
Revisions:
v1 - Changed from mainUcl to ULib.mainUcl
]]
ULib.mainUcl = ULib.ucl:newFromFile( ULib.DEFAULT_UCL_FILE )
I believe the answer you're looking for is ULb.mainUcl
However, you'll need to use ULib functions to query individual members from the table.
-
He'd be better off using gUsers... the ucl contains all sorts of other things besides steamids (ips, clantags, etc)
-
True, but he's wanting offline players too.
He could use ULib.isInTable to check whatever he's searching for.
I've not really looked at the format of the table to know how its all stored.
Andbusy, I just thought about it....why are you wanting offline too?
It can be done, it just makes it more difficult, messy, like Megiddo said :)
-
hi
@Megiddo she ;)
ULib.mainUcl sores some more stuff making an funktion to geht the array (= ...
ähm i want offline user too cause of removing admin righs (only spezial flags) or add or edit adinrights online (so u can look what admins has which rights, not only if they are online)
and some other lua's need this variable because they load ther admins only on init and i dont want change code at 20 or more places if there is an existing ULX import admin funktion that dos work only with old ulx and nor with new ulib ;)
i've found a way to get the variable, ill post it later @17pm if i remember... now 7am and i have to work =( ^^
n8
-
ACK! :-[ ::)
How presumptuous of us. Megiddo and I just presumed you were he.
Our apologies. It seems rare we find coders of the feminine persuasion among our ranks very often.
(Shame too. What few I've worked with in my career are/have been top notch)
Good luck with you're project.
If we can be of further assistance, please ask. :)
-
It seems rare we find coders of the feminine persuasion among our ranks very often.
That same presumptous thought crossd my very philosophical mind as well. (In keeping with the fancy language).
But anyyway, Good luck with that, nate (assuming thats your name)!
-
moin moin
function ecsulx.teams.importUlxUser (loop)
local count = 0
if _file.Exists ("lua/ULib/init.lua") then -- Import from ULib
if ULib ~= nil then
splitArgs = ULib.splitArgs
for steamid in ULib.mainUcl["steamids"] do
if (ecsulx.teams.config.members[steamid] == nil) then
ecsulx.teams.config.members[steamid] = ULib.mainUcl["steamids"][steamid]["access_flags"]
count = count + 1
end
end
elseif loop == nil then
--_Msg ("xxx-ecsulx [ULib] Initiating ...\n")
_OpenScript ("lua/ULib/init.lua")
--_Msg ("xxx-ecsulx [ULib] ... done\n")
count = ecsulx.teams.importUlxUser (true)
end
elseif _file.Exists ("lua/init/ulx_init.lua") then -- Import from ULX
if gUsers ~= nil then
for k, v in gUsers do
-- temp = string.upper (string.gsub (k, " ", ""))
temp = string.upper (k)
if (ecsulx.teams.config.members[temp] == nil) then
ecsulx.teams.config.members[temp] = v
count = count + 1
end
end
elseif loop == nil then
--_Msg ("xxx-ecsulx [ULX] Initiating ...\n")
_OpenScript ("lua/init/ulx_init.lua")
--_Msg ("xxx-ecsulx [ULX] ... done\n")
count = ecsulx.teams.importUlxUser (true)
end
else
_Msg ("// ULX -> ECS user import // - ecsulx Can not find ULib / ULX.\n")
end
return count
end
thats the funktion i use now. the name says it (to import users to ECS)
i call it in the orginal funktion like
_Msg ("// ULX -> ECS user import // - ".. ecsulx.teams.importUlxUser() .. " user imported\n");
now all ULX admins whis the flack (in ECS config) are Admins in ECS =)
have fun with it ;)
n8
-
moin moin
function ecsulx.teams.importUlxUser (loop)
local count = 0
if _file.Exists ("lua/ULib/init.lua") then -- Import from ULib
if ULib ~= nil then
splitArgs = ULib.splitArgs
for steamid in ULib.mainUcl["steamids"] do
if (ecsulx.teams.config.members[steamid] == nil) then
ecsulx.teams.config.members[steamid] = ULib.mainUcl["steamids"][steamid]["access_flags"]
count = count + 1
end
end
elseif loop == nil then
--_Msg ("xxx-ecsulx [ULib] Initiating ...\n")
_OpenScript ("lua/ULib/init.lua")
--_Msg ("xxx-ecsulx [ULib] ... done\n")
count = ecsulx.teams.importUlxUser (true)
end
elseif _file.Exists ("lua/init/ulx_init.lua") then -- Import from ULX
if gUsers ~= nil then
for k, v in gUsers do
-- temp = string.upper (string.gsub (k, " ", ""))
temp = string.upper (k)
if (ecsulx.teams.config.members[temp] == nil) then
ecsulx.teams.config.members[temp] = v
count = count + 1
end
end
elseif loop == nil then
--_Msg ("xxx-ecsulx [ULX] Initiating ...\n")
_OpenScript ("lua/init/ulx_init.lua")
--_Msg ("xxx-ecsulx [ULX] ... done\n")
count = ecsulx.teams.importUlxUser (true)
end
else
_Msg ("// ULX -> ECS user import // - ecsulx Can not find ULib / ULX.\n")
end
return count
end
thats the funktion i use now. the name says it (to import users to ECS)
i call it in the orginal funktion like
_Msg ("// ULX -> ECS user import // - ".. ecsulx.teams.importUlxUser() .. " user imported\n");
now all ULX admins whis the flack (in ECS config) are Admins in ECS =)
have fun with it ;)
n8
This function looks very familiar to me :D
-
....funktion.....
....funktion....
Thats funky.
-
Can you explain how you put this exactly into ecs, please.