bom isso é mtu facil de fazer mais tem muita gente q nao sabe
e isso tbm é pra vc n ter q fika editando o char do cara mudando o templw
ok:
crie um arqivo.lua na pasta data/npc/scrpits
pode ser qualquer nome eu uso por exemplo:temple_tiquanda_edron
ou sei la
dia abre ele e bota isso:
focus = 0talk_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 ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 3 then
selfSay('oi ' .. creatureGetName(cid) .. '! eu faço vc morar em edron (50gps) ou em tiquanda (50gps) vc ker??')
focus = cid
talk_start = os.clock()
end
if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 3 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')
end
if msgcontains(msg, 'edron') and focus == cid then
if pay(cid,50) then
selfSay('Let\'s go!')
setPlayerMasterPos(cid,238,155,8)
selfSay('/send ' .. creatureGetName(cid) .. ', 238 155 8')
focus = 0
talk_start = 0
else
selfSay('Sorry, you don\'t have enough money.')
talk_start = os.clock()
end
end
if msgcontains(msg, 'tiquanda') and focus == cid then
if pay(cid,50) then
selfSay('Let\'s go!')
setPlayerMasterPos(cid,160,54,7)
selfSay('/send ' .. creatureGetName(cid) .. ', 160 54 7')
focus = 0
talk_start = 0
else
selfSay('Sorry, you don\'t have enough money.')
talk_start = os.clock()
end
end
if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 3 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
end
resumindo:
if msgcontains(msg, 'tiquanda') and focus == cid then
if pay(cid,50) then
selfSay('Let\'s go!')
setPlayerMasterPos(cid,160,54,7)
selfSay('/send ' .. creatureGetName(cid) .. ', 160 54 7')
tiquanda oq o player fala
dai ali em setPlayerMasterPos(cid,160,54,7) seria a coordenada x y z
e no final
selfSay('/send ' .. creatureGetName(cid) .. ', 160 54 7')
enviar o player pra a coordenada xyz
iso vc muda de acordo com o seu gosto
dai é só faze o arquivo .xml du npc e talz
foi mal se fico mal explicado é q aki é ano novo e ta começando a festa aki em casa flws