diff --git a/fxmanifest.lua b/fxmanifest.lua index 6f71174..eea0b48 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,4 +1,4 @@ -name "Jim_RedBridge" +name "Jim_Bridge" author "Jimathy" version "2.0" description "Framework Bridge By Jimathy" diff --git a/shared/_loaders.lua b/shared/_loaders.lua index 20d1fc4..04c6987 100644 --- a/shared/_loaders.lua +++ b/shared/_loaders.lua @@ -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 diff --git a/shared/callback.lua b/shared/callback.lua index 0c1ac2c..f0cbf46 100644 --- a/shared/callback.lua +++ b/shared/callback.lua @@ -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 diff --git a/shared/coreloader.lua b/shared/coreloader.lua index b81a659..aea7af7 100644 --- a/shared/coreloader.lua +++ b/shared/coreloader.lua @@ -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 \ No newline at end of file diff --git a/starter.lua b/starter.lua index 076043a..fda1a54 100644 --- a/starter.lua +++ b/starter.lua @@ -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', diff --git a/version.txt b/version.txt index 6609db5..415b19f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.2 +2.0 \ No newline at end of file