#1 2008-02-05 12:17:41

Viktor

New member

Zarejestrowany: 2008-02-05
Posty: 4
Punktów :   

[NPC]Barman

Najpierw w data\npc\ tworzymy plik Barman.xml i wklejamy w nim to:

Kod:

<?xml version="1.0"?>
<npc name="Barman" script="data/npc/scripts/alkoholen.lua" access="3">
<look type="128" head="39" body="40" legs="67" feet="76"/>
</npc>

pozniej w data\npc\scripts tworzymy plik alkoholen.lua i wklejamy w nim to:

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('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('Witaj w mojej karczmie, sprzedaje tu piwo i wino')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Czekaj, kazdy sie napije !!.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'piwo') then
selfSay('Moge ci nalac takie piwa: tibijskie, grzane, chlodzone, palone, mocne, light po 10 gp za flaszke!')

elseif msgcontains(msg, 'tibijskie') then
buy(cid,2006,3,10)

elseif msgcontains(msg, 'grzane') then
buy(cid,2006,3,10)

elseif msgcontains(msg, 'chlodzone') then
buy(cid,2006,3,10)

elseif msgcontains(msg, 'palone') then
buy(cid,2006,3,10)

elseif msgcontains(msg, 'mocne') then
buy(cid,2006,3,10)

elseif msgcontains(msg, 'light') then
buy(cid,2006,3,10)

elseif msgcontains(msg, 'wino') then
selfSay('moge ci sprzedac butelke z takimi winami: "komandos" -10gp, "wino marki wino" - 9gp "Vermuth" -20gp "spocony cyklop" -15gp "elficki trunek" -100gp "goblinskie wymiociny" -5gp "trup" -15gp')

elseif msgcontains(msg, 'komandos') then
buy(cid,2006,15,9)
elseif msgcontains(msg, 'wino marki wino') then
buy(cid,2006,15,9)

elseif msgcontains(msg, 'vermuth') then
buy(cid,2006,15,20)

elseif msgcontains(msg, 'spocony cyklop') then
buy(cid,2006,15,15)

elseif msgcontains(msg, 'elficki trunek') then
buy(cid,2006,15,100)

elseif msgcontains(msg, 'goblinskie wymiociny') then
buy(cid,2006,15,5)

elseif msgcontains(msg, 'trup') then
buy(cid,2006,15,15)

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Do zobaczenia, ' .. 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('Boze tak wczesnie a ten juz nawalony, kto chce piwa?')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Dobrze ze chociarz zaplacil')
focus = 0
end
end
end

Offline

 

#2 2009-04-22 16:43:41

Elixa

New member

Zarejestrowany: 2009-04-22
Posty: 2
Punktów :   

Re: [NPC]Barman

przetestuje czy działa i odpisze

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora