Files
overextended.github.io/pages/ox_inventory/Functions/Server/Inventory/CanCarryItem.mdx
T
2023-06-04 15:15:21 +02:00

26 lines
658 B
Plaintext

Returns true or false depending if the inventory can carry the specified item.
The function checks for inventory weight and available slots.
```lua
exports.ox_inventory:CanCarryItem(inv, item, count, metadata)
```
* inv: `table` or `string` or `number`
* item `table` or `string`
* Can be array of items.
* count: `number`
* metadata?: `table` or `string`
* If metadata is passed as string then `metadata.type` will be checked.
**Example:**
```lua
-- Checks if the player calling the event can carry 3 water items
if exports.ox_inventory:CanCarryItem(source, 'water', 3) then
-- Do stuff if can carry
else
-- Do stuff if can't carry
end
```