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