feat(ox_inventory): CanCarryWeight (#75)

* feat(ox_inventory): CanCarryWeight

* fix(ox_inventory/CanCarryWeight): mistake
This commit is contained in:
hyprell authored and GitHub committed 2022-12-01 21:41:23 +11:00
1 parent 0a7cb24a2a
commit 31bf64baf2
1 file changed
+25
@@ -0,0 +1,25 @@
Returns if inventory can carry specified weight and free inventory weight.
```lua
exports.ox_inventory:CanCarryWeight(inv, weight)
```
* inv: `string` or `number`
* weight: `number`
Example:
```lua
-- Checks if player can carry 1000 grams.
local fillAmount = 1000
local canCarryWeight, freeWeight = ox_inventory:CanCarryWeight(playerId, fillAmount)
if freeWeight == 0 then
-- Player can't carry weight.
return
elseif not canCarryWeight then
-- Modify fillAmount, because inventory can't carry specified weight
fillAmount = freeWeight
end
-- Do something
```