master
AlmTech Software 5 years ago
parent f137d07eaf
commit 53982348a6
  1. 2
      gamemode/engine/lib/server/sv_inventory.lua
  2. 2
      gamemode/engine/lib/sh_items.lua

@ -108,6 +108,8 @@ function Quantum.Server.Inventory.GiveItem( pl, itemid, amount )
local inv = Quantum.Server.Char.GetInventory( char ) local inv = Quantum.Server.Char.GetInventory( char )
local item = Quantum.Item.Get( itemid ) local item = Quantum.Item.Get( itemid )
if( item == nil ) then Quantum.Error( "Tried to give " .. tostring(pl) .. " a non-existent item! Item '" .. tostring(itemid) .. "' does not exist." ) return end
if( #inv + 1 <= Quantum.Inventory.Width * Quantum.Inventory.Height || Quantum.Server.Inventory.FindStackable( char, item ) != nil ) then if( #inv + 1 <= Quantum.Inventory.Width * Quantum.Inventory.Height || Quantum.Server.Inventory.FindStackable( char, item ) != nil ) then
sortItem( char, itemid, amount ) sortItem( char, itemid, amount )

@ -21,7 +21,7 @@ function Quantum.Item.Create( itemid, args )
usefunction = args.usefunction, -- use function usefunction = args.usefunction, -- use function
consumefunction = args.consumefunction --consume function consumefunction = args.consumefunction --consume function
} }
math.Clamp( item.stack, 1, Quantum.Inventory.MaxStackSize ) -- clamp it so it does not go over the max size item.stack = math.Clamp( item.stack, 1, Quantum.Inventory.MaxStackSize ) -- clamp it so it does not go over the max size
Quantum.Items[itemid] = item Quantum.Items[itemid] = item
return item return item
end end

Loading…
Cancel
Save