Ir para conteúdo

Npc Que Vende Rings!


Posts Recomendados

e um npc comum com addon

fiz ele no map dorion 7.9 do xedegux intao eu n testei em outros servidores

ele vendi roh,tr,lr,sr,ar,cr e uns ae q eu achu q eskeci ^^

 

tomara de ajude lah vai

 

<?xml version="1.0"?>

 

<npc name="Senhor Dos Aneis" script="data/npc/scripts/rings.lua" access="3" lookdir="3">

<health now="1" max="1"/>

<look type="146" head="0" body="40" legs="114" feet="0" corpse="3128"/>

</npc>

 

 

agora o script dele

 

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)

 

if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then

selfSay('Hello ' .. creatureGetName(cid) .. '! I sell life ring (2k), ring of healing (4k), club ring (2k), axe ring (3k), power ring (3k), energy ring (5k), time ring (6k) and sword ring (3k).')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

 

if msgcontains(msg, 'life ring') then

buy(cid,2168,1,3000)

elseif msgcontains(msg, 'sword ring') then

buy(cid,2207,1,2000)

elseif msgcontains(msg, 'ring of healing') then

buy(cid,2214,1,4000)

elseif msgcontains(msg, 'club ring') then

buy(cid,2209,1,2000)

elseif msgcontains(msg, 'axe ring') then

buy(cid,2208,1,3000)

elseif msgcontains(msg, 'power ring') then

buy(cid,2166,1,3000)

elseif msgcontains(msg, 'energy ring') then

buy(cid,2167,1,5000)

elseif msgcontains(msg, 'time ring') then

buy(cid,2169,1,6000)

 

 

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

x, y, z = creatureGetPosition(focus)

myx, myy, myz = selfGetPosition()

if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then

selfTurn(0)

end

if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then

selfTurn(2)

end

if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then

selfTurn(1)

end

if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then

selfTurn(3)

end

if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then

selfTurn(1)

end

if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then

selfTurn(3)

end

if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then

selfTurn(2)

end

if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then

selfTurn(0)

end

if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then

selfTurn(1)

end

if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then

selfTurn(3)

end

if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then

selfTurn(2)

end

if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then

selfTurn(0)

end

if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then

selfTurn(1)

end

if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then

selfTurn(3)

end

if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then

selfTurn(2)

end

if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then

selfTurn(0)

end

end

 

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

 

TOMARA Q VC USEM NO SERVE DE VCS ^^

Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...
Rox, mas tipo, como faz pra mudar o valor q vende cada um? e como faz pra vender só axe/sword/club e life ring?

Vlw :laughing:

 

 

e simples

 

if msgcontains(msg, 'life ring') then

buy(cid,2168,1,3000)

elseif msgcontains(msg, 'sword ring') then

buy(cid,2207,1,2000)

elseif msgcontains(msg, 'ring of healing') then

buy(cid,2214,1,4000)

elseif msgcontains(msg, 'club ring') then

buy(cid,2209,1,2000)

elseif msgcontains(msg, 'axe ring') then

buy(cid,2208,1,3000)

elseif msgcontains(msg, 'power ring') then

buy(cid,2166,1,3000)

elseif msgcontains(msg, 'energy ring') then

buy(cid,2167,1,5000)

elseif msgcontains(msg, 'time ring') then

buy(cid,2169,1,6000)

 

aki vc muda td q vc ker o cid n muda ,, o premero numero e o id do item tbm n muda o 1 e a quantidade e o 3 numero e o preçu tipow se vc por 10000 vai ser 10k ser por 1000 vai ser um

 

espero ter ajudado

Link para o comentário
Compartilhar em outros sites

  • 4 weeks later...
  • 6 months later...
  • 1 month later...
  • 4 weeks later...
  • 2 months later...
  • 2 years later...
×
×
  • Criar Novo...