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, 'exori')) then
selfSay('voce gostaria de aprender exori?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8) then
if(getPlayerLevel(cid) >= 200 and getPlayerLearnedInstantSpell(cid, "Exori") == FALSE) then
doPlayerLearnInstantSpell(cid, "Exori")
selfSay('Agora voce aprendeu a magia exori.', cid)
else
selfSay('Voce ja aprendeu esta magia ou não possui nivel suficiente.', cid)
end
else
selfSay('Apenas Knights e Elite Knights podem aprender esta magia.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Certo então.', cid)
end
if(msgcontains(msg, 'exura')) then
selfSay('voce gostaria de aprender exura?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if getPlayerVocation(cid) > 0 then
if(getPlayerLevel(cid) >= 10 and getPlayerLearnedInstantSpell(cid, "Exura") == FALSE) then
doPlayerLearnInstantSpell(cid, "Exura")
selfSay('Agora voce aprendeu a magia exura.', cid)
else
selfSay('Voce ja aprendeu esta magia ou não possui nivel suficiente.', cid)
end
else
selfSay('Apenas jogadores com vocações podem aprender esta magia.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Certo então.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Tentah aí.
Abraços!! :smile_positivo:


info
Grupo: Campones
Registrado: 03/08/10
Posts: 6
Reputação: 0
Char no Tibia: Wesne
Tipo do script: Npc
Protocolo: 7.81
Servidor utilizado: Evolutions
Nível de experiência: Média ?
Adicionais/Informações: Npc que vende spell,por dinheiro =].