mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-16 21:46:03 +01:00
hopefully fix esx loading
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name "Jim_RedBridge"
|
||||
name "Jim_Bridge"
|
||||
author "Jimathy"
|
||||
version "2.0"
|
||||
description "Framework Bridge By Jimathy"
|
||||
|
||||
@@ -140,6 +140,7 @@ function waitForLogin()
|
||||
if isStarted(ESXExport) then
|
||||
debugPrint("^6Bridge^7: ^3ESX waitForLogin^7() ^2running^7")
|
||||
while (GetGameTimer() - startTime) < timeout do
|
||||
while not ESX do Wait(100) end
|
||||
local playerData = ESX.GetPlayerData()
|
||||
if playerData and playerData.job then
|
||||
loggedIn = true
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
--- ```
|
||||
function createCallback(callbackName, funct)
|
||||
if isServer() then
|
||||
debugPrint("^6Bridge^7: ^3Registering callback^7:", callbackName)
|
||||
if isStarted(OXLibExport) then
|
||||
lib.callback.register(callbackName, funct)
|
||||
else
|
||||
@@ -49,6 +50,7 @@ end
|
||||
--- ```
|
||||
function triggerCallback(callbackName, ...)
|
||||
local result = nil
|
||||
debugPrint("^6Bridge^7: ^3Triggering callback^7:", callbackName)
|
||||
if isStarted(OXLibExport) then
|
||||
result = lib.callback.await(callbackName, false, ...)
|
||||
elseif isStarted(QBExport) then
|
||||
|
||||
@@ -100,13 +100,11 @@ elseif isStarted(ESXExport) then
|
||||
print("Waiting for ESX")
|
||||
Wait(0)
|
||||
end
|
||||
if isServer() then
|
||||
Items = ESX.GetItems()
|
||||
debugPrint("^6Bridge^7: ^2Loading ^6"..countTable(Items).." ^3Items^2 from ^7"..itemResource)
|
||||
end
|
||||
CreateThread(function()
|
||||
while not ESX do Wait(0) end
|
||||
if isServer() then
|
||||
Items = ESX.GetItems()
|
||||
while not createCallback do Wait(100) end
|
||||
createCallback(getScript()..":getItems", function(source)
|
||||
return Items
|
||||
end)
|
||||
@@ -130,14 +128,14 @@ elseif isStarted(RSGExport) then
|
||||
|
||||
end
|
||||
|
||||
if not isStarted(ESXExport) then
|
||||
if not Items then
|
||||
print("^4ERROR^7: ^2No Core Items detected ^7- ^2Check ^3starter^1.^2lua^7")
|
||||
else
|
||||
debugPrint("^6Bridge^7: ^2Loading ^6"..countTable(Items).." ^3Items^2 from ^7"..itemResource)
|
||||
end
|
||||
if itemResource == nil then
|
||||
print("^4ERROR^7: ^2No Item info detected ^7- ^2Check ^3starter^1.^2lua^7")
|
||||
else
|
||||
while not Items do Wait(100) end
|
||||
debugPrint("^6Bridge^7: ^2Loading ^6"..countTable(Items).." ^3Items^2 from ^7"..itemResource)
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- Loading Vehicles
|
||||
-------------------------------------------------------------
|
||||
@@ -163,13 +161,16 @@ elseif isStarted(OXCoreExport) then
|
||||
elseif isStarted(ESXExport) then
|
||||
CreateThread(function()
|
||||
if isServer() then
|
||||
vehResource = ESXExport
|
||||
createCallback(getScript()..":getVehiclesPrices", function(source)
|
||||
Vehicles = MySQL.query.await('SELECT model, price, name FROM vehicles')
|
||||
vehResource = ESXExport
|
||||
return Vehicles
|
||||
end)
|
||||
Vehicles = MySQL.query.await('SELECT model, price, name FROM vehicles')
|
||||
--jsonPrint(Vehicles)
|
||||
--while not createCallback do print("waiting") Wait(100) end
|
||||
end
|
||||
if not isServer() then
|
||||
--while not triggerCallback do print("waiting") Wait(100) end
|
||||
local TempVehicles = triggerCallback(getScript()..":getVehiclesPrices")
|
||||
for _, v in pairs(TempVehicles) do
|
||||
Vehicles = Vehicles or {}
|
||||
@@ -199,6 +200,7 @@ end
|
||||
if vehResource == nil then
|
||||
print("^4ERROR^7: ^2No Vehicle info detected ^7- ^2Check ^3starter^1.^2lua^7")
|
||||
else
|
||||
while not Vehicles do Wait(100) print("Waiting") end
|
||||
debugPrint("^6Bridge^7: ^2Loading ^6"..countTable(Vehicles).." ^3Vehicles^2 from ^7"..vehResource)
|
||||
end
|
||||
|
||||
@@ -279,7 +281,10 @@ elseif isStarted(RSGExport) then
|
||||
end
|
||||
end
|
||||
|
||||
if not isStarted(ESXExport) and Jobs then
|
||||
if jobResource == nil then
|
||||
print("^4ERROR^7: ^2No Vehicle info detected ^7- ^2Check ^3starter^1.^2lua^7")
|
||||
else
|
||||
while not Jobs do Wait(100) end
|
||||
debugPrint("^6Bridge^7: ^2Loading ^6"..countTable(Jobs).." ^3Jobs^2 from ^7"..jobResource)
|
||||
debugPrint("^6Bridge^7: ^2Loading ^6"..countTable(Gangs).." ^3Gangs^2 from ^7"..jobResource)
|
||||
end
|
||||
end
|
||||
@@ -39,8 +39,8 @@ for _, v in pairs({ -- This is a specific load order
|
||||
'_loaders.lua',
|
||||
|
||||
'_eventDebug.lua',
|
||||
'coreloader.lua', -- needs to be second to load all core related stuff before everything else
|
||||
'callback.lua',
|
||||
'coreloader.lua', -- needs to be second to load all core related stuff before everything else
|
||||
|
||||
'duifunctions.lua',
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.2
|
||||
2.0
|
||||
Reference in New Issue
Block a user