Olá pessoal, venho trazer aqui o script do NPC 'Anunciante', não sei se já viram em algum server o que ele faz, porém ele apenas faz um 'anúncio' de um player qualquer. (broadcasted)
Ps.:Antes de ele anunciar ele cobra x de gold do player.
Testado em 8.54 ~ 8.6 TFS 0.4
Vamos lá ~> Vai em data/npc e crie um arquivo chamado Anunciante.xml e cole isto dentro dele:
Agora vá em data/npc/scripts e crie um arquivo chamado Anunciante.lua e cole isto dentro dele:
-- NPC Broadcaster by Alreth
-- Idea by souhlen (Anel)
-- Thanks to Qwerty| for helping fix the spambug
focus = 0
next_focus = 0
talk_start = 0
msgHi = 'Oi! Quer Anunciar algo para todo o servidor? So vou cobrar algumas moedinhas...'
msgBye = 'Volte sempre!'
price = 10000000 ----- Preço
inConvo = 0
broadcast = ''
cast = ''
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(msgBye)
distFocus = getDistanceToCreature(next_focus)
if (distFocus ~= nil and distFocus < 4) then
selfSay(msgHi)
talk_start = os.clock()
focus = next_focus
next_focus = 0
inConvo = 1
else
focus = 0
talk_start = 0
inConvo = 0
end
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)
msg2 = msg
msg = string.lower(msg)
if (cast ~= '') then
selfSay('does nothing')
-- do nothing, wait until message has been broadcasted and npc has replied
elseif (getDistanceToCreature(cid) >= 4 and focus == cid) then
selfSay('Chegue mais perto, '..getCreatureName(cid)..'. nao posso te ouvir dai.')
elseif (type == 1) then
if ((string.find(msg, '(%a*)hi(%a*)') or string.find(msg, '(%a*)hello(%a*)') or string.find(msg, '(%a*)oi(%a*)') or string.find(msg, '(%a*)greetings(%a*)')) and (focus == 0) and getDistanceToCreature(cid) < 4) then
selfSay(msgHi)
focus = cid
talk_start = os.clock()
inConvo = 1
elseif ((string.find(msg, '(%a*)hi(%a*)') or string.find(msg, '(%a*)hello(%a*)') or string.find(msg, '(%a*)oi(%a*)') or string.find(msg, '(%a*)greetings(%a*)')) and (focus ~= cid) and getDistanceToCreature(cid) < 4) then
if (next_focus > 0 and getDistanceToCreature(next_focus) < 4) then
info
Grupo: Campones
Registrado: 12/04/15
Posts: 24
Reputação: +2
Gênero: Masculino
Char no Tibia: Zetros / Gorillaz
Olá pessoal, venho trazer aqui o script do NPC 'Anunciante', não sei se já viram em algum server o que ele faz, porém ele apenas faz um 'anúncio' de um player qualquer. (broadcasted)
Ps.:Antes de ele anunciar ele cobra x de gold do player.
Testado em 8.54 ~ 8.6 TFS 0.4
Vamos lá ~> Vai em data/npc e crie um arquivo chamado Anunciante.xml e cole isto dentro dele:
<?xml version="1.0" encoding="UTF-8"?>
Agora vá em data/npc/scripts e crie um arquivo chamado Anunciante.lua e cole isto dentro dele:
Pronto, só ligar o seu servidor e já era.
Créditos: Alreth (Base), jeninson06 (remoção de erros e novas funções) e a mim pela correção, adaptação e tradução.
Editado Abril 12 por Zetros