Skip to main content

canSwapItem

xPlayer.canSwapItem(firstItem, firstItemCount, testItem, testItemCount)

This function is used to determinate if a player can swap an item for some other item.

Arguments

ArgumentData TypeOptionalDefault ValueExplanation
firstItemstringNo-First item name
firstItemCountnumberNo-First item count
testItemstringNo-Test item name
testItemCountnumberNo-Test item count

Example

if xPlayer.canSwapItem('bread', 1, 'water', 1) then
xPlayer.removeInventoryItem('bread', 1)
xPlayer.addInventoryItem('water', 1)
else
xPlayer.showNotification('You don\'t have enough inventory space.')
end