Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Esqueci desse detalhe ;D

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
msg = string.lower(msg)




if (msgcontains(msg, 'quest) or msgcontains(msg, 'mission)) then
selfSay("Voce tem as storages da mission?.", cid)
talkState[talkUser] = 1


elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, 2050) == 1 and getPlayerStorageValue(cid, 2051) == 1 and getPlayerStorageValue(cid, 2052) == 1 and getPlayerStorageValue(cid, 2053) == 1 then
selfSay("Legal, vc pode fazer a Quest.", cid)
setPlayerStorageValue(cid, 2050, -1)
setPlayerStorageValue(cid, 2051, -1)
setPlayerStorageValue(cid, 2052, -1)
setPlayerStorageValue(cid, 2053, -1)
doTeleportThing(cid, {x= 99, y= 189, z= 7})
talkState[talkUser] = 0
else
selfSay("Voce nao tem todas as storages", cid)
talkState[talkUser] = 0
return true
end


return TRUE
end


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

cms1-pr%C3%AAmio.png

  • Respostas 12
  • Visualizações 907
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Meio que improvisei aqui. Estou no serviço, não tem como testar. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) l

  • Esqueci desse detalhe local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatu

Postado

Não deveria ter fechado o Tópico sem antes ter testado o Script. ;D

 

 -- < Script by Frenesy > --
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 doCreatureSayWithDelay(cid,text,type,delay,e)
   if delay<=0 then
      doCreatureSay(cid,text,type)
   else
      local func=function(pars)
                    doCreatureSay(pars.cid,pars.text,pars.type)
                    pars.e.done=TRUE
                 end
      e.done=FALSE
      e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e})
   end
end




function cancelNPCTalk(events)
  local ret=1
  for aux=1,table.getn(events) do
     if events[aux].done==FALSE then
        stopEvent(events[aux].event)
     else
        ret=ret+1
     end
  end
  events=nil
  return(ret)
end




function doNPCTalkALot(msgs,interval)
  local e={}
  local ret={}
  if interval==nil then interval=3000 end --3 seconds is default time between messages
  for aux=1,table.getn(msgs) do
      e[aux]={}
      doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux])
      table.insert(ret,e[aux])
  end
  return(ret)
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, 'Quest') or msgcontains(msg, 'Mission')) then
selfSay('Quer fazer a mission?', cid)
talkState[talkUser] = 1


    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) and 
if getPlayerStorageValue(cid, 2050) == 1 and getPlayerStorageValue(cid, 2051) == 1 and getPlayerStorageValue(cid, 2052) == 1 and getPlayerStorageValue(cid, 2053) == 1 then
selfSay('Ok, voce pode fazer a quest agora.', cid)


doSendMagicEffect(getPlayerPosition(cid), 10)
doTeleportThing(cid, {x= 99, y= 189, z= 7})
setPlayerStorageValue(cid, 2050, -1) -- Remover Missão
setPlayerStorageValue(cid, 2051, -1) -- Remover Missão
setPlayerStorageValue(cid, 2052, -1) -- Remover Missão
setPlayerStorageValue(cid, 2053, -1) -- Remover Missão
talkState[talkUser] = 0
else
selfSay('Voce nao tem o que e necessario para essa mission.', cid)
end


elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) and 
selfSay('Volte quando estiver pronto.', cid)
talkState[talkUser] = 0


end
return TRUE
end


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

Editado por Frenesy (veja o histórico de edições)

cms1-pr%C3%AAmio.png

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo