From 2bf04f69cf8bf51f8b210745e60866182a553ba0 Mon Sep 17 00:00:00 2001 From: Solareon <769465+solareon@users.noreply.github.com> Date: Mon, 22 Jan 2024 12:50:03 -0700 Subject: [PATCH 1/2] fix: hasjob Fixes broken crafting because the wrapper function is called hasJob with a capital J while the variable is called hasjob --- crafting.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crafting.lua b/crafting.lua index 0b9c381..34f229f 100644 --- a/crafting.lua +++ b/crafting.lua @@ -43,7 +43,7 @@ function craftingMenu(data) local hasjob = false if Recipes[i].job then hasjob = false for l, b in pairs(Recipes[i].job) do hasjob = hasJob(l, nil, b) - if hasJob == true then break end + if hasjob == true then break end end end local setheader, settext = "", "" @@ -434,4 +434,4 @@ function stashhasItem(stashItems, items, amount) end for k, v in pairs(hasTable) do if v.hasItem == false then return false, hasTable end end return true, hasTable -end \ No newline at end of file +end From e541201a08d317065e4f77a7451b79d6e87bb092 Mon Sep 17 00:00:00 2001 From: solareon <769465+solareon@users.noreply.github.com> Date: Mon, 22 Jan 2024 22:39:16 +0000 Subject: [PATCH 2/2] fix: skip amount and job tables --- crafting.lua | 68 +++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/crafting.lua b/crafting.lua index 34f229f..d909010 100644 --- a/crafting.lua +++ b/crafting.lua @@ -139,40 +139,42 @@ function makeItem(data) startTempCam(cam) for i = 1, amount do - for _, v in pairs(data.craft) do - if type(v) == "table" then - for l, b in pairs(v) do - if crafting and progressBar({ - label = "Using "..b.." "..Items[l].label, - time = 1000, - cancel = true, - dict = 'pickup_object', - anim = "putdown_low", - flag = 48, - icon = l, - }) then - --TriggerEvent('inventory:client:ItemBox', Items[l], "use", b) -- Show item box for each item - else - crafted = false - crafting = false - break + for k, v in pairs(data.craft) do + if k ~= "amount" and k ~= "job" then + if type(v) == "table" then + for l, b in pairs(v) do + if crafting and progressBar({ + label = "Using "..b.." "..Items[l].label, + time = 1000, + cancel = true, + dict = 'pickup_object', + anim = "putdown_low", + flag = 48, + icon = l, + }) then + --TriggerEvent('inventory:client:ItemBox', Items[l], "use", b) -- Show item box for each item + else + crafted = false + crafting = false + break + end + Wait(200) end - Wait(200) - end - if crafted then - if crafting and progressBar({ - label = bartext..Items[data.item].label, - time = bartime, - cancel = true, - dict = animDict, - anim = anim, - flag = 8, - icon = data.item, - }) then - TriggerServerEvent(GetCurrentResourceName()..":Crafting:GetItem", data.item, data.craft, data.stashName) - else - crafting = false - break + if crafted then + if crafting and progressBar({ + label = bartext..Items[data.item].label, + time = bartime, + cancel = true, + dict = animDict, + anim = anim, + flag = 8, + icon = data.item, + }) then + TriggerServerEvent(GetCurrentResourceName()..":Crafting:GetItem", data.item, data.craft, data.stashName) + else + crafting = false + break + end end end end