Only grant ace permission if needed (even if fivem devs changed the behaviour)

This commit is contained in:
ElPumpo
2020-04-24 15:23:25 +02:00
parent cb9038c911
commit 7d7f72082a
+6 -2
View File
@@ -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