Functions
Server
Removeitemamt

RemoveItemAMT

function WIS.RemoveItemAMT(ply, slotIndex, amt, up)

Removes a specified amount of an item from a slot in the player's inventory. This function is particularly useful for handling stackable items where only a portion of the stack needs to be removed.

Parameters

NameTypeDescription
plyEntityThe player entity whose inventory is being modified.
slotIndexintegerThe index of the slot from which the item is to be removed.
amtintegerThe amount of the item to be removed.
upbooleanA flag indicating whether to update the inventory UI.

Use Case

This function is used when a specific quantity of an item needs to be removed from the inventory, which is common in scenarios like crafting, where ingredients are consumed, or when selling items to a vendor.

Example

local player = Entity(1)
local slotIndex = 4
local amountToRemove = 2
WIS.RemoveItemAMT(player, slotIndex, amountToRemove, false)