Skip to content

Commit

Permalink
fix: prevent item dupe exploit on item swap
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwerty1Verified committed Sep 6, 2024
1 parent e1fbaaf commit c543e8c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,12 @@ RegisterNetEvent('qb-inventory:server:SetInventoryData', function(fromInventory,
end
else
if toItem then
if RemoveItem(fromId, fromItem.name, fromAmount, fromSlot, 'swapped item') and RemoveItem(toId, toItem.name, toAmount, toSlot, 'swapped item') then
AddItem(toId, fromItem.name, fromAmount, toSlot, fromItem.info, 'swapped item')
AddItem(fromId, toItem.name, toAmount, fromSlot, toItem.info, 'swapped item')
local fromItemAmount = fromItem.amount
local toItemAmount = toItem.amount

if RemoveItem(fromId, fromItem.name, fromItemAmount, fromSlot, 'swapped item') and RemoveItem(toId, toItem.name, toItemAmount, toSlot, 'swapped item') then
AddItem(toId, fromItem.name, fromItemAmount, toSlot, fromItem.info, 'swapped item')
AddItem(fromId, toItem.name, toItemAmount, fromSlot, toItem.info, 'swapped item')
end
else
if RemoveItem(fromId, fromItem.name, toAmount, fromSlot, 'moved item') then
Expand Down

0 comments on commit c543e8c

Please sign in to comment.