LUA:
local config = {
[ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
[ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN},
[ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN, changeTo = ITEM_BAR_OF_GOLD},
[ITEM_BAR_OF_GOLD] = {changeBack = ITEM_CRYSTAL_COIN}
}
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey, container)
local coin = config[item.itemid]
if not coin then
return false
end
local bp = getPlayerSlotItem(player, CONST_SLOT_BACKPACK).uid
local freeSlotsInBp = math.max(0, getContainerCap(bp) - getContainerSize(bp))
if freeSlotsInBp > 0 then
if coin.changeTo and item.type == 100 then
item:remove()
player:addItem(coin.changeTo, 1)
elseif coin.changeBack then
item:transform(item.itemid, item.type - 1)
player:addItem(coin.changeBack, 100)
else
return false
end
return true
end
end
i add this in the script
LUA:
local bp = getPlayerSlotItem(player, CONST_SLOT_BACKPACK).uid
local freeSlotsInBp = math.max(0, getContainerCap(bp) - getContainerSize(bp))
if freeSlotsInBp > 0 then
but not work on other empty bp, when the main bp is full it stops even with the other empty bp
tfs 1.2
BUMP
Last edited: