From a6b58866f88757736a410a8124fc16de69629676 Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Sun, 17 Sep 2023 15:59:43 +0200 Subject: [PATCH] fix stop do not use resources --- [core]/es_extended/server/main.lua | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/[core]/es_extended/server/main.lua b/[core]/es_extended/server/main.lua index 118b88ed..4dd1dd79 100644 --- a/[core]/es_extended/server/main.lua +++ b/[core]/es_extended/server/main.lua @@ -748,16 +748,20 @@ local DoNotUse = { ['default_spawnpoint'] = true, } +AddEventHandler('onResourceStart', function(key) + if DoNotUse[string.lower(key)] then + while GetResourceState(key) ~= 'started' do + Wait() + end + + StopResource(key) + print(("[^1ERROR^7] WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5%s^7"):format(key)) + end +end) + for key in pairs(DoNotUse) do if GetResourceState(key) == 'started' or GetResourceState(key) == 'starting' then - StopResource(key) + StopResource(key) print(("[^1ERROR^7] WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5%s^7"):format(key)) end end - -AddEventHandler('onResourceStart', function(key) - if DoNotUse[string.lower(key)] then - StopResource(key) - print(("[^1ERROR^7] WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5%s^7"):format(key)) - end -end)