Ir para conteúdo
Banner com Efeitos

lucasgld

Membro
  • Registro em

  • Última visita

Histórico de Curtidas

  1. Gostei
    lucasgld deu reputação a GiovaniRodrigo em [Resolvido] [PEDIDO] NPC Troca Item por outro Item   
    Faça mesmo procedimento que eu citei só substitua o script do Jax.lua por esse

    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 local items = {           item1 = {2346, 2349}, -- item1 item que será pedido e que será dado na primeira troca           item2 = {2033, 15515} -- item2 item que será pedido e que será dado na segunda troca } local counts = {           count1 = {1, 1}, -- count1 quantidade que será pedido e que será dado na primeira troca           count2 = {10, 1} -- count2 quantidade que será pedido e que será dado na segunda troca } 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, 'blue note') then                     selfSay('You want to swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.',cid)                     talkState[talkUser] = 1           elseif talkState[talkUser] == 1 then                     if msgcontains(msg, 'yes') then                               if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then                                         doPlayerRemoveItem(cid, items.item1[1], counts.count1[1])                                         doPlayerAddItem(cid, items.item1[2], counts.count1[2])                                         selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid)           talkState[talkUser] = 0                               else                                         selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid)                               end                     else                               selSay('Ok then!', cid)          talkState[talkUser] = 0                     end           elseif msgcontains(msg, 'bar of gold') then                     selfSay('You want to swap '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..' for '.. counts.count2[2] ..' '.. getItemNameById(items.item2[2]) ..'.', cid)      talkState[talkUser] = 2           elseif talkSate[talkUser] == 2                     if msgcontains(msg, 'yes') then                               if getPlayerItemCount(cid, items.item2[1]) >= counts.count2[1] then                                         doPlayerRemoveItem(cid, items.item2[1], counts.count2[1])                                         doPlayerAddItem(cid, items.item2[2], counts.count2[2])                                         selfSay('You just swap '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..' for '.. counts.count2[2] ..' '.. getItemNameById(items.item2[2]) ..'.', cid)           talkState[talkUser] = 0                               else                                         selfSay('You need '.. counts.count2[1] ..' '.. getItemNameById(items.item2[1]) ..'.', cid)                               end                     else                               selfSay('Ok then!', cid)                               talkState[talkUser] = 0                     end           end           return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
    Att.
    Giovani Rodrigo

Informação Importante

Confirmação de Termo