• logo_cipsoft
    Nowe serwery zostały otwarte 19 Lut 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

NPC NPC Bankier (Rozmienia kase)

Status
Zamknięty.

Hakeq

Banned
Dołączył
Marzec 23, 2013
Posty
103
Liczba reakcji
6
Autor: Serafin
Nie bede sie rozpisywal.

Kod:
<?xml version="1.0"?>
<npc name="Bankier" script="data/npc/scripts/bankier.lua" access="3">
<look type="128" head="118" body="37" legs="37" feet="118"/>
</npc>

I w data/npc/scripts/bankier.lua wpisz:

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.')
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, ' .. creatureGetName(cid) .. '. Moge zmienic paczki crystal coins na scarab coins [1,10,20,30] i scarab coins na crystal coins [scarab].')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Wait your turn.')

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

if msgcontains(msg, 'job') then
selfSay('Jestem bankierem.')

elseif msgcontains(msg, '1') then
buy(cid,2159,1,1000000)

elseif msgcontains(msg, '10') then
buy(cid,2159,10,10000000)

elseif msgcontains(msg, '20') then
buy(cid,2159,20,20000000)

elseif msgcontains(msg, '30') then
buy(cid,2159,30,30000000)

elseif msgcontains(msg, '40') then
buy(cid,2159,40,40000000)

elseif msgcontains(msg, '50') then
buy(cid,2159,50,50000000)

elseif msgcontains(msg, '60') then
buy(cid,2159,60,60000000)

elseif msgcontains(msg, '70') then
buy(cid,2159,70,70000000)

elseif msgcontains(msg, '80') then
buy(cid,2159,80,80000000)

elseif msgcontains(msg, '90') then
buy(cid,2159,90,90000000)

elseif msgcontains(msg, '100') then
buy(cid,2159,100,100000000)

elseif msgcontains(msg, 'scarab') then
buy(cid,2160,100,1000000)

elseif msgcontains(msg, 'bye') 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('Who is next?')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye, then.')
focus = 0
end
end
end

Nie testowalem ale powinien dzialac. Jak nie dziala to zmodyfikuje.

Pozdrawiam,
Hakeq.
 
Status
Zamknięty.
Do góry