xPlayer.addInventoryItem

1
xPlayer.addInventoryItem(item, count)

This function adds an inventory item.

Arguments

Argument Data Type Optional Default Value Explanation
item string No - Item name
count number No - Count of item to add

Warning

This function will not check if the player weight limit exceeds. Recommended to use in comibation with xPlayer.canCarryItem(item, count)

xPlayer.addInventoryItem Exemplo

1
2
3
4
5
6
if targetXPlayer.canCarryItem(itemName, itemCount) then
    sourceXPlayer.removeInventoryItem(itemName, itemCount)
    targetXPlayer.addInventoryItem   (itemName, itemCount)
else
    sourceXPlayer.showNotification('Target player could not hold all of that.')
end