Skip to content

Commit

Permalink
Add more validation
Browse files Browse the repository at this point in the history
  • Loading branch information
GhzGarage committed Nov 29, 2023
1 parent 194e4c3 commit d9b552a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ local function RemoveItem(source, item, amount, slot)
if not slots then return false end

for _, _slot in pairs(slots) do
if not Player.PlayerData.items[_slot] then
DropPlayer(source, 'Failed to remove item, most likely cheating')
return false
end
if Player.PlayerData.items[_slot].amount > amountToRemove then
Player.PlayerData.items[_slot].amount = Player.PlayerData.items[_slot].amount - amountToRemove
Player.Functions.SetPlayerData('items', Player.PlayerData.items)
Expand Down

0 comments on commit d9b552a

Please sign in to comment.