From 7d7f72082a9a56f8c49d88c9134b30761485b5f3 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Fri, 24 Apr 2020 15:23:25 +0200 Subject: [PATCH] Only grant ace permission if needed (even if fivem devs changed the behaviour) --- server/main.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index 6434e6ec..2d82d2fe 100644 --- a/server/main.lua +++ b/server/main.lua @@ -1,8 +1,7 @@ Citizen.CreateThread(function() SetMapName('San Andreas') SetGameType('Roleplay') - local resourcesStopped = {} - ExecuteCommand('add_ace resource.es_extended command.stop allow') + local resourcesStopped, isAceGranted = {}, false for resourceName,reason in pairs(Config.IncompatibleResourcesToStop) do local status = GetResourceState(resourceName) @@ -12,6 +11,11 @@ Citizen.CreateThread(function() Citizen.Wait(100) end + if not isAceGranted then + ExecuteCommand('add_ace resource.es_extended command.stop allow') + isAceGranted = true + end + ExecuteCommand(('stop %s'):format(resourceName)) resourcesStopped[resourceName] = reason end