mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:01:24 +00:00
Performance, notification, and localization updates to server/commands.lua (#638)
* 🐎 Update ace permissions loop from pairs() to for-i * Add success notification to `openserver` and `closeserver` * 🌐 Add missing localization strings for commands * Add missing comma at end of line Co-authored-by: Kakarot <57848836+GhzGarage@users.noreply.github.com> Co-authored-by: BerkieBb <82737367+BerkieBb@users.noreply.github.com>
This commit is contained in:
+8
-4
@@ -6,8 +6,10 @@ QBCore.Commands.IgnoreList = { -- Ignore old perm levels while keeping backwards
|
||||
}
|
||||
|
||||
CreateThread(function() -- Add ace to node for perm checking
|
||||
for _, v in pairs(QBConfig.Server.Permissions) do
|
||||
ExecuteCommand(('add_ace qbcore.%s %s allow'):format(v, v))
|
||||
local permissions = QBConfig.Server.Permissions
|
||||
for i=1, #permissions do
|
||||
local permission = permissions[i]
|
||||
ExecuteCommand(('add_ace qbcore.%s %s allow'):format(permission, permission))
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -140,11 +142,12 @@ end, 'god')
|
||||
|
||||
QBCore.Commands.Add('openserver', 'Open the server for everyone (Admin Only)', {}, false, function(source)
|
||||
if not QBCore.Config.Server.Closed then
|
||||
TriggerClientEvent('QBCore:Notify', source, 'The server is already open', 'error')
|
||||
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.server_already_open'), 'error')
|
||||
return
|
||||
end
|
||||
if QBCore.Functions.HasPermission(source, 'admin') then
|
||||
QBCore.Config.Server.Closed = false
|
||||
TriggerClientEvent('QBCore:Notify', source, Lang:t('success.server_opened'), 'success')
|
||||
else
|
||||
QBCore.Functions.Kick(source, 'You don\'t have permissions for this..', nil, nil)
|
||||
end
|
||||
@@ -152,7 +155,7 @@ end, 'admin')
|
||||
|
||||
QBCore.Commands.Add('closeserver', 'Close the server for people without permissions (Admin Only)', { { name = 'reason', help = 'Reason for closing it (optional)' } }, false, function(source, args)
|
||||
if QBCore.Config.Server.Closed then
|
||||
TriggerClientEvent('QBCore:Notify', source, 'The server is already closed', 'error')
|
||||
TriggerClientEvent('QBCore:Notify', source, Lang:t('error.server_already_closed'), 'error')
|
||||
return
|
||||
end
|
||||
if QBCore.Functions.HasPermission(source, 'admin') then
|
||||
@@ -164,6 +167,7 @@ QBCore.Commands.Add('closeserver', 'Close the server for people without permissi
|
||||
QBCore.Functions.Kick(k, reason, nil, nil)
|
||||
end
|
||||
end
|
||||
TriggerClientEvent('QBCore:Notify', source, Lang:t('success.server_closed'), 'success')
|
||||
else
|
||||
QBCore.Functions.Kick(source, 'You don\'t have permissions for this..', nil, nil)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user