Tibia | OpenTibiaServer

Forum o OTS i Tibii

  • Nie jesteś zalogowany.
  • Polecamy: Moda

  • Index
  •  » Skrypty
  •  » [8.0][NPC] Bankier Do Evolutions !!!

#1 2008-03-05 11:33:48

DemoN

Administrator

8840958
Call me!
Skąd: Wrocław
Zarejestrowany: 2008-02-04
Posty: 72
Punktów :   
WWW

[8.0][NPC] Bankier Do Evolutions !!!

Witam, Oto Skrypt NPC Bankier Do  Napisany Przez GM DemoN czyli mnie nie Życzę sobie Kopii tego skryptu, na tym forum !


OK to Zaczynamy, NPC Wygląda Jak CM aby to zmienić w funkcji zamiast Linijki :

Kod:

<look type="75" head="24" body="77" legs="10" feet="20"/>

Wpisz tą :

Kod:

<look type="128" head="24" body="77" legs="10" feet="20"/>

W Folderze npc   np.: OTS/Data/npc
utwórz plik Bankier.xml    (plik xml ale nazwa nie może zawierać tej końcówki .xml)

Skopiuj to \/ i wklej do pliku Bankier.xml

Kod:

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

potem w data\npc\scripts zrób plik bank.lua Wpisują do niego to \/

Kod:

-- RL Tibia Bank System by GM DemoN
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
local stan = 0
local stan_two = 0
local player_pattern = '^[a-zA-Z0-9 -]+$'
local number_pattern = '%d'
local target_cid = 0
local number_pattern_two = '%d+'
local b, e = 0
local count = 0
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end
    
    if getPlayerStorageValue(cid,8996) <= 0 then
        setPlayerStorageValue(cid,8996,0)
    end
        
    if msgcontains(msg, 'deposit') or msgcontains(msg, 'wplac') then
        if string.find(msg, number_pattern) then
            b, e = string.find(msg, number_pattern_two)
            count = tonumber(string.sub(msg, b, e))
            if pay(cid,count) then
                stan = getPlayerStorageValue(cid,8996) + count
                setPlayerStorageValue(cid,8996,stan)
                doPlayerRemoveMoney(cid,count)
                selfSay('Money was deposited!')
                talk_state = 0
            else
                selfSay('You dont have anought money!')
                talk_state = 0
            end
        else
            selfSay('How much money you want deposit?')
            talk_state = 1
        end
    elseif msgcontains(msg, 'withdraw') or msgcontains(msg, 'wyplac') then
        if string.find(msg, number_pattern) then
            b, e = string.find(msg, number_pattern_two)
            count = tonumber(string.sub(msg, b, e))
            if getPlayerStorageValue(cid,8996) - count >= 0 then
                stan = getPlayerStorageValue(cid,8996) - count
                setPlayerStorageValue(cid,8996,stan)
                doPlayerAddMoney(cid,count)
                selfSay('Money was withdrawed!')
                talk_state = 0
            else
                selfSay('You do not have anought money on account!')
                talk_state = 0
            end
        else
            selfSay('How much money you want withdraw?')
            talk_state = 2
        end
    elseif msgcontains(msg, 'transfer') or msgcontains(msg, 'transferuj') then
        selfSay('Want you for who transfer money?')
        talk_state = 3
    elseif msgcontains(msg, 'balance') or msgcontains(msg, 'stan') then
        selfSay('Your account balance is ' ..  getPlayerStorageValue(cid,8996) .. ' gp.')
        talk_state = 4              
    elseif talk_state == 1 then
       if string.find(msg, number_pattern) then
           if pay(cid,msg) then
              stan = getPlayerStorageValue(cid,8996) + msg
              setPlayerStorageValue(cid,8996,stan)
              doPlayerRemoveMoney(cid,msg)
              selfSay('Money was deposited!')
              talk_state = 0
           else
              selfSay('You dont have anought money!')
              talk_state = 0
           end
        else
            selfSay('There is not number!')
            talk_state = 0
        end
    elseif talk_state == 2 then
        stan = getPlayerStorageValue(cid,8996)
        if string.find(msg, number_pattern) then
            if getPlayerStorageValue(cid,8996) - msg >= 0 then
                stan = getPlayerStorageValue(cid,8996) - msg
                setPlayerStorageValue(cid,8996,stan)
                doPlayerAddMoney(cid,msg)
                selfSay('Money was withdrawed!')
                talk_state = 0
            else
                selfSay('You do not have anought money on account!')
                talk_state = 0
            end
        else
            selfSay('There is not number!')
            talk_state = 0
        end
    elseif talk_state == 3 then
        if string.find(msg, player_pattern) then
            target_cid = getPlayerByName(msg)
            if isPlayer(target_cid) == 1 then                            
                talk_state = 4
                selfSay('How much i must transfer?')
            else
                talk_state = 0
                selfSay('Player is not online or this player dont exists.Player must be online to transfer money on his account.')    
            end
        else
            selfSay('It isnt nick!')
            talk_state = 0
        end
    elseif talk_state == 4 then
        stan = getPlayerStorageValue(cid,8996)
        if string.find(msg, number_pattern) then
            if stan - msg >= 0 then
                stan_two = getPlayerStorageValue(target_cid,8996) + msg
                    stan = getPlayerStorageValue(cid,8996) - msg
                    setPlayerStorageValue(target_cid,8996,stan_two)
                    setPlayerStorageValue(cid,8996,stan)
                    doPlayerRemoveMoney(cid,msg)
                    talk_state = 0
                    selfSay('Money transfered.')
            else
                selfSay('You do not have anought money on account!')
                talk_state = 0
            end
        else
            selfSay('There is not number!')
            talk_state = 0
        end
    elseif talk_state == 5 then                
    end
           
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Tibia | OpenTibiaServer
Metin 2
Plemiona
Ogame


Zielony to mój kolor edycji postów


http://www.speedtest.net/result/235633040.png

Offline

 

#2 2008-05-04 09:02:48

Azkob The Legend

Użytkownik

Zarejestrowany: 2008-05-03
Posty: 16
Punktów :   

Re: [8.0][NPC] Bankier Do Evolutions !!!

wielkie thx przyda sie kumplowi ?


http://img57.imageshack.us/img57/6830/sig9ea.gif
http://www.wrzuta.pl/images_2/audio.gif.jpg
Posłuchaj

Offline

 
  • Index
  •  » Skrypty
  •  » [8.0][NPC] Bankier Do Evolutions !!!

Stopka forum

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


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.najlepszemotylki.pun.pl www.thelgilius.pun.pl www.eeitp.pun.pl www.tvnmajka.pun.pl www.robaki.pun.pl