Drzamich
Dołączył: 29 Cze 2006
Posty: 58
Przeczytał: 0 tematów
Ostrzeżeń: 0/5
|
Wysłany: Nie 10:23, 28 Sty 2007 Temat postu: Skrypt na kolorowe backpacki |
|
|
Drogi Hosterze.
Umieszczam tutaj skrypt do NPC sprzedającego kolorowe Backpacki i Bagi.
Fajnie by było, gdybyś umieścił go na serverze.
w data/npc/scripts tworzmy plik bag.lua
A w nim:
Cytat: | focus = 0
talk_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 (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell bags and backpacks in all colors.')
focus = cid
talk_start = os.clock()
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, 'backpacks') and focus == cid then
selfSay('I sell brown, yellow, gold, blue, red, purple, green, silver, jungle, shell and pirate bags and backpacks.')
focus = cid
talk_start = os.clock()
end
if msgcontains(msg, 'brown backpack') then
buy(cid,1988,1,25)
elseif msgcontains(msg, 'yellow backpack') then
buy(cid,1999,1,25)
elseif msgcontains(msg, 'gold backpack') then
buy(cid,2004,1,25)
elseif msgcontains(msg, 'blue backpack') then
buy(cid,2002,1,25)
elseif msgcontains(msg, 'red backpack') then
buy(cid,2000,1,25)
elseif msgcontains(msg, 'purple backpack') then
buy(cid,2001,1,25)
elseif msgcontains(msg, 'green backpack') then
buy(cid,1998,1,25)
elseif msgcontains(msg, 'silver backpack') then
buy(cid,2003,1,25)
elseif msgcontains(msg, 'jungle backpack') then
buy(cid,3940,1,25)
elseif msgcontains(msg, 'pirate backpack') then
buy(cid,5926,1,25)
elseif msgcontains(msg, 'shell backpack') then
buy(cid,5949,1,25)
elseif msgcontains(msg, 'brown bag') then
buy(cid,1987,1,15)
elseif msgcontains(msg, 'yellow bag') then
buy(cid,1992,1,15)
elseif msgcontains(msg, 'gold bag') then
buy(cid,1997,1,15)
elseif msgcontains(msg, 'blue bag') then
buy(cid,1995,1,15)
elseif msgcontains(msg, 'red bag') then
buy(cid,1993,1,15)
elseif msgcontains(msg, 'purple bag') then
buy(cid,1994,1,15)
elseif msgcontains(msg, 'green bag') then
buy(cid,1991,1,15)
elseif msgcontains(msg, 'silver bag') then
buy(cid,1996,1,15)
elseif msgcontains(msg, 'jungle bag') then
buy(cid,3939,1,15)
elseif msgcontains(msg, 'pirate bag') then
buy(cid,5927,1,15)
elseif msgcontains(msg, 'shell bag') then
buy(cid,5950,1,15)
elseif msgcontains(msg, 'bye') and focus == cid 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 |
Potem w data/npc tworzmy plik Verpan.xml
A w nim:
Cytat: | <?xml version="1.0"?>
<npc name="Verpan" script="data/npc/scripts/bag.lua" access="3">
<look type="146" head="78" body="88" legs="0" feet="88"/>
</npc> |
Potem w data/world otwieramy przed notatkin plik Evolutions-spawn
i dodajemy tam linijki:
Cytat: |
<spawn centerx="tu pozycja x" centery="tu pozycja y" centerz="tu pozycja z" radius="1">
<npc name="verpan" x="0" y="0"/>
</spawn>
|
Mam nadzieję że sie przyda, ponieważ kolorowe Backpacki to niezłe urozmaicenie servera.
Post został pochwalony 0 razy
|
|