mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 06:46:04 +01:00
attempt to fix support of ox_core job gathering
This commit is contained in:
@@ -209,23 +209,36 @@ if isStarted(QBXExport) then
|
|||||||
Jobs, Gangs = exports[QBXExport]:GetJobs(), exports[QBXExport]:GetGangs()
|
Jobs, Gangs = exports[QBXExport]:GetJobs(), exports[QBXExport]:GetGangs()
|
||||||
|
|
||||||
elseif isStarted(OXCoreExport) then
|
elseif isStarted(OXCoreExport) then
|
||||||
jobResource = OXExport
|
jobResource = OXCoreExport
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
if isServer() then
|
if isServer() then
|
||||||
|
Jobs = {}
|
||||||
createCallback(getScript()..":getOxGroups", function(source)
|
createCallback(getScript()..":getOxGroups", function(source)
|
||||||
Jobs = MySQL.query.await('SELECT * FROM `ox_groups`')
|
|
||||||
return Jobs
|
return Jobs
|
||||||
end)
|
end)
|
||||||
else
|
local tempJobs = MySQL.query.await('SELECT * FROM `ox_groups`')
|
||||||
local TempJobs = triggerCallback(getScript()..":getOxGroups")
|
local tempGrades = MySQL.query.await('SELECT * FROM `ox_group_grades`')
|
||||||
Jobs = {}
|
-- Index all grades by group
|
||||||
for k, v in pairs(TempJobs) do
|
local gradeMap = {}
|
||||||
local grades = {}
|
for _, grade in pairs(tempGrades) do
|
||||||
--for i = 1, #v.grades do
|
gradeMap[grade.group] = gradeMap[grade.group] or {}
|
||||||
-- grades[i] = { name = v.grades[i], isboss = (i == #v.grades) }
|
gradeMap[grade.group][grade.grade] = {
|
||||||
--end
|
name = grade.label
|
||||||
Jobs[v.name] = { label = v.label, grades = grades }
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Process jobs and attach grades
|
||||||
|
for _, job in pairs(tempJobs) do
|
||||||
|
Jobs[job.name] = {
|
||||||
|
label = job.label,
|
||||||
|
grades = gradeMap[job.name] or {}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Copy to Gangs
|
||||||
|
Gangs = Jobs
|
||||||
|
else
|
||||||
|
Jobs = triggerCallback(getScript()..":getOxGroups")
|
||||||
Gangs = Jobs
|
Gangs = Jobs
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -302,7 +315,7 @@ elseif isStarted(RSGExport) then
|
|||||||
end
|
end
|
||||||
|
|
||||||
if jobResource == nil then
|
if jobResource == nil then
|
||||||
print("^4ERROR^7: ^2No Vehicle info detected ^7- ^2Check ^3starter^1.^2lua^7")
|
print("^4ERROR^7: ^2No Job info detected ^7- ^2Check ^3starter^1.^2lua^7")
|
||||||
else
|
else
|
||||||
while not Jobs do Wait(1000) end
|
while not Jobs do Wait(1000) 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)
|
||||||
|
|||||||
Reference in New Issue
Block a user