Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wrapper.lua #30

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions wrapper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,27 +124,35 @@ elseif GetResourceState(QBExport):find("start") then jobResource = QBExport
Jobs, Gangs = Core.Shared.Jobs, Core.Shared.Gangs

elseif GetResourceState(ESXExport):find("start") then
print("^6Bridge^7: ^2Loading ^3Jobs^7/^3Gangs^2 from ^7"..ESXExport)
jobResource = ESXExport
ESX = exports[ESXExport]:getSharedObject()
if IsDuplicityVersion() then
Jobs = ESX.GetJobs()
for k, v in pairs(Jobs) do
local count = countTable(Jobs[k].grades)-1
Jobs[k].grades[tostring(count)].isBoss = true
end
Gangs = Jobs
end

CreateThread(function()
while not ESX do Wait(0) end
if IsDuplicityVersion() then
Jobs = ESX.GetJobs()

while Jobs == nil or not next(Jobs) do
print("^6Bridge^7: ^2Waiting for ^3Jobs^2 to be loaded...")
Jobs = ESX.GetJobs()
Wait(500)
end

for k, v in pairs(Jobs) do
local count = countTable(Jobs[k].grades) - 1
Jobs[k].grades[tostring(count)].isBoss = true
end

Gangs = Jobs
createCallback(GetCurrentResourceName()..":getJobs", function(source)
return Jobs
end)
end
if not IsDuplicityVersion() then

else
Jobs = triggerCallback(GetCurrentResourceName()..":getJobs")
Gangs = Jobs
end

print("^6Bridge^7: ^2Loading ^6"..countTable(Jobs).." ^3Jobs^2 from ^7"..jobResource, "^6Bridge^7: ^2Loading ^6"..countTable(Gangs).." ^3Gangs^2 from ^7"..jobResource)
end)
end
if not GetResourceState(ESXExport):find("start") and Jobs then
Expand Down