Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Borreke0 authored Dec 13, 2023
2 parents c1c3111 + d9b552a commit 0a6a3ec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +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')
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 All @@ -252,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 0a6a3ec

Please sign in to comment.