Defozo
Quara Predator Scout
Dołączył: 15 Sty 2007
Posty: 94
Przeczytał: 0 tematów
Ostrzeżeń: 0/5 Skąd: Gdzieś :)
|
Wysłany: Pon 14:46, 15 Sty 2007 Temat postu: [7.6][npc] Npc sprzedający bp i bagi |
|
|
Npc sprzedający bp i bagi
Ten Skrypt został zrobiony na życzenie ;d
bp.lua
Kod: | 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('Do widzenia.')
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) < 4 then
selfSay('Siema, ' .. creatureGetName(cid) .. '! Sprzedaje kolorowe plecaki po 20 jesli chesz kupic kolorwoy plecak napisz (zielony plecak itd.:) gps i kolorowe worki po 10 gps jesli chesz kupic worek napisz(czerwony worek).')
focus = cid
talk_start = os.clock()
elseif string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! Porozmawiam z toba za minute.')
elseif msgcontains(msg, 'zwykly plecak') and focus == cid then
buy(cid,1988,1,20)
talk_start = os.clock()
elseif msgcontains(msg, 'zielony plecak') and focus == cid then
buy(cid,1998,1,20)
talk_start = os.clock()
elseif msgcontains(msg, 'zolty plecak') and focus == cid then
buy(cid,1999,1,20)
talk_start = os.clock()
elseif msgcontains(msg, 'czerwony plecak') and focus == cid then
buy(cid,2000,1,20)
talk_start = os.clock()
elseif msgcontains(msg, 'fioletowy plecak') and focus == cid then
buy(cid,2001,1,20)
talk_start = os.clock()
elseif msgcontains(msg, 'niebieski plecak') and focus == cid then
buy(cid,2002,1,20)
talk_start = os.clock()
elseif msgcontains(msg, 'szary plecak') and focus == cid then
buy(cid,2003,1,20)
talk_start = os.clock()
elseif msgcontains(msg, 'zloty plecak') and focus == cid then
buy(cid,2004,1,20)
talk_start = os.clock()
elseif msgcontains(msg, 'zielony worek') and focus == cid then
buy(cid,1991,1,10)
talk_start = os.clock()
elseif msgcontains(msg, 'zolty worek') and focus == cid then
buy(cid,1992,1,10)
talk_start = os.clock()
elseif msgcontains(msg, 'czerwony worek') and focus == cid then
buy(cid,1993,1,10)
talk_start = os.clock()
elseif msgcontains(msg, 'fioletowy worek') and focus == cid then
buy(cid,1994,1,10)
talk_start = os.clock()
elseif msgcontains(msg, 'niebieski worek') and focus == cid then
buy(cid,1995,1,10)
talk_start = os.clock()
elseif msgcontains(msg, 'szary worek') and focus == cid then
buy(cid,1996,1,10)
talk_start = os.clock()
elseif msgcontains(msg, 'zloty worek') and focus == cid then
buy(cid,1997,1,10)
talk_start = os.clock()
elseif msgcontains(msg, 'zwykly worek') and focus == cid then
buy(cid,2791,1,10)
talk_start = os.clock()
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Nastepny prosze...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Do widzenia.')
focus = 0
end
end
end |
BP.xml
Kod: | <?xml version="1.0"?>
<npc name="BP" script="data/npc/scripts/bp.lua" access="3">
<look type="129" head="76" body="114" legs="124" feet="86"/>
</npc>
|
To chyba tyle? ;]
Post został pochwalony 0 razy
|
|