This script should make ULX v1.* compatible scripts compatible with ULib! Now you can get the benefit of the new security and features of ULib with ULX v1 backwards compatibility

To use this, just put the code in a file in the lua/init folder (I named mine ulx1compat.lua). The file can be named anything, as long as it has a .lua extension.
Here's the code:
--[[
ULib->ULX v1.* compatibility script
This script should make ULib compatible with any scripts that relied on the ULX v1.* authentication method!
]]
assert( _file.Exists( "lua/ULib/init.lua" ), "ULX needs ULib to run!" )
_OpenScript( "ULib/init.lua" )
assert( ULib.ULIB_VERSION >= 1, "ULX requires ULib version 1 or higher to run!" )
gUsers = {}
local ucl = ULib.mainUcl -- change this if you're using a different UCL
function hasAccess( userid, access )
return ucl:query( userid, access )
end
function hasAccessSteamid( steamid, access )
local player
for player = 1, _MaxPlayers() do
if _PlayerInfo( userid, "networkid" ) == steamid then
break
end
end
if not player then return false end
return ucl:query( player, access )
end
function getAccess( userid )
if ucl.authed[ userid ] then
return ucl.authed[ userid ].access_flags
end
return nil
end
local function updateUsers()
gUsers = {}
for k, v in pairs( ucl.authed ) do
gUsers[ v.steamid ] = v.access_flags
end
end
AddTimer( 29, 0, updateUsers )
Have fun folks!