Skip to content

Commit

Permalink
refactor(server/inventory): disable giveItem if target inv is busy
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Sep 13, 2024
1 parent e29e0c1 commit 322a5e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2419,6 +2419,12 @@ local function giveItem(playerId, slot, target, count)

if not data then return end

local targetState = Player(target).state

if targetState.invBusy then
return { 'cannot_give', count, data.label }
end

local item = Items(data.name)

if not item or data.count < count or not Inventory.CanCarryItem(toInventory, item, count, data.metadata) or #(GetEntityCoords(fromInventory.player.ped) - GetEntityCoords(toInventory.player.ped)) > 15 then
Expand Down

0 comments on commit 322a5e4

Please sign in to comment.