Ir para conteúdo

Posts Recomendados

bom eu fiz rapidinhu aki intao n sei se fico bao mais se tive ficadu posta ae plzzzzzzz

pra compra as pbs tem q fala

blue backpack

red backpack

tiquanda backpack

golden backpack

yellow backpack

green backpack

wild backpack

simples backpack

purple backpack

 

PQ EU N PUS PIRATE BACKPACK NEM A LIBERY?? POR QUE NO DORION ELAS N DAO PRA POR NO LUGAR DAS BPS SO EDITANDU ELAS COM O ITEM EDITOR INTAO ACHEI MELHOR N COLOCAR!! QUANDO DER TEMPO EU FAÇU OTRO SO Q VENDI BP E BAG

 

 

<?xml version="1.0"?>

 

<npc name="The Dark Hell" script="data/npc/scripts/backpacks.lua" access="3" lookdir="1">

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

<look type="130" head="0" body="114" legs="0" feet="0" addon="1" know="1"/>

</npc>

 

 

AGORA O SCRIPT

 

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) .. '! Eu vendo backpacks de varias cores diga a cor e a palavra backpack.')
 		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, 'blue backpack') then
		buy(cid,2002,1,20)
	elseif msgcontains(msg, 'yellow backpack') then
		buy(cid,2004,1,20)
                              elseif msgcontains(msg, 'green backpack') then
		buy(cid,1998,1,20)
                              elseif msgcontains(msg, 'tiquanda backpack') then
		buy(cid,3940,1,20)
                              elseif msgcontains(msg, 'simples backpack') then
		buy(cid,1988,1,20)
                             elseif msgcontains(msg, 'red backpack') then
		buy(cid,2000,1,20)
                             elseif msgcontains(msg, 'wild backpack') then
		buy(cid,2003,1,20)
                             elseif msgcontains(msg, 'golden backpack') then
		buy(cid,1999,1,20)
                             elseif msgcontains(msg, 'purple backpack') then
		buy(cid,2001,1,20)



	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

Editado por Ventura
Editado para colocar a bbcode
Link para o comentário
https://xtibia.com/forum/topic/49104-npc-q-vendi-bps-coloridas/
Compartilhar em outros sites

  • 4 weeks later...
×
×
  • Criar Novo...