Avoid getting more item than possible

This commit is contained in:
Sylundef
2017-11-10 05:22:56 +01:00
parent 205d7bf810
commit 16a25c4c6a
+2 -1
View File
@@ -324,8 +324,9 @@ AddEventHandler('esx_mecanojob:putStockItems', function(itemName, count)
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_mecano', function(inventory)
local item = inventory.getItem(itemName)
local playerItemCount = xPlayer.getInventoryItem(itemName).count
if item.count >= 0 then
if item.count >= 0 and count <= playerItemCount then
xPlayer.removeInventoryItem(itemName, count)
inventory.addItem(itemName, count)
else