Opis forum
Mam nadzieje ze Devil to wykorzysta :P
...wiem że może nie jest to nic trudnego ale może komuś się przyda :D
w data\npc tworzymy plik Bp Seller.xml i wklejamy do niego to:
<?xml version="1.0"?>
<npc name="Bp Seller" script="data/npc/scripts/bp seller.lua" access="3">
<look type="133" head="0" body="81" legs="114" feet="0"/>
</npc>
następnie w data\npc\scripts tworzymy bp seller.lua i wklejamy to :
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('hi.')
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('Siemka ' .. creatureGetName(cid) .. '! Sellne ci backpacki i bagi wszystkich kolorow tylko po 35 i 20 gp!.. Powiedz backpack albo bag a powiem ci co i jak')
focus = cid
talk_start = os.clock()
end
if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('No kurwa, ' .. creatureGetName(cid) .. '! Poczekaj,widzisz ze opylam??.')
end
if msgcontains(msg, 'backpack') and focus == cid then
selfSay('Moge ci sprzedac kolory:zielony,zolty,czerwony,fioletowy,niebieski, szary,zloty,jungle i zwykle.Powiedz np.niebieski bp aby go kupic^^')
end
if msgcontains(msg, 'bag') and focus == cid then
selfSay('Moge ci sprzedac kolory:zielony,zolty,czerwony,fioletowy,niebieski, szary,zloty,jungle i zwykle.Powiedz np.zielony bag aby go kupic:]')
end
if msgcontains(msg, 'zwykly bag') and focus == cid then
buy(cid,1987,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'zielony bag') and focus == cid then
buy(cid,1991,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'zolty bag') and focus == cid then
buy(cid,1992,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'czerwony bag') and focus == cid then
buy(cid,1993,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'fioletowy bag') and focus == cid then
buy(cid,1994,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'niebieski bag') and focus == cid then
buy(cid,1995,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'szary bag') and focus == cid then
buy(cid,1996,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'zloty bag') and focus == cid then
buy(cid,1997,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'jungle bag') and focus == cid then
buy(cid,3939,1,20)
talk_start = os.clock()
end
if msgcontains(msg, 'zwykly bp') and focus == cid then
buy(cid,1988,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'zielony bp') and focus == cid then
buy(cid,1998,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'zolty bp') and focus == cid then
buy(cid,1999,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'czerwony bp') and focus == cid then
buy(cid,2000,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'fioletowy bp') and focus == cid then
buy(cid,2001,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'niebieski bp') and focus == cid then
buy(cid,2002,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'szary bp') and focus == cid then
buy(cid,2003,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'zloty bp') and focus == cid then
buy(cid,2004,1,35)
talk_start = os.clock()
end
if msgcontains(msg, 'jungle bp') and focus == cid then
buy(cid,3940,1,35)
talk_start = os.clock()
end
if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Nie to nie zegnaj, ' .. 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('Nastepny ...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Cya.')
focus = 0
end
end
end
na końcu w data\world w pliku npc.xml dodajemy taka linijkę
<npc name="Bp Seller" x="121" y="54" z="7" dir="1"/>
litery X Y Z oznaczają położenie NPC a mapie ;] można to zawsze zmienić.
Offline