Ir para conteúdo

Ajuda '-'


MatheusGlad

Posts Recomendados

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) talkState[cid] = 0  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

   if msgcontains(msg:lower(), "addon") and getPlayerStorageValue(cid, 55413) == 2 then
       if os.time()-getPlayerStorageValue(cid, 55414) >= 2*60 then
           doPlayerAddOutfit(cid, 128, 1)
           doPlayerAddOutfit(cid, 136, 1)
           return selfSay("Just in time! Your backpack is finished. Here you go, I hope you like it.", cid)
       else
           return selfSay("Uh... I didn't expect you to return that early. Sorry, but I'm not finished yet with your backpack. I'm doing the best I can, promised.", cid)
       end
   end

   if msgcontains(msg:lower(), "addon") then
       selfSay("Sorry, the backpack I wear is not for sale. It's handmade from rare minotaur leather.", cid)
   elseif msgcontains(msg:lower(), "minotaur leather") then
       selfSay("Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?", cid)
       talkState[cid] = 1
   elseif msgcontains(msg:lower(), "yes") and talkState[cid] == 1 then
       selfSay("Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!", cid)
       setPlayerStorageValue(cid, 55413, 1)
       talkState[cid] = 0
   elseif msgcontains(msg:lower(), "no") and talkState[cid] == 1 then
       selfSay("So what you want from me?", cid)
       talkState[cid] = 0
   end

   if msgcontains(msg:lower(), "backpack") and getPlayerStorageValue(cid, 55413) == 1 then
       selfSay("Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?", cid)
       talkState[cid] = 2
   elseif msgcontains(msg:lower(), "yes") and talkState[cid] == 2 then
       if doPlayerRemoveItem(cid, 5878, 100) then
           selfSay("Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay?", cid)
           setPlayerStorageValue(cid, 55413, 2)
           setPlayerStorageValue(cid, 55414, os.time())
       else
           selfSay("You don't have 100 pieces of minotaur leather", cid)
       end
       talkState[cid] = 0
   elseif msgcontains(msg:lower(), "no") and talkState[cid] == 2 then
       selfSay("So, come back when you have the 100 minotaur leathers.", cid)
       talkState[cid] = 0
   end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Nao ta adicionando o addon n sei pq, mas tipo ele manda a msg:

Just in time! Your backpack is finished. Here you go, I hope you like it.

 

Entao ele executou a funçao pra add o addon mais n adicionou '-'

 

Quem conseguir ganha um pirulito.

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...