você pode usar o seguinte:
function getContainerSlotsFree(container) -- by vodka return getContainerCap(container)-getContainerSize(container) end
vai retornar quantos slots tem sobrando no contêiner
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

você pode usar o seguinte:
function getContainerSlotsFree(container) -- by vodka return getContainerCap(container)-getContainerSize(container) end
vai retornar quantos slots tem sobrando no contêiner
Editado Agosto 25 por Vodkart
Substitua o seu changegold com esse:
local coins = {
[iTEM_GOLD_COIN] = {
to = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_YELLOW
},
[iTEM_PLATINUM_COIN] = {
from = ITEM_GOLD_COIN, to = ITEM_CRYSTAL_COIN, effect = TEXTCOLOR_LIGHTBLUE
},
[iTEM_CRYSTAL_COIN] = {
from = ITEM_PLATINUM_COIN, effect = TEXTCOLOR_TEAL
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerFlagValue(cid, PLAYERFLAG_CANNOTPICKUPITEM)) then
return false
end
local coin = coins[item.itemid]
if(not coin) then
return false
end
if(coin.to ~= nil and item.type == ITEMCOUNT_MAX) then
if not doPlayerAddItem(cid, coin.to, 1, false) then
return doPlayerSendCancel(cid, "You don't have enough space in your backpack.")
end
doChangeTypeItem(item.uid, item.type - item.type)
doSendAnimatedText(fromPosition, "$$$", coins[coin.to].effect)
elseif(coin.from ~= nil) then
if not doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX, false) then
return doPlayerSendCancel(cid, "You don't have enough space in your backpack.")
end
doChangeTypeItem(item.uid, item.type - 1)
doSendAnimatedText(fromPosition, "$$$", coins[coin.from].effect)
end
return true
end
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake

@brun123
Então é só colocar isso aqui, né:
if not doPlayerAddItem(cid, coin.from, 1, false) then return doPlayerSendCancel(cid, "You don't have enough space in your backpack.") end
if not doPlayerAddItem(cid, coin.from, ITEMCOUNT_MAX, false) then return doPlayerSendCancel(cid, "You don't have enough space in your backpack.") end
~~ Edit ~~
Agora os items estão se clonando.
Editado Agosto 25 por LuckOake
Porque você colocou com ordem errada, não é só colocar esse código, tem que tirar outra linha e inverter a ordem das coisas acontecerem. Experimenta pegar meu script
info
Grupo: Marquês
Registrado: 22/07/12
Posts: 1.1k
Reputação: +400
Gênero: Masculino
Char no Tibia: Luck Oake
Olá olá
Como todos sabem, sempre tem um babaca que fica dando use em platinum coins estando sem espaço na backpack, e então cai 100 gold coins no chão e suja o templo todo.
Eu gostaria de saber se existe alguma função que obtenha os slots livres do player, e se ele não tiver nenhum, ser bloqueado de usar.