mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 10:01:28 +00:00
Update player.lua
Fix some cheats use xPlayer.removeInventoryItem(itemName, negative number) to get Item
This commit is contained in:
@@ -293,14 +293,18 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
|
||||
if item then
|
||||
count = ESX.Math.Round(count)
|
||||
local newCount = item.count - count
|
||||
if count > 0 then
|
||||
local newCount = item.count - count
|
||||
|
||||
if newCount >= 0 then
|
||||
item.count = newCount
|
||||
self.weight = self.weight - (item.weight * count)
|
||||
if newCount >= 0 then
|
||||
item.count = newCount
|
||||
self.weight = self.weight - (item.weight * count)
|
||||
|
||||
TriggerEvent('esx:onRemoveInventoryItem', self.source, item.name, item.count)
|
||||
self.triggerEvent('esx:removeInventoryItem', item.name, item.count)
|
||||
TriggerEvent('esx:onRemoveInventoryItem', self.source, item.name, item.count)
|
||||
self.triggerEvent('esx:removeInventoryItem', item.name, item.count)
|
||||
end
|
||||
else
|
||||
print(('[^1ERROR^7] Player ID:^5%s Tried remove a Invalid count of name'):format(self.playerId, money))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user