Hey Megiddo, thanks for reply. So it should be something like this?
if not ULib and not hasAccess then
if _file.Exists ("lua/ULib/init.lua") then
fkk.teams:debug ("[Addon] ULib/ULX: Initiating ULib")
_OpenScript ("lua/ULib/init.lua")
ULIb.addAccessCallback ("hasAccess")
elseif _file.Exists ("lua/init/ulx_init.lua") then
fkk.teams:debug ("[Addon] ULib/ULX: Initiating ULX")
_OpenScript ("lua/init/ulx_init.lua")
else
fkk.teams:debug ("[Addon] ULib/ULX: cannot initiate script. script not found.")
end
end
Note that I will support ULX1 and 2
this is the addon so far:
if true then -- Addon enabled
if not ULib and not hasAccess then
if _file.Exists ("lua/ULib/init.lua") then
fkk.teams:debug ("[Addon] ULib/ULX: Initiating ULib")
_OpenScript ("lua/ULib/init.lua")
elseif _file.Exists ("lua/init/ulx_init.lua") then
fkk.teams:debug ("[Addon] ULib/ULX: Initiating ULX")
_OpenScript ("lua/init/ulx_init.lua")
else
fkk.teams:debug ("[Addon] ULib/ULX: cannot initiate script. script not found.")
end
end
fkk.teams.addon["flag"] = {
default = "",
type = "teamchange",
func = function (iUserid)
local playersteam = fkk.teams:getPlayersTeam (iUserid)
if not hasAccess then
return false
end
if playersteam ~= false then -- is a team set for this player?
return false
end
for team, _ in fkk.teams.cfg.teams do
if is_string (fkk.teams.cfg.teams[team].flag) and not fkk.lib.empty (fkk.teams.cfg.teams[team].flag) then
if _PlayerInfo (iUserid, "team") ~= team and hasAccess (iUserid, fkk.teams.cfg.teams[team].flag, true) then
_PlayerChangeTeam (iUserid, team)
fkk.teams:debug ("[Addon] ULib/ULX: moved \"" .. _PlayerInfo (iUserid, "name") .. "\" to \"" .. fkk.teams:getTeamName (team) .. "\".")
return true
end
end
end
fkk.teams:debug ("[Addon] ULib/ULX: \"" .. _PlayerInfo (iUserid, "name") .. "\" has no valid teamflag.")
return false
end
}
if hasAccess then
fkk.teams.isAdmin = function (userid)
if hasAccess (userid, "t", true) then
return true
end
userid = fkk.teams:getPlayersId (userid)
return fkk.lib.table.in_table (userid, fkk.teams.config.admins)
end
end
end