Update to qbcore.

This commit is contained in:
Kakarot
2022-03-30 17:05:07 -05:00
parent 2d6159345b
commit b04eb3f43a
2 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -1,13 +1,13 @@
QBCore.Commands = {}
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.god allows all commands
['god'] = true, -- We don't need to create an ace because god is allowed all commands
['user'] = true -- We don't need to create an ace because builtin.everyone
}
CreateThread(function() -- Add rank name to ace
CreateThread(function() -- Add ace to node for perm checking
for k,v in pairs(QBConfig.Server.Permissions) do
ExecuteCommand(('add_ace group.%s %s allow'):format(v, v))
ExecuteCommand(('add_ace qbcore.%s %s allow'):format(v, v))
end
end)
@@ -19,7 +19,7 @@ function QBCore.Commands.Add(name, help, arguments, argsrequired, callback, perm
if permission == 'user' then restricted = false end -- allow all users to use command
RegisterCommand(name, callback, restricted) -- Register command within fivem
if not QBCore.Commands.IgnoreList[permission] then -- only create aces for extra perm levels
ExecuteCommand(('add_ace group.%s command.%s allow'):format(permission, name))
ExecuteCommand(('add_ace qbcore.%s command.%s allow'):format(permission, name))
end
QBCore.Commands.List[name:lower()] = {
name = name:lower(),
+3 -3
View File
@@ -266,7 +266,7 @@ end
function QBCore.Functions.AddPermission(source, permission)
local src = source
local license = QBCore.Functions.GetIdentifier(src, 'license')
ExecuteCommand(('add_principal identifier.%s group.%s'):format(license, permission))
ExecuteCommand(('add_principal identifier.%s qbcore.%s'):format(license, permission))
QBCore.Commands.Refresh(src)
end
@@ -275,13 +275,13 @@ function QBCore.Functions.RemovePermission(source, permission)
local license = QBCore.Functions.GetIdentifier(src, 'license')
if permission then
if IsPlayerAceAllowed(src, permission) then
ExecuteCommand(('remove_principal identifier.%s group.%s'):format(license, permission))
ExecuteCommand(('remove_principal identifier.%s qbcore.%s'):format(license, permission))
QBCore.Commands.Refresh(src)
end
else
for k,v in pairs(QBCore.Config.Server.Permissions) do
if IsPlayerAceAllowed(src, v) then
ExecuteCommand(('remove_principal identifier.%s group.%s'):format(license, v))
ExecuteCommand(('remove_principal identifier.%s qbcore.%s'):format(license, v))
QBCore.Commands.Refresh(src)
end
end