lib/functions
function getItemsFromList(items) -- by vodka local str = '' if table.maxn(items) > 0 then for i = 1, table.maxn(items) do str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1]) if i ~= table.maxn(items) then str = str .. ', ' end end end return str end function doRemoveItemsFromList(cid,items) -- by vodka local count = 0 if table.maxn(items) > 0 then for i = 1, table.maxn(items) do if getPlayerItemCount(cid,items[i][1]) >= items[i][2] then count = count + 1 end end end if count == table.maxn(items) then for i = 1, table.maxn(items) do doPlayerRemoveItem(cid,items[i][1],items[i][2]) end else return false end return true end
exemplo de uso
local list = {{5894,100},{11191,100},{11183,100}} -- lista do seus items
if doRemoveItemsFromList(cid, list) then
npcHandler:say("parabéns, aqui está seu item", cid)
doPlayerAddItem(cid, 2494,1)
else
npcHandler:say("você não tem "..getItemsFromList(list), cid)
end






info
Grupo: Campones
Registrado: 10/12/10
Posts: 38
Reputação: 0
Char no Tibia: kitten lady
Bom Sou Novo Nessa Parte E Nao Sei Se To Postando Certo Se N Estiver Me Ajudei Obrigado
Vamos La
O Que Eu Presiso E De Um Npc Estilo Npc De Addon So Q Ao Inves De Trocar Os Itens Por Addon
Ele Troca Por Apenas Um Item
Vo Dar Um Ex :
O Player Teria Que Ter
100 bat wings id 5894, 100 Bear Paw id 5896, 100 crab pincers id 11183, 100 frosty hearts id 10577, 100 giant eyes id 11191
Para Poder Trocar Por
1 obsidian knife id 5908
Isso Tudo E So Um Ex Depois Eu Modifico Ao Meu Gosto
Acho Que Seria Isso
Se Alguem Puder Me Ajudar
Eu Agradeso