Bom, eu criei este NPC pois estou meio cansado de todo mundo com a memsa backpack e bag...
Então comecemos.
Vá em data/npc, crie um arquivo xml com o nome "Olivier"...Dentro dele escreva:
<?xml version="1.0"?>
<npc name="Olivier" script="data/npc/scripts/backpack.lua" access="3" lookdir="2">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="132" head="23" body="114" legs="114" feet="114"/>
</npc>
Agora vá em data/npc/scripts, crie um arquivo lua com o nome "backpack"...Dentro dele escreva:
local focus = 0local 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('Adeus.')
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)
local msg = string.lower(msg)
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Ola ' .. getCreatureName(cid) .. '! Eu vendo backpacks e bags.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
selfSay('Desculpe, ' .. getCreatureName(cid) .. '! Eu ja falo com você.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'backpacks') then
selfSay('Eu vendo poison backpack, solar backpack, fire backpack, roxeus backpack, water backpack, backpack of stone, orange backpack, star backpack, jungle backpack, pirate backpack, fury backpack, backpack of holding e backpack comum.Todas custam 100Gps.')
elseif msgcontains(msg, 'bags') then
selfSay('Temos a poison bag, solar bag, fire bag, roxeus bag, water bag, bag of stone. orange bag, star bag, jungle bag, pirate bag, fury bag e bag comum.Todas custam por 50 Gps.')
elseif msgcontains(msg, 'backpack comum') then
buy(cid,1988,1,100)
elseif msgcontains(msg, 'poison backpack') then
buy(cid,1998,1,100)
elseif msgcontains(msg, 'solar backpack') then
buy(cid,1999,1,100)
elseif msgcontains(msg, 'fire backpack') then
buy(cid,2000,1,100)
elseif msgcontains(msg, 'roxeus backpack') then
buy(cid,2001,1,100)
elseif msgcontains(msg, 'water backpack') then
buy(cid,2002,1,100)
elseif msgcontains(msg, 'backpack of stone') then
buy(cid,2003,1,100)
elseif msgcontains(msg, 'orange backpack') then
buy(cid,2004,1,100)
elseif msgcontains(msg, 'jungle backpack') then
buy(cid,3940,1,100)
elseif msgcontains(msg, 'pirate backpack') then
buy(cid,5926,1,100)
elseif msgcontains(msg, 'fury backpack') then
buy(cid,7342,1,100)
elseif msgcontains(msg, 'backpack of holding') then
buy(cid,2365,1,100)
elseif msgcontains(msg, 'star backpack') then
buy(cid,5949,1,100)
elseif msgcontains(msg, 'bag comum') then
buy(cid,1987,1,50)
elseif msgcontains(msg, 'poison bag') then
buy(cid,1991,1,50)
elseif msgcontains(msg, 'solar bag') then
buy(cid,1992,1,50)
elseif msgcontains(msg, 'fire bag') then
buy(cid,1993,1,50)
elseif msgcontains(msg, 'roxeus bag') then
buy(cid,1994,1,50)
elseif msgcontains(msg, 'water bag') then
buy(cid,1995,1,50)
elseif msgcontains(msg, 'bag of stone') then
buy(cid,1996,1,50)
elseif msgcontains(msg, 'orange bag') then
buy(cid,1997,1,50)
elseif msgcontains(msg, 'jungle bag') then
buy(cid,3939,1,50)
elseif msgcontains(msg, 'pirate bag') then
buy(cid,5927,1,50)
elseif msgcontains(msg, 'fury bag') then
buy(cid,7343,1,50)
elseif msgcontains(msg, 'star bag') then
buy(cid,5950,1,50)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Adeus, ' .. getCreatureName(cid) .. ', obrigado e volte sempre!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 20 then
if focus > 0 then
selfSay('Proximo!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Proximo!')
focus = 0
end
end
end
Fiquem a vontade para editar o nome das backpacks e bags como eu fiz.
SS:
Espero que gostem...
Atenciosamente,
Dartilus