baratao
:smile_positivo: aew vai umas ides para quem gosta de banstante npc's!
VÁ EM DATA/NPC/SCRIPTS E COPIA UM ARQUIVO QUALQUER APAGA TD QUE TA DENTRO E COLA ISSO
local focus = 0
local talk_start = 0
local target = 0
local following = false
local 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
if isPremium(cid) then
selfSay('Hello ' .. creatureGetName(cid) .. '! I can take you to botucatu for 50 gold.')
focus = cid
talk_start = os.clock()
else
selfSay('Sorry, only premium players can travel by boat.')
focus = 0
talk_start = 0
end
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, 'botucatu') then
selfSay('Are you sure you want to go to botucatu?')
talk_state = 1
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
if pay(cid,50) then
travel(cid, 236, 219, 6)
selfSay('Let\'s go!')
else
selfSay('Sorry, you don\'t have enough money.')
end
end
talk_state = 0
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 (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
:withstupidsmiley:
DEPOIS VÁ E, NPC.XML COIA QUER ARQUIVO E COLA ISSU DENTRO
<npc name="jack" script="data/npc/scripts/fire.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="128" head="20" body="100" legs="50" feet="99" corpse="2212"/>
</npc>