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