Erro meu o npc não retirar o item:
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local config = {
itemid = 3942,
reward = {{item = 2160, count = 100}}, -- Pode adicionar mais se quiser.
removeItem = "yes",
storage = 6598
}
if msgcontains(msg:lower(), "ajuda") then
if getPlayerStorageValue(cid,config.storage) <= 0 then
selfSay("Preciso que voce procure a cup que perdi...foi um presente do meu pai,aceita me {ajudar}?", cid)
talk_state = 1
else
selfSay("Muito obrigado pela sua ajuda companheiro...", cid)
talk_state = 0
end
elseif msgcontains(msg:lower(), "sim") and talk_state == 1 then
selfSay("obrigado procure ne casas abondonadas e outras contruções do tipo..não sei onde botei.", cid)
setPlayerStorageValue(cid, config.storage, 1)
talk_state = 0
elseif msgcontains(msg:lower(), "pronto") and getPlayerStorageValue(cid, config.storage) == 1 then
selfSay("Você trouxe o cup?", cid)
talk_state = 2
elseif msgcontains(msg:lower(), "sim") and talk_state == 2 then
if getPlayerItemCount(cid, config.itemid) >= 1 then
selfSay("Nossa, muito obrigado... Aqui está sua recompensa.", cid)
setPlayerStorageValue(cid, config.storage, 2)
for k,v in pairs(config.reward) do
doPlayerAddItem(cid, v.item, v.count or 1)
end
if config.removeItem == "yes" then
doPlayerRemoveItem(cid, config.itemid, 1)
end
talk_state = 0
else
selfSay("Que pena, voce ainda não achou...", cid)
talk_state = 0
end
elseif msg:lower() == "no" and talk_state >= 1 then
selfSay("Obrigado mesmo assim...", cid)
talk_state = 0
npcHandler:resetNpc()
end
return true
end
As falas voce muda aí...
flw
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())