Forum OTS Red Castle
Forum Red Castle
 
 FAQFAQ   SzukajSzukaj   UżytkownicyUżytkownicy   GrupyGrupy  GalerieGalerie   RejestracjaRejestracja 
 ProfilProfil   Zaloguj się, by sprawdzić wiadomościZaloguj się, by sprawdzić wiadomości   ZalogujZaloguj 

NPC Bankier

 
Napisz nowy temat   Odpowiedz do tematu    Forum OTS Red Castle Strona Główna -> Skrypty itp.
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
son_of_sillve
Miotacz Postów



Dołączył: 09 Kwi 2007
Posty: 167
Przeczytał: 0 tematów

Ostrzeżeń: 0/5
Skąd: Z Nienacka

PostWysłany: Śro 19:48, 16 Maj 2007    Temat postu: NPC Bankier

najzwyczajniej w świecie Bankier, który tworzy konto bankowe i (cienki z matmy jestem i nie umiem tego nazwać Razz) no chodzi o pojęcie, do którego należy słowo kapitał...
skrypt nie mój, ale podoba mi się Smile

data/npc/scripts robimy plik bank.lua i wklejamy:

Kod:
---bank system by GM Maciej---


focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talkstate = 0

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
talkstate = 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
queststatus = getPlayerStorageValue(cid,1234)
if queststatus == 1 then
selfSay('CZCIGODNY... w czym ja, twoj unizony sluga moge ci pomoc ??')
focus = cid
talk_start = os.clock()
else

selfSay('Witam w moim banku ' .. creatureGetName(cid) .. '! Chcesz "wplacic" czy "pobrac" pieniadze ?? Wplaty dokonujemy po 10k. Codziennie zyskasz 4% tego co wplaciles !! Odsetki naliczamy od ostatniej wplaty !!!')
focus = cid
talk_start = os.clock()
end
end

if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Wybacz, ' .. creatureGetName(cid) .. '! rozmawiam juz z kims.')
end

if msgcontains(msg, 'wplacic') and focus == cid then
bankstatus = getPlayerStorageValue(cid,104)
if bankstatus == -1 then
if pay(cid,10000) then
miesiac = os.date('%m')
rok = os.date('%Y')
dzien = os.date('%d')

---created by GM Maciej---
setPlayerStorageValue(cid,101,rok)
setPlayerStorageValue(cid,102,miesiac)
setPlayerStorageValue(cid,103,dzien)
setPlayerStorageValue(cid,104,1)
setPlayerStorageValue(cid,105,10000)
selfSay('Zalorzyles konto, masz na nim 10k')
else
selfSay('Brak ci pieniedzy aby zalorzyc konto !!')
end
talk_start = os.clock()
else
kapital = getPlayerStorageValue(cid,105)
miesiac = os.date('%m')
rok = os.date('%Y')
dzien = os.date('%d')
kr = getPlayerStorageValue(cid,101)
km = getPlayerStorageValue(cid,102)
kd = getPlayerStorageValue(cid,103)
ilelat = kr - rok
if ilelat == 0 then
ilemiesiecy = miesiac - km
else
mdk = 12 - km
ilemiesiecy = mdk + miesiac
end
if ilemiesiecy == 0 then
iledni = dzien - kd
else
ddk = 30 - kd
ilemieswdniach = ilemiesiecy * 30
iledni = ddk + ilemieswdniach
end
createdbygmmaciej = iledni * kapital * 4
ilekasyd = createdbygmmaciej / 100
ilekasy = kapital + ilekasyd
setPlayerStorageValue(cid,105,ilekasy)
selfSay('Na koncie masz teraz '..ilekasy..' chcesz wplacic kolejne 10k ? "tak" "nie"')
talkstate = 1

end
end

if msgcontains(msg, 'tak') and talkstate == 1 then
if pay(cid,10000) then
miesiac = os.date('%m')
rok = os.date('%Y')
dzien = os.date('%d')

---created by GM Maciej---
setPlayerStorageValue(cid,101,rok)
setPlayerStorageValue(cid,102,miesiac)
setPlayerStorageValue(cid,103,dzien)
ile = getPlayerStorageValue(cid,105)
createdbygmmaciej = ile + 10000
setPlayerStorageValue(cid,105,createdbygmmaciej)

selfSay('Wplaciles kase.')
else
selfSay('Nie masz 10k!!')
end
talk_start = os.clock()

end

if msgcontains(msg, 'nie') and talkstate == 1 then
selfSay('To co mi glowe zawracasz ?.')
talk_start = os.clock()
end
if msgcontains(msg, 'pobrac') and focus == cid then
kapital = getPlayerStorageValue(cid,105)
miesiac = os.date('%m')
rok = os.date('%Y')
dzien = os.date('%d')
kr = getPlayerStorageValue(cid,101)
km = getPlayerStorageValue(cid,102)
kd = getPlayerStorageValue(cid,103)
ilelat = kr - rok
if ilelat == 0 then
ilemiesiecy = km - miesiac
else
mdk = 12 - km
ilemiesiecy = mdk + miesiac
end
if ilemiesiecy == 0 then
iledni = kd - dzien
else
ddk = 30 - kd
ilemieswdniach = ilemiesiecy * 30
iledni = ddk + ilemieswdniach
end
ilepr = iledni * kapital * 4
ilekasyd = ilepr / 100
ilekasy = kapital + ilekasyd
setPlayerStorageValue(cid,105,ilekasy)
selfSay('Masz na koncie '..ilekasy..' ile chcesz wyplacic? "10k" czy "1k" ??')
talkstate = 2
talk_start = os.clock()

end

if msgcontains(msg, '10k') and talkstate == 2 then
ile = getPlayerStorageValue(cid,105)
if ile >= 10000 then
buy(cid,2160,1,0)

ilekasyteraz = ile - 10000
setPlayerStorageValue(cid,105,ilekasyteraz)
talk_start = os.clock()
else
selfSay('Nie masz tyle na koncie')
talk_start = os.clock()
end
end

if msgcontains(msg, '1k') and talkstate == 2 then
ile = getPlayerStorageValue(cid,105)
if ile >= 1000 then
buy(cid,2152,10,0)

ilekasyteraz = ile - 1000
setPlayerStorageValue(cid,105,ilekasyteraz)
talk_start = os.clock()
else
selfSay('Nie masz tyle na koncie')
talk_start = os.clock()
end
end








if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('Miles zabawy , ' .. 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('Do zobaczenia.')
focus = 0
end
end
end


następnie plik w data/npc Bankier.xml i walimy tam to:

Kod:
<?xml version="1.0"?>
<npc name="Bankier" script="data/npc/scripts/bank.lua" access="3">
<look type="128" head="24" body="77" legs="10" feet="20"/>
</npc>


życzę wysokich kapitałów ;PPPP


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Wyświetl posty z ostatnich:   
Napisz nowy temat   Odpowiedz do tematu    Forum OTS Red Castle Strona Główna -> Skrypty itp. Wszystkie czasy w strefie EET (Europa)
Strona 1 z 1

 
Skocz do:  
Możesz pisać nowe tematy
Możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach


fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2002 phpBB Group
Regulamin