Ir para conteúdo

Npc De Benção


FoReVeR

Posts Recomendados

1°passo

 

Abra um bloco de notas e cole isso:

<?xml version="1.0"?> 

<npc name="Blasser" script="data/npc/scripts/blessings.lua" access="3" lookdir="3" > 
  <health now="100" max="100"/> 
<look type="149" head="79" body="85" legs="21" feet="114" addon="3" know="3"/> 
</npc>

 

salve(na pasta data/npc) como blesser.xml

 

2° Passo

 

abra otro bloco de notas e cole isso:

focus = 0 
talk_start = 0 
target = 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('Good bye then.') 
         focus = 0 
         talk_start = 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, type, msg) 
    msg = string.lower(msg) 

    -- greeting phrase 
  if string.find(msg, '(%a*)hi(%a*)') and focus == 0 and string.len(msg) == 2 and getDistanceToCreature(cid) < 3 then 
     if isPremium(cid) then 
     selfSay('Hello ' .. creatureGetName(cid) .. '! You can ask me for the blessings.') 
        focus = cid 
        selfLook(cid) 
        talk_start = os.clock() 
     else 
        selfSay('Sorry, only premium players can have blessings.') 
        focus = 0 
        talk_start = 0 
     end    

          elseif focus == cid then 
     talk_start = os.clock() 

      
     if msgcontains(msg, 'blessings') then 
     selfSay('I will give first, second, third and fourth blessing, each 10k gold. After you die say unbless to buy blessings again.') 
      
      
     elseif msgcontains(msg, 'first') then 
     queststatus = getPlayerStorageValue(cid,7501) 
     if queststatus == -1 then 
     if pay(cid,10000) then 
     selfSay('/blessing ' .. creatureGetName(cid)) 
     selfSay('Great, now you are blessed with the first blessing.') 
     setPlayerStorageValue(cid,7501,1) 
     focus = 0 
     talk_start = 0 
     else 
     selfSay('Sorry, you need 10.000 gold coins.') 
      
     end 
     else 
     selfSay('Sorry, You already have this blessing') 
      
          end 

     elseif msgcontains(msg, 'second') then 
     queststatus2 = getPlayerStorageValue(cid,7502) 
     queststatus = getPlayerStorageValue(cid,7501) 
     if queststatus2 == -1 then 
     if queststatus ~= -1 then 
     if pay(cid,10000) then 
     selfSay('/blessing ' .. creatureGetName(cid)) 
     selfSay('Great, now you are blessed with the second blessing.')    
     setPlayerStorageValue(cid,7502,1) 
     focus = 0 
     talk_start = 0 
     else 
     selfSay('Sorry, you need 10.000 gold coins.') 
     end 
     else 
     selfSay('Sorry, You need first blessing') 
     end 
     else 
     selfSay('Sorry, You already have this blessing') 
     end    
   
     elseif msgcontains(msg, 'third') then 
     queststatus3 = getPlayerStorageValue(cid,7503) 
     queststatus2 = getPlayerStorageValue(cid,7502) 
     if queststatus3 == -1 then 
     if queststatus2 ~= -1 then 
     if pay(cid,10000) then 
     selfSay('/blessing ' .. creatureGetName(cid)) 
     selfSay('Great, now you are blessed with the third blessing.') 
     setPlayerStorageValue(cid,7503,1) 
     focus = 0 
     talk_start = 0 
     else 
     selfSay('Sorry, you need 10.000 gold coins.') 
     end 
     else 
     selfSay('Sorry, You need second blessing') 
     end 
     else 
     selfSay('Sorry, You already have this blessing') 
     end 

     elseif msgcontains(msg, 'fourth') then 
     queststatus4 = getPlayerStorageValue(cid,7504) 
     queststatus3 = getPlayerStorageValue(cid,7503) 
     if queststatus4 == -1 then 
     if queststatus3 ~= -1 then 
     if pay(cid,10000) then 
     selfSay('/blessing ' .. creatureGetName(cid)) 
     selfSay('Very nice, now you are blessed with all blessings, the gods will protect you when you die.') 
     setPlayerStorageValue(cid,7504,1) 
     focus = 0 
     talk_start = 0 
     else 
     selfSay('Sorry, you need 10.000 gold coins.') 
     end 
     else 
     selfSay('Sorry, You need third blessing') 
     end 
     else 
     selfSay('Sorry, You already have this blessing') 
     end 
      
     elseif msgcontains(msg, 'unbless') then 
     queststatus4 = getPlayerStorageValue(cid,7504) 
     queststatus3 = getPlayerStorageValue(cid,7503) 
     queststatus2 = getPlayerStorageValue(cid,7502) 
     queststatus1 = getPlayerStorageValue(cid,7501) 
     setPlayerStorageValue(cid,7501,-1) 
     setPlayerStorageValue(cid,7502,-1) 
     setPlayerStorageValue(cid,7503,-1) 
     setPlayerStorageValue(cid,7504,-1) 
     selfSay('Now, you are ready to buy blessings again.') 
     focus = 0 
     talk_start = 0 
      
                  
      
     elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then 
        selfSay('Good bye, ' .. creatureGetName(cid) .. '!') 
        focus = 0 
        talk_start = 0 
     end 
  end 
end 


function onCreatureChangeOutfit(creature) 

end 


function onThink() 
 
if focus == 0 then 
     selfWalk(2) 
  end    

if (os.clock() - talk_start) > 30 then 
       if focus > 0 then 
          selfSay('Farewell then.') 
       end 
          focus = 0 
    end 
   if focus ~= 0 then 
      if getDistanceToCreature(focus) > 3 then 
         selfSay('Farewell then.') 
         focus = 0 
      end 
   end 
end

 

Salve(na pasta data/npc/scripts) como blessings.lua

 

esta feito

 

Creditos: Thallys

Link para o comentário
Compartilhar em outros sites

0.0

 

vlw

 

tava procurando isto fax mt tempo

 

vou testar depois falo alguma coisa

 

mas já agora \/

 

/blessing ' .. creatureGetName(cid))

 

isto existe mesmo ?

 

em todos os servers ?

 

:hi:

Link para o comentário
Compartilhar em outros sites

  • 1 month later...

eu acho que esse sistema de blessing vem no zorzin, dai se voce tiver blessing tem menor chance de cair seus itens quando morre e perde menos exp.

Mas voce postou na área errada, a correta seria: Downloads/Scripts/NPC (se eu nao me engano).

Mas ótimo script ;D

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...