automaticly stop resources that are breaking esx

This commit is contained in:
Arctos2win
2023-08-23 01:37:25 +02:00
committed by GitHub
parent 9bf7e1248b
commit ce96e4ab20
2 changed files with 25 additions and 17 deletions
-17
View File
@@ -692,23 +692,6 @@ ESX.RegisterClientCallback("esx:GetVehicleType", function(cb, model)
cb(ESX.GetVehicleType(model))
end)
local DoNotUse = {
'essentialmode',
'es_admin2',
'basic-gamemode',
'mapmanager',
'fivem-map-skater',
'fivem-map-hipster',
'qb-core',
'default_spawnpoint',
}
for i = 1, #DoNotUse do
if GetResourceState(DoNotUse[i]) == 'started' or GetResourceState(DoNotUse[i]) == 'starting' then
print("[^1ERROR^7] YOU ARE USING A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5" .. DoNotUse[i] .. "^7")
end
end
AddStateBagChangeHandler('metadata', 'player:' .. tostring(GetPlayerServerId(PlayerId())), function(_, key, val)
ESX.SetPlayerData(key, val)
end)
+25
View File
@@ -701,3 +701,28 @@ end)
AddEventHandler('txAdmin:events:serverShuttingDown', function()
Core.SavePlayers()
end)
local DoNotUse = {
['essentialmode'] = true,
['es_admin2'] = true,
['basic-gamemode'] = true,
['mapmanager'] = true,
['fivem-map-skater'] = true,
['fivem-map-hipster'] = true,
['qb-core'] = true,
['default_spawnpoint'] = true,
}
for key in pairs(DoNotUse) do
if GetResourceState(key) == 'started' or GetResourceState(key) == 'starting' then
StopResource(key)
print("[^1ERROR^7] WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5" .. key .. "^7")
end
end
AddEventHandler('onResourceStart', function(resourceName)
if DoNotUse[string.lower(resourceName)] then
StopResource(key)
print("[^1ERROR^7] WE STOPPED A RESOURCE THAT WILL BREAK ^1ESX^7, PLEASE REMOVE ^5" .. resourceName .. "^7")
end
end