Use este script e me diga se funcionou:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
--------------------------
----PARTE CONFIGURAVEL----
--------------------------
local itensMsg = "crystal coin, gold coin, two handed sword" --isso aqui é a lista de itens que o npc irá falar
local itens = {"crystal coin", "gold coin", "two handed sword"} --isso aqui são os itens que o npc irá aceitar
local config = { --aqui vc vai configurar o item, o monstro e a posição
["crystal coin"] = {monster="demon", pos={x=32374, y=32215,z=7}},
["gold coins"] = {monster='demon', pos={x=32374, y=32215,z=7}},
["two handed sword"] = {monster="demon", pos={x=32374, y=32215,z=7}},
}
-----------------------------
--FIM DA PARTE CONFIGURAVEL--
-----------------------------
function greetCallback(cid)
npcHandler:say('Hello, '..getCreatureName(cid)..'. You brought something of my interest?', cid)
npcHandler:addFocus(cid)
return false
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
for k, v in pairs(itens) do
if(msgcontains(msg, "yes")) then
npcHandler:say('So, what did you bring? Remember: I\'m interested in {'..itensMsg..'}.', cid)
elseif msgcontains(msg, v) then
if getPlayerItemCount(cid, getItemIdByName((v))) > 0 then
npcHandler:say('Get out of here! Go face your destiny!', cid)
doPlayerRemoveItem(cid, getItemIdByName((v)), 1)
doSummonCreature(config[v].monster, config[v].pos)
else
npcHandler:say('YOU ARE A LIAR! You don\'t have SHIT!', cid)
end
end
return false
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())