From a9f76791c9033e6d8121b9773bf10fc21e70cea2 Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Fri, 25 Oct 2024 14:57:29 +0100 Subject: [PATCH] refactor: fully remove spawnmanager --- [core]/es_extended/client/common.lua | 4 ++-- [core]/es_extended/client/functions.lua | 5 +++++ [core]/es_extended/fxmanifest.lua | 1 - [core]/esx_multicharacter/client/main.lua | 8 +------- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/[core]/es_extended/client/common.lua b/[core]/es_extended/client/common.lua index 1da1659b..69625133 100644 --- a/[core]/es_extended/client/common.lua +++ b/[core]/es_extended/client/common.lua @@ -1,7 +1,7 @@ Core = {} ESX.PlayerData = {} ESX.playerId = PlayerId() -ESX.serverId = GetPlayerServerId(PlayerId()) +ESX.serverId = GetPlayerServerId(ESX.playerId) ESX.PlayerLoaded = false Core.Input = {} ESX.UI = {} @@ -22,7 +22,7 @@ CreateThread(function() Wait(100) if NetworkIsPlayerActive(ESX.playerId) then - exports.spawnmanager:setAutoSpawn(false) + ESX.DisableSpawnManager() DoScreenFadeOut(0) Wait(500) TriggerServerEvent("esx:onPlayerJoined") diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index 5f4d6447..088e8f2b 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -17,6 +17,11 @@ local function IsResourceFound(resource) return addonResourcesState[resource] or error(('Resource [^5%s^1] is Missing!'):format(resource)) end +function ESX.DisableSpawnManager() + if GetResourceState("spawnmanager") == "started" then + exports.spawnmanager:setAutoSpawn(false) + end +end ---@param items string | table The item(s) to search for ---@param count? boolean Whether to return the count of the item as well diff --git a/[core]/es_extended/fxmanifest.lua b/[core]/es_extended/fxmanifest.lua index 5b5fa2b8..b4b28bf1 100644 --- a/[core]/es_extended/fxmanifest.lua +++ b/[core]/es_extended/fxmanifest.lua @@ -74,5 +74,4 @@ dependencies { '/native:0x6AE51D4B', '/native:0xA61C8FC6', 'oxmysql', - 'spawnmanager', } diff --git a/[core]/esx_multicharacter/client/main.lua b/[core]/esx_multicharacter/client/main.lua index 19eeba8e..04b9a88e 100644 --- a/[core]/esx_multicharacter/client/main.lua +++ b/[core]/esx_multicharacter/client/main.lua @@ -8,19 +8,13 @@ local function AwaitContext() return true end -local function DisableSpawnManager() - if GetResourceState("spawnmanager") == "started" then - exports.spawnmanager:setAutoSpawn(false) - end -end - CreateThread(function() while not ESX.PlayerLoaded do Wait(100) if NetworkIsPlayerActive(ESX.playerId) then - DisableSpawnManager() + ESX.DisableSpawnManager() DoScreenFadeOut(0) local ready = AwaitContext()