From 1079eb0b40b929df94208cd716b196c1af9acdb4 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 21 May 2021 19:35:57 +1000 Subject: [PATCH] fix(server): Try updating ESX.Jobs after the first player joins Should resolve the issue with slow queries preventing proper setup --- server/main.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/main.lua b/server/main.lua index a39b9755..5c3e72d6 100644 --- a/server/main.lua +++ b/server/main.lua @@ -5,6 +5,9 @@ if ESX.GetConfig().Multichar then Config.prefix = 'char' SetupCharacters = function(playerId) + if next(ESX.Jobs) == nil then + ESX.Jobs = exports['es_extended']:getSharedObject().Jobs + end local identifier = Config.prefix..'%:'..ESX.GetIdentifier(playerId) MySQL.Async.fetchAll("SELECT `identifier`, `accounts`, `job`, `job_grade`, `firstname`, `lastname`, `dateofbirth`, `sex`, `skin` FROM `users` WHERE `identifier` LIKE @identifier", { ['@identifier'] = identifier @@ -59,10 +62,6 @@ if ESX.GetConfig().Multichar then end end) end) - while next(ESX.Jobs) == nil do - Citizen.Wait(200) - ESX.Jobs = exports['es_extended']:getSharedObject().Jobs - end end) RegisterServerEvent("esx_multicharacter:SetupCharacters")