Ir para conteúdo

Posts Recomendados

Vo posta um npc que vende Promoção exemplo quando o cara da look em alguem aparece druid ele vende a promoção dai vai aparece Elder Druid. O primeiro que fala mal eu numca mais apareço no forum xtibia to nervozo cum esses noob da dsigraça que fika falando ##### so pq naum sabe

Ai vai o Script pro npc:

 

focus = 0talk_start = 0target = 0following = falseattacking = falsefunction onThingMove(creature, thing, oldpos, oldstackpos)endfunction onCreatureAppear(creature)endfunction onCreatureDisappear(cid, pos)  if focus == cid then         selfSay('Good bye then.')         focus = 0         talk_start = 0  endendfunction onCreatureTurn(creature)endfunction msgcontains(txt, str)  return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))endfunction onCreatureSay(cid, type, msg)  msg = string.lower(msg)  if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then  selfSay('Hello ' .. creatureGetName(cid) .. '! I sell promotions for 20k.')  focus = cid  talk_start = os.clock()	elseif string.find(msg, '(%a*)hi(%a*)') 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, 'promotion') then  	if isPromoted(cid) then    selfSay('Sorry, you are already promoted.')    focus = 0  	else    if getPlayerLevel(creatureGetName(cid)) >= 20 then    	if pay(cid,20000) then      promote(cid)      selfSay('You are now promoted!')    	else      selfSay('Sorry, you do not have enough money.')    	end    else    	selfSay('Sorry, you need level 20 to buy promotion.')    end  	end  	elseif string.find(msg, '(%a*)bye(%a*)')  and getDistanceToCreature(cid) < 4 then    selfSay('Good bye, ' .. creatureGetName(cid) .. '!')    focus = 0    talk_start = 0  	end  endendfunction onCreatureChangeOutfit(creature)endfunction onThink()  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	endend

 

é isso ai

Link para o comentário
https://xtibia.com/forum/topic/2231-promotion/
Compartilhar em outros sites

  • Respostas 33
  • Created
  • Última resposta

Top Posters In This Topic


×
×
  • Criar Novo...