inventory_remove()

View on GitHub

Syntax

inventory_remove(inventory, item, amount)

Removes amount (defaults to 1) of item from inventory. If the inventory doesn’t have the defined amount, nothing happens, otherwise the given amount of items is removed wherever they are in the inventory. Returns boolean whether the removal operation was successful. Easiest way to remove a specific item from player inventory without specifying the slot.

Returns

Returns true on success.

Examples

inventory_remove(player(), 'diamond'); // true: removed diamond from player inventory
inventory_remove(player(), 'diamond', 100); // false: player doesn't have 100 diamonds, nothing happened