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 onCreatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if(msgcontains(msg, "skulls") or msgcontains(msg, "yes")) then
if(doPlayerRemoveItem(cid, 2320, 2)) then
npcHandler:say("Now that I have my precious skulls, I can tell you... The last time I heard of Kenam, he was living as a hidden fortress' emperor in Thais.", cid)
doCreatureSetStorage(cid, 2304, 1)
else
npcHandler:say("You do not have any skulls! I need two of them.", cid)
npcHandler:releaseFocus(cid)
end
end
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|, I liked your head's format. I really like {skulls}, if you bring me some of them, I can help you. Do you have any with you?")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)
npcHandler:addModule(FocusModule:new())
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 onGreetCallback(cid)
if getPlayerStorageValue(cid, 2304) == 1 then
npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|. I can {remove} your skull or battle.")
talkState[cid] = 1
else
npcHandler:setMessage(MESSAGE_GREET, "You do not have permission to talk with me.")
npcHandler:releaseFocus(cid)
end
return true
end
function onCreatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if(msgcontains(msg, "remove") and talkState[cid] == 1) then
(...)
-- INSERIR CÓDIGO MACARRÔNICO AQUI
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, onGreetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, onCreatureSayCallback)
npcHandler:addModule(FocusModule:new())
Esta não é a seção de Pedidos e Dúvidas.
Abraços.