Ir para conteúdo

Posts Recomendados

oi galera primeiro ja vou agradecendo quem for me ajudar

eu ja tinha feito isso antes mais agora ta dando erro :blush:

não sei bem o motivo

 

a script e de promotion mais n qualqer promotion

uma q vc escolhe a promotion

meu ot tem 3 classes e 6 promoções onde vc escolhe qual torna ex:Guerreiro torna-se Cavaleiro ou Ninja

agora os erros

 

1-promove sem premmy

2-so funciona a segunda promotion

3-editei e n funciona mais nada -.-

entao ajuda aew plz XD

por favor se consequir conserta mande a scrip pronta para o seilacomo101@gmail.com plz XD

local focus = 0
local talk_start = 0
local target = 0
local days = 0

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') or msgcontains(msg, 'oi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
	  selfSay('Ola ' .. creatureGetName(cid) .. '! Eu vendo premium e posso lhe promover(Promotion 1 e 2 check o quadro ao lado).')
	  focus = cid
	  talk_start = os.clock()

 elseif msgcontains(msg, 'hi') or msgcontains(msg, 'oi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
	   selfSay('Desculpe, ' .. creatureGetName(cid) .. '! Falarei com voce em alguns instantes.')

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

	 if msgcontains(msg, 'promotion1') or msgcontains(msg, 'promote1') then
		  if getPlayerVocation(cid) > 3 then
			  selfSay('Desculpe, voce ja esta promovido, procure o principe do deserto para ser promovido novamente.')
			  talk_state = 0
		  elseif getPlayerLevel(cid) < 30 then
			 selfSay('Voce precisa ter no minimo level 30...')
			 talk_state = 0
					 elseif not isPremium(cid) then
			 selfSay('Compre uma premium antes, depois eu lhe promoverei.')
			 talk_state = 0
		 else
			 selfSay('Voce quer ser promovido por 20k?')
			 talk_state = 16
		 end
	 end
	 elseif msgcontains(msg, 'promotion2') or msgcontains(msg, 'promote2') then
		  if getPlayerVocation(cid) > 3 then
			  selfSay('Desculpe, voce ja esta promovido, procure o principe do deserto para ser promovido novamente.')
			  talk_state = 0
		  elseif getPlayerLevel(cid) < 30 then
			 selfSay('Voce precisa ter no minimo level 30...')
			 talk_state = 0
					 elseif not isPremium(cid) then
			 selfSay('Compre uma premium antes, depois eu lhe promoverei.')
			 talk_state = 0
		 else
			 selfSay('Voce quer ser promovido por 20k?')
			 talk_state = 15
		 end
	 end
	 elseif msgcontains(msg, 'premium') or msgcontains(msg, 'premmy') then
		 selfSay('Voce quer comprar 30 dias de premium por 10k?')
		 talk_state = 2

	 elseif talk_state == 16 then
		 if msgcontains(msg, 'yes') then
			 if pay(cid,20000) then
				 doPlayerSetVocation(cid, getPlayerVocation(cid)+3)
				 selfSay('Voce foi promovido!')
			 else
				 selfSay('Voce nao tem dinheiro suficiente.')
			 end
		  end
		 talk_state = 0

	 elseif talk_state == 15 then
		 if msgcontains(msg, 'yes') then
			 if pay(cid,20000) then
				 doPlayerSetVocation(cid, getPlayerVocation(cid)+6)
				 selfSay('Voce foi promovido!')
			 else
				 selfSay('Voce nao tem dinheiro suficiente.')
			 end
		  end
		 talk_state = 0

	 elseif talk_state == 2 then
		 if msgcontains(msg, 'yes') then
			 if pay(cid,10000) then
				 doPlayerAddPremiumDays(cid, 30)
				 selfSay('Voce recebeu 30 dias de premium!')
			 else
				 selfSay('Sorry, you do not have enough money.')
			 end
		 end
		 talk_state = 0

	   elseif msgcontains(msg, 'bye') or msgcontains(msg, 'tchao')  and getDistanceToCreature(cid) < 4 then
		   selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
		   focus = 0
		   talk_start = 0
	   end
   end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
 doNpcSetCreatureFocus(focus)
   if (os.clock() - talk_start) > 10 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 Luiz Cavalcanti
Link para o comentário
https://xtibia.com/forum/topic/112004-resolvido-erro-na-minha-script-talvez-vc-ate-goste-dela-npc/
Compartilhar em outros sites

Olá xTibiano !

 

 

Seguinte, notei alguns errinhos como a tag condition para premmy..

e outra coisa...

se o ot tem 4 classes.. e pra cada classe tem 2 tipos de promotion..

 

você tem que colocar para o npc checar.. se a vocação do kra eh maior que 1..

se for, então já é promotion, se não ele da a opção de escolher a promotion...

 

Repita o mesmo passo com as outras 3 classes..

 

Configure as talk action de cada 1 das 2 promotion q pode escolher..

La na parte de talkaction.. faça uma pra cada promoção...

 

Acho que isso pode ajudar.. ou pelo menos esclarecer alguma coisa =]

 

Não da pra explicar melhor, pq to no trampo.. mais se der a tarde eu do um edite..

 

Abraços

obrigado cara xD

tipo eu achei os erro sozinho mais a dica de configurar para cada classe foi uma boa xD

agora meu serve ta quase bom xD

falta eu consequi configura uma quest e fazer meu proprio mapa xD

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...