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

27 lines
583 B
Plaintext

Returns if inventory can carry specified weight and free inventory weight.
```lua
exports.ox_inventory:CanCarryWeight(inv, weight)
```
* inv: `table` or `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
```