More changes

This commit is contained in:
Kakarot
2022-03-30 00:45:31 -05:00
parent f5e22066fb
commit 46a2aae5ce
3 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ QBConfig.Server.WhitelistPermission = 'admin' -- Permission that's able to enter
QBConfig.Server.PVP = true -- Enable or disable pvp on the server (Ability to shoot other players)
QBConfig.Server.Discord = "" -- Discord invite link
QBConfig.Server.CheckDuplicateLicense = true -- Check for duplicate rockstar license on join
QBConfig.Server.Permissions = {'god', 'admin', 'mod'} -- Add as many groups as you want here after creating them in your server.cfg
QBConfig.Server.Permissions = {'admin', 'mod'} -- Add as many groups as you want here after creating them in your server.cfg
QBConfig.Notify = {}
+7 -1
View File
@@ -3,9 +3,15 @@ QBCore.Commands.List = {}
QBCore.Commands.IgnoreList = { -- Ignore old perm levels while keeping backwards compatibility
['god'] = true, -- We don't need to create an ace because group.admin allows all commands
['admin'] = true, -- We don't need to create an ace because group.admin allows all commands
['user'] = true, -- We don't need to create an ace because builtin.everyone
['user'] = true -- We don't need to create an ace because builtin.everyone
}
CreateThread(function() -- Add rank name to ace
for k,v in pairs(QBConfig.Server.Permissions) do
ExecuteCommand(('add_ace group.%s %s allow'):format(v, v))
end
end)
-- Register & Refresh Commands
function QBCore.Commands.Add(name, help, arguments, argsrequired, callback, permission)
+4 -10
View File
@@ -266,12 +266,8 @@ end
function QBCore.Functions.AddPermission(source, permission)
local src = source
local license = QBCore.Functions.GetIdentifier(src, 'license')
for k,v in pairs(QBCore.Config.Server.Permissions) do
if permission == v then
ExecuteCommand(('add_principal identifier.%s group.%s'):format(license, permission))
QBCore.Commands.Refresh(src)
end
end
ExecuteCommand(('add_principal identifier.%s group.%s'):format(license, permission))
QBCore.Commands.Refresh(src)
end
function QBCore.Functions.RemovePermission(source, permission)
@@ -296,8 +292,7 @@ end
function QBCore.Functions.HasPermission(source, permission)
local src = source
local group = ('group.%s'):format(permission)
if IsPlayerAceAllowed(tostring(src), group) then return true end
if IsPlayerAceAllowed(src, permission) then return true end
return false
end
@@ -305,8 +300,7 @@ function QBCore.Functions.GetPermissions(source)
local src = source
local perms = {}
for k,v in pairs (QBCore.Config.Server.Permissions) do
local group = ('group.%s'):format(v)
if IsPlayerAceAllowed(src, group) then
if IsPlayerAceAllowed(src, v) then
perms[v] = true
end
end