Skip to content

Commit

Permalink
Error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
GhzGarage committed Nov 29, 2023
1 parent 6126a49 commit 194e4c3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ local function RemoveItem(source, item, amount, slot)
slot = tonumber(slot)

if slot then
if not Player.PlayerData.items[slot] then DropPlayer(source, 'Failed to remove item, most likely cheating') end
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 > amount then
Player.PlayerData.items[slot].amount = Player.PlayerData.items[slot].amount - amount
Player.Functions.SetPlayerData('items', Player.PlayerData.items)
Expand Down

0 comments on commit 194e4c3

Please sign in to comment.