mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 06:46:04 +01:00
i hate github
This commit is contained in:
61
wrapper.lua
61
wrapper.lua
@@ -26,8 +26,9 @@ for k, v in pairs(Exports) do
|
|||||||
if GetResourceState(v):find("start") then print("^6Bridge^7: '^3"..v.."^7' ^2export found ^7") end
|
if GetResourceState(v):find("start") then print("^6Bridge^7: '^3"..v.."^7' ^2export found ^7") end
|
||||||
end
|
end
|
||||||
|
|
||||||
--local loadItems = function()
|
local itemResource, vehResource, jobResource = "", "", ""
|
||||||
local itemResource = ""
|
|
||||||
|
-- Load item lists
|
||||||
if GetResourceState(OXInv):find("start") then itemResource = OXInv
|
if GetResourceState(OXInv):find("start") then itemResource = OXInv
|
||||||
Items = exports[OXInv]:Items()
|
Items = exports[OXInv]:Items()
|
||||||
for k, v in pairs(Items) do
|
for k, v in pairs(Items) do
|
||||||
@@ -39,12 +40,13 @@ end
|
|||||||
Items[k].hunger = v.client and v.client.hunger or nil
|
Items[k].hunger = v.client and v.client.hunger or nil
|
||||||
Items[k].thirst = v.client and v.client.thirst or nil
|
Items[k].thirst = v.client and v.client.thirst or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif GetResourceState(QBExport):find("start") then itemResource = QBExport
|
elseif GetResourceState(QBExport):find("start") then itemResource = QBExport
|
||||||
Core = Core or exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
Items = Core and Core.Shared.Items or nil
|
Items = Core and Core.Shared.Items or nil
|
||||||
|
|
||||||
elseif GetResourceState(ESXExport):find("start") then itemResource = ESXExport
|
elseif GetResourceState(ESXExport):find("start") then itemResource = ESXExport
|
||||||
ESX = exports[ESXExport]:getSharedObject()
|
ESX = exports[ESXExport]:getSharedObject()
|
||||||
while not ESX do Wait(0) end
|
|
||||||
Items = ESX and ESX.Items or nil
|
Items = ESX and ESX.Items or nil
|
||||||
end
|
end
|
||||||
if not Items then
|
if not Items then
|
||||||
@@ -52,10 +54,8 @@ end
|
|||||||
else
|
else
|
||||||
print("^6Bridge^7: ^2Loading ^6"..countTable(Items).." ^3Items^2 from ^7" .. itemResource)
|
print("^6Bridge^7: ^2Loading ^6"..countTable(Items).." ^3Items^2 from ^7" .. itemResource)
|
||||||
end
|
end
|
||||||
--end
|
|
||||||
|
|
||||||
--local loadVehicles = function()
|
-- Load Vehicles
|
||||||
local vehResource = ""
|
|
||||||
if GetResourceState(QBXExport):find("start") or GetResourceState(QBExport):find("start") then vehResource = QBExport
|
if GetResourceState(QBXExport):find("start") or GetResourceState(QBExport):find("start") then vehResource = QBExport
|
||||||
Core = Core or exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
if GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
if GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then
|
||||||
@@ -64,21 +64,25 @@ end
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
Vehicles = Core and Core.Shared.Vehicles
|
Vehicles = Core and Core.Shared.Vehicles
|
||||||
elseif GetResourceState(OXCoreExport):find("start") then vehResource = OXCoreExport
|
print("^6Bridge^7: ^2Loading ^6"..countTable(Vehicles).." ^3Vehicles^2 from ^7"..QBExport)
|
||||||
|
elseif GetResourceState(OXCoreExport):find("start") then
|
||||||
Vehicles = {}
|
Vehicles = {}
|
||||||
for k, v in pairs(Ox.GetVehicleData()) do
|
for k, v in pairs(Ox.GetVehicleData()) do
|
||||||
Vehicles[k] = { model = k, price = v.price, name = v.name, brand = v.make }
|
Vehicles[k] = { model = k, price = v.price, name = v.name, brand = v.make }
|
||||||
end
|
end
|
||||||
elseif GetResourceState(ESXExport):find("start") then vehResource = ESXExport
|
print("^6Bridge^7: ^2Loading ^6"..countTable(Vehicles).." ^3Vehicles^2 from ^7"..OXCoreExport)
|
||||||
ESX = exports[ESXExport]:getSharedObject()
|
elseif GetResourceState(ESXExport):find("start") then
|
||||||
while not ESX do Wait(0) end
|
print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..ESXExport)
|
||||||
|
--print("^6Bridge^7: ^2Loading ^6"..countTable(Vehicles).." ^3Vehicles^2 from ^7"..ESXExport)
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
if IsDuplicityVersion() then
|
if IsDuplicityVersion() then
|
||||||
createCallback(GetCurrentResourceName()..":getVehiclesPrices", function(source)
|
createCallback(GetCurrentResourceName()..":getVehiclesPrices", function(source)
|
||||||
Vehicles = MySQL.query.await('SELECT model, price, name FROM vehicles')
|
Vehicles = MySQL.query.await('SELECT model, price, name FROM vehicles')
|
||||||
|
print("^6Bridge^7: ^3Found ^6"..countTable(Vehicles).." ^3Vehicles^2 from ^7"..ESXExport)
|
||||||
return Vehicles
|
return Vehicles
|
||||||
end)
|
end)
|
||||||
else
|
end
|
||||||
|
if not IsDuplicityVersion() then
|
||||||
local TempVehicles = triggerCallback(GetCurrentResourceName()..":getVehiclesPrices")
|
local TempVehicles = triggerCallback(GetCurrentResourceName()..":getVehiclesPrices")
|
||||||
for _, v in pairs(TempVehicles) do
|
for _, v in pairs(TempVehicles) do
|
||||||
Vehicles = Vehicles or {}
|
Vehicles = Vehicles or {}
|
||||||
@@ -86,16 +90,11 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
|
||||||
local timeout = 5000 while not Vehicles and timeout > 0 do timeout -=1 Wait(0) end
|
|
||||||
if not Vehicles then
|
|
||||||
print("^4ERROR^7: ^2No Vehicle info detected ^7- ^2Check ^3exports^1.^2lua^7")
|
|
||||||
else
|
else
|
||||||
print("^6Bridge^7: ^2Loading ^6"..countTable(Vehicles).." ^3Vehicles^2 from ^7"..vehResource)
|
print("^4ERROR^7: ^2No Vehicle info detected ^7- ^2Check ^3exports^1.^2lua^7")
|
||||||
end
|
end
|
||||||
--end
|
|
||||||
|
|
||||||
--local loadJobs = function()
|
-- Load Jobs
|
||||||
local jobResource = ""
|
local jobResource = ""
|
||||||
if GetResourceState(QBXExport):find("start") then jobResource = QBXExport
|
if GetResourceState(QBXExport):find("start") then jobResource = QBXExport
|
||||||
Core = Core or exports[QBExport]:GetCoreObject()
|
Core = Core or exports[QBExport]:GetCoreObject()
|
||||||
@@ -124,10 +123,9 @@ end
|
|||||||
RegisterNetEvent('QBCore:Client:UpdateObject', function() Core = Core or exports[QBExport]:GetCoreObject() end)
|
RegisterNetEvent('QBCore:Client:UpdateObject', function() Core = Core or exports[QBExport]:GetCoreObject() end)
|
||||||
Jobs, Gangs = Core.Shared.Jobs, Core.Shared.Gangs
|
Jobs, Gangs = Core.Shared.Jobs, Core.Shared.Gangs
|
||||||
|
|
||||||
elseif GetResourceState(ESXExport):find("start") then jobResource = ESXExport
|
elseif GetResourceState(ESXExport):find("start") then
|
||||||
|
print("^6Bridge^7: ^2Loading ^3Jobs^7/^3Gangs^2 from ^7"..ESXExport)
|
||||||
ESX = exports[ESXExport]:getSharedObject()
|
ESX = exports[ESXExport]:getSharedObject()
|
||||||
while not ESX do Wait(0) end
|
|
||||||
CreateThread(function()
|
|
||||||
if IsDuplicityVersion() then
|
if IsDuplicityVersion() then
|
||||||
Jobs = ESX.GetJobs()
|
Jobs = ESX.GetJobs()
|
||||||
for k, v in pairs(Jobs) do
|
for k, v in pairs(Jobs) do
|
||||||
@@ -135,24 +133,23 @@ end
|
|||||||
Jobs[k].grades[tostring(count)].isBoss = true
|
Jobs[k].grades[tostring(count)].isBoss = true
|
||||||
end
|
end
|
||||||
Gangs = Jobs
|
Gangs = Jobs
|
||||||
createCallback(GetCurrentResourceName()..":getJobs", function(source) return Jobs end)
|
end
|
||||||
else
|
CreateThread(function()
|
||||||
|
while not ESX do Wait(0) end
|
||||||
|
if IsDuplicityVersion() then
|
||||||
|
createCallback(GetCurrentResourceName()..":getJobs", function(source)
|
||||||
|
return Jobs
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if not IsDuplicityVersion() then
|
||||||
Jobs = triggerCallback(GetCurrentResourceName()..":getJobs")
|
Jobs = triggerCallback(GetCurrentResourceName()..":getJobs")
|
||||||
Gangs = Jobs
|
Gangs = Jobs
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
local timeout = 5000 while not Jobs and timeout > 0 do timeout -=1 Wait(0) end
|
if not GetResourceState(ESXExport):find("start") and Jobs then
|
||||||
if Jobs then
|
|
||||||
print("^6Bridge^7: ^2Loading ^6"..countTable(Jobs).." ^3Jobs^2 from ^7"..jobResource, "^6Bridge^7: ^2Loading ^6"..countTable(Gangs).." ^3Gangs^2 from ^7"..jobResource)
|
print("^6Bridge^7: ^2Loading ^6"..countTable(Jobs).." ^3Jobs^2 from ^7"..jobResource, "^6Bridge^7: ^2Loading ^6"..countTable(Gangs).." ^3Gangs^2 from ^7"..jobResource)
|
||||||
else
|
|
||||||
print("^4ERROR^7: ^2No Job/Gang info detected ^7- ^2Check ^3exports^1.^2lua^7")
|
|
||||||
end
|
end
|
||||||
--end
|
|
||||||
|
|
||||||
--loadItems()
|
|
||||||
--loadVehicles()
|
|
||||||
--loadJobs()
|
|
||||||
|
|
||||||
function makeBossRoles(role)
|
function makeBossRoles(role)
|
||||||
local boss = {}
|
local boss = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user