Skip to content

Commit

Permalink
feat(server/inventory): Inventory.InspectInventory
Browse files Browse the repository at this point in the history
Resolves #1545.
  • Loading branch information
thelindat committed Dec 10, 2023
1 parent 5d84c17 commit 9d9c958
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 10 additions & 0 deletions modules/inventory/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2646,4 +2646,14 @@ end

exports('CreateTemporaryStash', Inventory.CreateTemporaryStash)

function Inventory.InspectInventory(playerId, invId)
local inventory = invId ~= playerId and Inventory(invId)
local playerInventory = Inventory(playerId)

if playerInventory and inventory then
playerInventory:openInventory(inventory)
TriggerClientEvent('ox_inventory:viewInventory', playerId, inventory)
end
end

return Inventory
9 changes: 1 addition & 8 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,5 @@ lib.addCommand('viewinv', {
},
restricted = 'group.admin',
}, function(source, args)
local invId = tonumber(args.invId) or args.invId
local inventory = invId ~= source and Inventory(invId)
local playerInventory = Inventory(source)

if playerInventory and inventory then
playerInventory:openInventory(inventory)
TriggerClientEvent('ox_inventory:viewInventory', source, inventory)
end
Inventory.InspectInventory(source, tonumber(args.invId) or args.invId)
end)

0 comments on commit 9d9c958

Please sign in to comment.