Ir para conteúdo

Featured Replies

Postado

Ola Pessoal vim a pedido de um npc que traiz uma função

de missão, o npc Officer jenny

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end
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 --alterado  \/\/
 
if msgcontains(msg, 'join') or msgcontains(msg, 'Join') then
 
  selfSay("Then you want to join to the police?", cid)
  talkState[talkUser] = 1
       
elseif msgcontains(msg, 'yes') or msgcontains(msg, 'Yes') and talkState[talkUser] == 1 then 
    
    if not isRocket(cid) and not isOfficer(cid) then
       selfSay("Then this is it! Go do your job now!", cid)
       setPlayerStorageValue(cid, 665460, 1) --storage de officer!
       setPlayerStorageValue(cid, 181652, 1) --storage da outfit de policial
       talkState[talkUser] = 0
       return true
    elseif isRocket(cid) then
       selfSay("You are a member of the team rocket? You will be arrested!", cid)
       talkState[talkUser] = 0
       return true
    elseif isOfficer(cid) then
       selfSay("You are already a member of the police! Go do your job!", cid)
       talkState[talkUser] = 0
       return true
    end
end
 
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Npc Officer Jenny, queria coloka mais uma função nela, de tipo missao

que e preciso a storage da officer!, tambem o npc pedira 3 tipos de intens, e teleporta npc pra tal lugar!

assim q o player entrega 3 intens(3 intens com quantidade limitada!), ganhando um intem e uma outfit!

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

  • Respostas 6
  • Visualizações 561
  • Created
  • Última resposta

Top Posters In This Topic

Postado

Fiz correndo cara testa aee, tem que por isso depois disso

    elseif isOfficer(cid) then
       selfSay("You are already a member of the police! Go do your job!", cid)
       talkState[talkUser] = 0
       return true
    end
end

--------------------------------------------------------------------------------
local items = {2143,2146,2159} 
local add_item = 2143
local qt = 100

if msgcontains(msg, 'MSG') or msgcontains(msg, 'MSG') then
  selfSay("frase?", cid)
  talkState[talkUser] = 10

elseif msgcontains(msg, 'yes') or msgcontains(msg, 'Yes') and talkState[talkUser] == 10 then  -- confirma MSg acima
if isOfficer(cid) then
if getPlayerItemCount(cid, items[1]) >= qt then
            if getPlayerItemCount(cid, items[2]) >= qt then
                if getPlayerItemCount(cid, items[3]) >= qt then
                doPlayerRemoveItem(cid,items[1],qt)
                doPlayerRemoveItem(cid,items[2],qt)
                doPlayerRemoveItem(cid,items[3],qt)
                doPlayerAddItem(cid, add_item, 1)
else
            selfSay('Voce nao tem o '..getItemNameById(items[3])..'.', cid)
            end
            else
            selfSay('Voce nao tem o '..getItemNameById(items[2])..'.', cid)
            end
            else
            selfSay('Voce nao tem o '..getItemNameById(items[1])..'.', cid)
            end 
            else 
            selfSay('Voce não é officer.', cid)     
            end  
end            
return true
end
--------------------------------------------------------------------------------

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

Postado

toma ae e so add no script na parte de add item.

         doTeleportThing(cid, {x= 1144, y= 1411, z= 7})  -- se for manda ele para algum lugar fixo 
  doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))   -- se for mandar ele para o templo.

se ajudei Rep+ e reporte para fechar topico..

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

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.6k

Informação Importante

Confirmação de Termo