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
local msg = string.lower(msg)
local pokeNAME = {"Nome do poke"}
local itemID = xxxx -- id do item q vai remove
local storage = 23905 -- n mexa
if msgcontains(string.lower(msg), 'ajuda') or msgcontains(string.lower(msg), 'help') then
if getPlayerStorageValue(cid, storage) == 1 then
return true
end
selfSay("Ola eu preciso de x item, você tem? se sim fale yes que irei te dar um poke de troca!", cid)
return true
talkState[talkUser] = 2
elseif msgcontains(msg, "yes") or msgcontains(msg, "sim") and talkState[talkUser] == 2 then
if doPlayerRemoveMoney(cid, itemID) == 1 then -- no 1 é q quantidade
selfSay("Você não tem o item!", cid)
talkState[talkUser] = 0
return true
end
selfSay("Muito bom, tome aqui seu pokémon!", cid)
addPokeToPlayer(cid, pokeNAME, 0, -1, 'normal', true)
setPlayerStorageValue(cid, storage, 1)
talkState[talkUser] = 0
return true
end
return true end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())