fix: replace boolean logic with math.max for tempCarryTable aggregation

Replaced the old `and/or` logic in the recipe ingredient loop with `math.max`
to ensure tempCarryTable[k] always stores numeric values instead of booleans.
This prevents "attempt to compare boolean with number" errors during crafting
data aggregation.
This commit is contained in:
RuksH4n
2025-11-07 21:59:18 +05:30
committed by GitHub
parent 61aae4fa92
commit 9a57f852b1

View File

@@ -121,7 +121,7 @@ function craftingMenu(data)
for k, v in pairs(Recipes[i]) do
if not excludeKeys[k] then
if not Recipes[i].amount then Recipes[i].amount = 1 end
tempCarryTable[k] = tempCarryTable[k] and (tempCarryTable[k] < Recipes[i].amount) or Recipes[i].amount
tempCarryTable[k] = math.max(tempCarryTable[k] or 0, Recipes[i].amount)
end
end
end
@@ -596,4 +596,5 @@ RegisterNetEvent(getScript()..":Crafting:GetItem", function(ItemMake, craftable,
-- Optionally, add experience here:
-- for example:
-- if isStarted("core_skills") then exports["core_skills"]:AddExperience(src, 2) end
end)