Ir para conteúdo

Rafaelgaspar

Membro
  • Registro em

  • Última visita

Solutions

  1. Rafaelgaspar's post in (Resolvido)[ajuda] talkaction ou npc de troca was marked as the answer   
    vou fazer...
    se puder dá REP+ la.... =)
    ja ja mando o codigo atualizado
     
    atualizando....

    local distancia_minima=4-- distancia minima para falar com NPC local itemid1=5001--ID do primeiro item local itemid2=5002--ID do segundo item local itemid3=5003--ID do terceiro item local itemid4=5004--ID do quarto item local itemid5=5005--ID do quinto item local itemidADD=5006--ID do item q vai ganhar local distancia_minima=3 local mintempo=30 local frase01=" hi, eu troco os seguintes itens x, y, z por um addon doll." local frase02="Sorry, I'm busy at this moment. Wait your turn." local frase03=" vc tem os itens x y z para trocar comigo?" local frase03=" parabens, tome seu item. Tchau" local frase03=" lamento, voce nao tem os itens necessarios. Volte qndo tiver, tchau" local frase97="Tchau." local frase98="Até mais" local focus = 0 local talk_start = 0 local estado=0 following = false attacking = false   function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay(frase98) focus = 0 talk_start = 0 estado=0 end end function onCreatureTurn(creature) end function msgcontains(txt, str) return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) end   function onCreatureSay(cid, tipo, msg) msg = string.lower(msg) if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < distancia_minima then selfSay(frase01,cid) focus = cid talk_start = os.clock() estado=1 elseif (msgcontains(msg, 'bye') and focus == cid) then selfSay(frase97) focus = 0 talk_start = 0 estado=0 elseif (msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < distancia_minima) then selfSay(frase02,cid) elseif (msgcontains(msg, 'addon doll') and (focus == cid) and (estado==1)) then selfSay(frase03,focus) talk_start = os.clock() estado=2 elseif msgcontains(msg, 'yes') then if getPlayerItemCount(cid, itemid1)>0 and getPlayerItemCount(cid, itemid2)>0 and getPlayerItemCount(cid, itemid3)>0 and getPlayerItemCount(cid, itemid4)>0 and getPlayerItemCount(cid, itemid5)>0 then doPlayerRemoveItem(cid, itemid1,1) doPlayerRemoveItem(cid, itemid2,1) doPlayerRemoveItem(cid, itemid3,1) doPlayerRemoveItem(cid, itemid4,1) doPlayerRemoveItem(cid, itemid5,1) doPlayerAddItem(cid, itemidADD,1) selfSay(frase04,focus) else selfSay(frase05,focus) end focus = 0 talk_start = 0 estado=0 end end   function onCreatureChangeOutfit(creature) end function onThink() if focus > 0 then if (((os.clock() - talk_start) > mintempo) or (getDistanceToCreature(focus) >= distancia_minima)) then selfSay(frase98) -- ate mais focus = 0 estado=0 end end  
     
    GOSTOU?? REP+
    =)
  2. Rafaelgaspar's post in (Resolvido)[Pedido] Falha Por Porcentagem was marked as the answer   
    fiz um aqui mano...
     
    "function onUse(cid, item, item2, frompos, topos, pos)
            local config = {                 ["Magic Plate Armor"] = {t1=2476,t2=2464,t3=2472}, -- t1 = ID do ITEM 1 |---| t2 = ID do ITEM 2 |---| t3 = ID do ITEM a ser FORJADO --                 ["Dragon Scale Mail"] = {t1=2489,t2=2487,t3=2492},                 ["Fireborn Giant Armor"] = {t1=8886,t2=2486,t3=8881},         }           local r1 = {x = 966, y = 599, z = 6, stackpos= 2} -- Posição 1 ( NÃO MEXA NO stackpos= 2 )         local r2 = {x = 968, y = 599, z = 6, stackpos= 2} -- Posição 2 ( NÃO MEXA NO stackpos= 2 )         local r3 = {x = 967, y = 599, z = 6} -- Posição do Item a Ser Criado           local q1 = getThingfromPos(r1)         local q2 = getThingfromPos(r2)         for i, x in pairs(config) do if (q1.itemid == x.t1 and q2.itemid == x.t2) or (q1.itemid == x.t2 and q2.itemid == x.t1) then doRemoveItem(q1.uid, 1) doRemoveItem(q2.uid, 1) if math.random(1,100) <= 50 then --aqui voce escolhe a chance addEvent(doCreateItem, 1000, x.t3, 1, r3) doSendMagicEffect(r3, 47) addEvent(doSendMagicEffect, 900, r3, 39) doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "{ForgeSystem} Parabéns, você forjou um " .. i .. ".") else doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "{ForgeSystem} Falha, o item quebrou.") end break end         end         return true end"
     
    depois tenta ae...
    SE GOSTOU, REP+
    =)

Informação Importante

Confirmação de Termo