More changes

This commit is contained in:
Kakarot
2022-03-29 22:33:26 -05:00
parent a528a0b127
commit f5e22066fb
2 changed files with 8 additions and 10 deletions
+4 -7
View File
@@ -89,11 +89,7 @@ QBCore.Commands.Add('addpermission', 'Give Player Permissions (God Only)', { { n
local Player = QBCore.Functions.GetPlayer(tonumber(args[1]))
local permission = tostring(args[2]):lower()
if Player then
if QBCore.Config.Server.Permissions[permission] then
QBCore.Functions.AddPermission(Player.PlayerData.source, permission)
else
TriggerClientEvent('QBCore:Notify', source, 'Invalid permission level', 'error')
end
QBCore.Functions.AddPermission(Player.PlayerData.source, permission)
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
end
@@ -101,8 +97,9 @@ end, 'god')
QBCore.Commands.Add('removepermission', 'Remove Players Permissions (God Only)', { { name = 'id', help = 'ID of player' } }, true, function(source, args)
local Player = QBCore.Functions.GetPlayer(tonumber(args[1]))
local permission = tostring(args[2]):lower()
if Player then
QBCore.Functions.RemovePermission(Player.PlayerData.source)
QBCore.Functions.RemovePermission(Player.PlayerData.source, permission)
else
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error')
end
@@ -128,7 +125,7 @@ QBCore.Commands.Add('closeserver', 'Close the server for people without permissi
return
end
if QBCore.Functions.HasPermission(source, 'admin') then
reason = args[1] or 'No reason specified'
local reason = args[1] or 'No reason specified'
QBCore.Config.Server.Closed = true
QBCore.Config.Server.ClosedReason = reason
for k in pairs(QBCore.Players) do
+4 -3
View File
@@ -301,15 +301,16 @@ function QBCore.Functions.HasPermission(source, permission)
return false
end
function QBCore.Functions.GetPermission(source)
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
return v
perms[v] = true
end
end
return 'user'
return perms
end
-- Opt in or out of admin reports