Skip to content

Commit 10f0bd2

Browse files
Merge pull request #44 from AkinoKitsu/patch-1
chore: add GetFreeWeight and GetSlots to docs
2 parents 498db7d + 250431e commit 10f0bd2

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

qbcore-resources/qb-inventory.md

+39
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,45 @@ RegisterCommand('hasMultipleItemsWithAmounts', function(source)
501501
end
502502
end, true)
503503
```
504+
## GetFreeWeight
505+
Returns the available space in weight of a specified player source's inventory.
506+
507+
```lua
508+
exports['qb-inventory']:GetFreeWeight(source)
509+
```
510+
511+
* source: `number`
512+
* <mark style="color:yellow;">returns</mark>: `number`
513+
514+
Example:
515+
516+
```lua
517+
RegisterCommand('getFreeWeight', function(source)
518+
local freeWeight = exports['qb-inventory']:GetFreeWeight(source)
519+
print('Free Weight: ' .. freeWeight)
520+
end, true)
521+
```
522+
## GetSlots
523+
Returns the occupied and empty slots of a specified identifier's inventory. (Player source or id of inventory / drop)
524+
525+
```lua
526+
exports['qb-inventory']:GetSlots(identifier)
527+
```
528+
529+
* identifier: `number | string`
530+
* <mark style="color:yellow;">returns</mark>: slotsUsed: `number`, slotsFree: `number`
531+
532+
Example:
533+
534+
```lua
535+
RegisterCommand('getSlots', function(source, args)
536+
local invId = args[1]
537+
if not invId then return end
538+
539+
local slotsUsed, slotsFree = exports['qb-inventory']:GetSlots(invId)
540+
print('Slots Used: ' .. slotsUsed, 'Slots Free: ' .. slotsFree)
541+
end, true)
542+
```
504543

505544
## GetSlotsByItem
506545

0 commit comments

Comments
 (0)