Postado Agosto 14, 2014 10 anos Tenta esse ae. Mostrar conteúdo oculto 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 t = { ["light healing"] = {price = 15,vocations = {1,5},level = 1}, ["find person"] = {price = 25,vocations = {1,5},level = 1}, ["light magic missile"] = {price =30,vocations = {1,5},level = 1}, ["energy strike"] = {price =20,vocations = {1,5},level = 1}, ["flame strike"] = {price =100,vocations = {1,5},level = 1} } if (msgcontains(msg, 'SPELLS') or msgcontains(msg, 'spells'))then local str = "" str = str .. "Eu vendo estas Magias: " for name, pos in pairs(t) do if isInArray(pos.vocations, getPlayerVocation(cid)) then str = str.." {"..name.."} = "..pos.price.." gold coins /" end end if str == "" then str = "Eu não tenho nenhuma magia para vender a você." end str = str .. "." npcHandler:say(str, cid) elseif t[msg] then if not getPlayerLearnedInstantSpell(cid, msg) then if getPlayerLevel(cid) >= t[msg].level then if isInArray(t[msg].vocations, getPlayerVocation(cid)) then if doPlayerRemoveMoney(cid, t[msg].price) then doPlayerLearnInstantSpell(cid, msg) npcHandler:say("Você aprendeu uma nova magia chamada ".. msg .."!", cid) else npcHandler:say("você não tem "..t[msg].price.." gold coins.", cid) end else npcHandler:say("você não tem a vocação para comprar está spell.", cid) end else npcHandler:say("você precisa ter level "..t[msg].level.." ou mais para comprar essa magia.", cid) end else npcHandler:say("você já aprendeu essa magia.", cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Tony Araújo
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.