xPlayer.canSwapItem

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

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

Arguments

Argument Data Type Optional Default Value Explanation
firstItem string No - First item name
firstItemCount number No - First item count
testItem string No - Test item name
testItemCount number No - Test item count

xPlayer.canSwapItem Exemplo

1
2
3
4
5
6
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