local trade_pokes, options = {
["Kabuto"] = {itemid = 12579, count = 1},
}, {}
local btype = "normal"
for poke_name, trade_info in pairs(trade_pokes) do
table.insert(options, poke_name.." - "..trade_info.count.."x "..getItemNameById(trade_info.itemid))
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg:lower(), "fossil") then
selfSay("Eu posso trocar fósseis por esses pokémons. Qual vocę quer?", cid, TALKTYPE_MONSTER)
doPlayerPopupFYI(cid, "*** POKÉMONS DISPONÍVEIS ***\n\n"..table.concat(options, "\n"))
talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
local poke = trade_pokes[msg]
if poke then
if doPlayerRemoveItem(cid, poke.itemid, poke.count) then
selfSay("Foi um prazer fazer negócios com vocę! Faça bom uso do seu novo "..msg..".", cid, TALKTYPE_MONSTER)
doPlayerRemoveItem(cid, 2152, 50)
addPokemon(cid, msg, 0, nil, btype)
end
talkState[talkUser] = 0
else
selfSay("Desculpe, mas vocę năo tem os itens necessários para ressucitar o fóssil. (5K + fossil)", cid, TALKTYPE_MONSTER)
end
else
selfSay("Desculpe, provavelmente vocę está escrevendo o nome errado ou sem a primeira letra maiúscula", cid, TALKTYPE_MONSTER)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())




info
Grupo: Campones
Registrado: 30/03/21
Posts: 3
Reputação: 0
queria um npc que troca pokemons por itens para o meu servidor alguem pode me ajudar nao manjo muito com essas coisas e nao achei isso em nem 1 forum ate agr