Used booleans instead of promise

This commit is contained in:
Kr3mu
2025-07-29 15:46:59 +02:00
parent 19e697b211
commit 01a5703c50
2 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ Core.PickupId = 0
Core.PlayerFunctionOverrides = {}
Core.DatabaseConnected = false
Core.playersByIdentifier = {}
Core.JobsLoaded = promise:new()
Core.JobsLoaded = false
---@type table<string, CVehicleData>
Core.vehicles = {}
+4 -6
View File
@@ -505,9 +505,7 @@ end
---@return nil
function ESX.RefreshJobs()
if Core.JobsLoaded.value then
Core.JobsLoaded = promise:new()
end
Core.JobsLoaded = false
local Jobs = {}
local jobs = MySQL.query.await("SELECT * FROM jobs")
@@ -542,7 +540,7 @@ function ESX.RefreshJobs()
end
TriggerEvent("esx:jobsLoaded")
Core.JobsLoaded:resolve(true)
Core.JobsLoaded = true
end
---@param item string
@@ -602,7 +600,7 @@ end
---@return table
function ESX.GetJobs()
while not Core.JobsLoaded.value do
while not Core.JobsLoaded do
print("Waiting for ESX Jobs to Load")
Citizen.Wait(200)
end
@@ -773,7 +771,7 @@ end
---@param grade string
---@return boolean
function ESX.DoesJobExist(job, grade)
while not Core.JobsLoaded.value do
while not Core.JobsLoaded do
print("Waiting for ESX Jobs to Load")
Citizen.Wait(200)
end