feat(player): refine inventory item count handling with rounding and maximum limit enforcement.

This commit is contained in:
YOMAN1792
2025-03-03 21:33:05 -05:00
parent 6693a7f503
commit 80d934ac59
+1 -2
View File
@@ -407,10 +407,9 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
---@return nil
function self.addInventoryItem(itemName, count)
local item = self.getInventoryItem(itemName)
if not item then return end
count += item.count
item.count = (count <= MAX_AMOUNT and count) or MAX_AMOUNT
item.count = ESX.Math.Round(count) <= MAX_AMOUNT and ESX.Math.Round(count) or MAX_AMOUNT
self.weight += (item.weight * count)
TriggerEvent("esx:onAddInventoryItem", self.source, item.name, item.count)