From 7ef46dcc14dacc1e10219a8a0e858e60cbc01aa6 Mon Sep 17 00:00:00 2001 From: AlmTech Software Date: Mon, 13 Jan 2020 21:25:26 +0100 Subject: [PATCH] Fixed crafting item removing bug & stuff --- gamemode/engine/lib/server/sv_crafting.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gamemode/engine/lib/server/sv_crafting.lua b/gamemode/engine/lib/server/sv_crafting.lua index faa50f2..ba287e1 100644 --- a/gamemode/engine/lib/server/sv_crafting.lua +++ b/gamemode/engine/lib/server/sv_crafting.lua @@ -57,10 +57,16 @@ function Quantum.Server.Crafting.MakeItem( pl, itemid ) -- get items local slots = Quantum.Server.Inventory.FindItemSlots( pl, reqItem.item, inv ) - + local itemCount = 0 -- loop through all slots and remove them for i, slot in pairs( slots ) do - Quantum.Server.Inventory.RemoveSlotItem( pl, char, slot, reqItem.amount ) + if( itemCount < reqItem.amount ) then + itemCount = itemCount + inv[slot][2] + print( inv[slot][2] ) + Quantum.Server.Inventory.RemoveSlotItem( pl, char, slot, inv[slot][2] ) + end + + if( i >= #slots ) then local itemCount = 0 end end end