From 181c480ba6c8d1528a37775e64ed50007c6d7249 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 18 Jan 2024 15:06:20 +0000 Subject: [PATCH 1/8] return duty check for hasJob --- wrapper.lua | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/wrapper.lua b/wrapper.lua index d533173..216d0be 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -560,12 +560,7 @@ if not GetResourceState(OXTargetExport):find("start") and not GetResourceState(Q local pedCoords = GetEntityCoords(PlayerPedId()) for k, v in pairs (TextTargets) do if #(pedCoords - v.coords) <= v.dist then - DrawText3D( - v.coords.x, - v.coords.y, - v.coords.z + 1.0, - v.buttontext - ) + DrawText3D(v.coords.x, v.coords.y, v.coords.z + 1.0, v.buttontext) for i = 1, #v.options do if IsControlJustPressed(0, v.options[i].key) then if v.options[i].onSelect then v.options[i].onSelect() end @@ -740,7 +735,6 @@ function onPlayerLoaded(func) end end - -- INPUT -- function createInput(title, opts) local dialog = nil @@ -990,7 +984,7 @@ function createUseableItem(item, funct) end end -function hasJob(job, source, grade) local hasJob = false +function hasJob(job, source, grade) local hasJob, duty = false, true if source then local src = tonumber(source) if GetResourceState(ESXExport):find("start") then @@ -1012,16 +1006,19 @@ function hasJob(job, source, grade) local hasJob = false elseif GetResourceState(QBXExport):find("start") then local jobinfo = exports[QBXExport]:GetPlayer(src).PlayerData.job if jobinfo.name == job then hasJob = true + duty = exports[QBXExport]:GetPlayer(src).PlayerData.job.onduty if grade and not (grade <= jobinfo.grade.level) then hasJob = false end end local ganginfo = exports[QBXExport]:GetPlayer(src).PlayerData.gang if ganginfo.name == job then hasJob = true if grade and not (grade <= ganginfo.grade.level) then hasJob = false end end + elseif GetResourceState(QBExport):find("start") and not GetResourceState(QBXExport):find("start") then if Core.Functions.GetPlayer then -- support older qb-core functions local jobinfo = Core.Functions.GetPlayer(src).PlayerData.job if jobinfo.name == job then hasJob = true + duty = Core.Functions.GetPlayer(src).PlayerData.job.onduty if grade and not (grade <= jobinfo.grade.level) then hasJob = false end end local ganginfo = Core.Functions.GetPlayer(src).PlayerData.gang @@ -1031,6 +1028,7 @@ function hasJob(job, source, grade) local hasJob = false else -- support newer qb-core exports local jobinfo = exports[QBExport]:GetPlayer(src).PlayerData.job if jobinfo.name == job then hasJob = true + duty = exports[QBExport]:GetPlayer(src).PlayerData.job.onduty if grade and not (grade <= jobinfo.grade.level) then hasJob = false end end local ganginfo = exports[QBExport]:GetPlayer(src).PlayerData.gang @@ -1059,6 +1057,7 @@ function hasJob(job, source, grade) local hasJob = false elseif GetResourceState(QBXExport):find("start") then local jobinfo = QBX.PlayerData.job if jobinfo.name == job then hasJob = true + duty = QBX.PlayerData.job.onduty if grade and not (grade <= jobinfo.grade.level) then hasJob = false end end local ganginfo = QBX.PlayerData.gang @@ -1071,8 +1070,8 @@ function hasJob(job, source, grade) local hasJob = false info = PlayerData end) local jobinfo = info.job - if jobinfo.name == job then - hasJob = true + if jobinfo.name == job then hasJob = true + duty = jobinfo.onduty if grade and not (grade <= jobinfo.grade.level) then hasJob = false end end local ganginfo = info.gang @@ -1084,7 +1083,7 @@ function hasJob(job, source, grade) local hasJob = false print("^4ERROR^7: ^2No Core detected for hasJob() ^7- ^2Check ^3exports^1.^2lua^7") end end - return hasJob + return hasJob, duty end function getPlayer(source) local Player = {} @@ -1214,4 +1213,4 @@ function registerStash(name, label) exports[QSInv]:RegisterStash(name, 50, 4000000) end end --- IN NO WAY PERFECT -- +-- IN NO WAY PERFECT -- \ No newline at end of file From bc5aadc3949071dc26b1c9d695e8cd2448f8940a Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 18 Jan 2024 15:14:38 +0000 Subject: [PATCH 2/8] add export error check to stashRemoveItem --- crafting.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crafting.lua b/crafting.lua index b39dd5e..27bf336 100644 --- a/crafting.lua +++ b/crafting.lua @@ -456,7 +456,7 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and if Config.System.Debug then print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'") end - else + elseif GetResourceState(QBInv):find("start") then for k, v in pairs(items) do for l in pairs(stashItems) do if stashItems[l].name == k then @@ -478,6 +478,8 @@ function stashRemoveItem(stashItems, stashName, items) local amount = amount and print("^6Bridge^7: ^3saveStash^7: ^2Saving ^3QB^2 stash ^7'^6"..stashName.."^7'") end MySQL.Async.insert('INSERT INTO stashitems (stash, items) VALUES (:stash, :items) ON DUPLICATE KEY UPDATE items = :items', { ['stash'] = stashName, ['items'] = json.encode(stashItems) }) + else + print("^4ERROR^7: ^2No Inventory detected ^7- ^2Check ^3exports^1.^2lua^7") end end RegisterNetEvent(GetCurrentResourceName()..":server:stashRemoveItem", stashRemoveItem) From 35202f7000d954e9b982f8e2c54535058fd7be24 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 18 Jan 2024 15:33:51 +0000 Subject: [PATCH 3/8] add fix for recipes having no final amount added --- crafting.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/crafting.lua b/crafting.lua index 27bf336..80b9ac8 100644 --- a/crafting.lua +++ b/crafting.lua @@ -39,6 +39,7 @@ function craftingMenu(data) local hasjob = false for i = 1, #Recipes do for k, v in pairs(Recipes[i]) do if k ~= "amount" and k ~= "job" and k ~= "gang" then + if not Recipes[i]["amount"] then Recipes[i]["amount"] = 1 end if Recipes[i].job then hasjob = false for l, b in pairs(Recipes[i].job) do hasjob = hasJob(l, nil, b) From d82366b59f743f03be6791e17d609ad203507369 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 18 Jan 2024 15:38:28 +0000 Subject: [PATCH 4/8] version bump --- fxmanifest.lua | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index e17608b..fb54952 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,6 +1,6 @@ name "Jim_Bridge" author "Jimathy" -version "1.0" +version "1.0.1" description "Framework Bridge By Jimathy" fx_version "cerulean" game "gta5" diff --git a/version.txt b/version.txt index 9f8e9b6..7f20734 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0 \ No newline at end of file +1.0.1 \ No newline at end of file From 93d07549353fa446d759ce584ae3120fd557c555 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 18 Jan 2024 17:41:28 +0000 Subject: [PATCH 5/8] Make qbx use correct export for getCoreObject This should be fine as qbox takes over the export but just to be sure --- wrapper.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrapper.lua b/wrapper.lua index 216d0be..9022169 100644 --- a/wrapper.lua +++ b/wrapper.lua @@ -60,7 +60,7 @@ end -- Load Vehicles if GetResourceState(QBXExport):find("start") then - Core = Core or exports[QBExport]:GetCoreObject() + Core = Core or exports[QBXExport]:GetCoreObject() print("^6Bridge^7: ^2Loading ^3Vehicles^2 from ^7"..QBXExport) Vehicles = exports[QBXExport]:GetVehiclesByHash() elseif GetResourceState(QBExport):find("start") then @@ -1213,4 +1213,4 @@ function registerStash(name, label) exports[QSInv]:RegisterStash(name, 50, 4000000) end end --- IN NO WAY PERFECT -- \ No newline at end of file +-- IN NO WAY PERFECT -- From 56ccb43c2be9450f1a06129e762a2d5dc18e3e4a Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 18 Jan 2024 17:44:25 +0000 Subject: [PATCH 6/8] Resolve merge conflict --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 7f20734..7dea76e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.1 \ No newline at end of file +1.0.1 From 5fe0ab881587355191d3ac1cd1bf6051c8a56515 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 18 Jan 2024 17:48:03 +0000 Subject: [PATCH 7/8] Revert "Resolve merge conflict" This reverts commit 56ccb43c2be9450f1a06129e762a2d5dc18e3e4a. --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 7dea76e..7f20734 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.1 +1.0.1 \ No newline at end of file From f550479298279eb3846c30e3de6c84f6d517b4a1 Mon Sep 17 00:00:00 2001 From: Jim Shield Date: Thu, 18 Jan 2024 17:48:14 +0000 Subject: [PATCH 8/8] Revert "version bump" This reverts commit d82366b59f743f03be6791e17d609ad203507369. --- fxmanifest.lua | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fxmanifest.lua b/fxmanifest.lua index fb54952..e17608b 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,6 +1,6 @@ name "Jim_Bridge" author "Jimathy" -version "1.0.1" +version "1.0" description "Framework Bridge By Jimathy" fx_version "cerulean" game "gta5" diff --git a/version.txt b/version.txt index 7f20734..9f8e9b6 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.1 \ No newline at end of file +1.0 \ No newline at end of file