• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC Banker NPC (transfer!, deposit, withdraw, balance)

Hi!

Please look:

Code:
21:05 Gudio [9]: hi
21:05 Bank: Hello Gudio! What can I do for you? Deposit, withdraw, check balance or transfer?
21:05 Gudio [9]: deposit
21:05 Bank: Please tell me how much gold it is you would like to deposit.
21:05 Gudio [9]: 9999999999
21:05 Bank: Would you really like to deposit  9999999999 gold?
21:05 Gudio [9]: yes
21:05 Bank: You do not have enough gold.
21:06 Gudio [9]: deposit 999999999999999 yes
[B]21:06 Bank: Alright, we have added the amount of 1e+015 gold to your balance. You can withdraw your money anytime you want to. Youraccount balance is 2764472319.[/B]
21:06 Gudio [9]: balance
21:06 Bank: [B]Your account balance is 2764472319 gold.[/B]

I haven't money in my character... This is bug NPC.
Please look your ots ;-)
 
00:18 Gesior Banker: Hello Teste! What can I do for you? Deposit, withdraw, check balance or transfer?
00:18 Teste [200]: deposit 100
00:18 Teste [200]: yes

not function in TFS 0.3.0 SQL ??
 
Use this npc it is the best working on TFS as well:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
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
 
 
---------Begin-Dont--Tough!--Noob--censative
function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end
 
    local count = (getCount(msg))        
    local oldcount = getPlayerStorageValue(cid, 300)
    if(oldcount == -1) then
     oldcount = 0
      end
---------End-Dont--Tough!--Noob--censative
 
 
 
---------------Begin  Crap that u can change it if u want-----------------------    
        bank_need_premium = 'Sorry, You need premium account to use the bank.'
        low_money_deposit = 'You do not have enough money in your deposit to withdraw, '..count..' Gold Pieces. '
        lost_track = 'Huh, What are you talking about?'
 
        if msgcontains(msg, 'banker') then
            selfSay('Hello. How can I help you? If you need some help just say information')
        elseif msgcontains(msg, 'information') then
            selfSay('Hello i am the city banker, you can do many things here like, Check your balance deposit and even withdraw!')
---------------End  Crap that u can change it if u want
 
-------------------------------------------------------------Begin of the Banker script---------------------------------------
 
------------------------Begin!--deposit--Crap----
            elseif msgcontains(msg, 'deposit') then
            if getPlayerPremiumDays(cid) > 0 then
            selfSay('How mutch would u like to deposit?')
                    talk_state = 1
            else
                selfSay(bank_need_premium)
                talk_state = 0
            end
---deposit--Confurm--Yes
elseif isNumber(getCount(msg)) and talk_state == 1 then
talk_state = 0
if doPlayerRemoveMoney(cid, count) == TRUE then
setPlayerStorageValue(cid,300, oldcount+count)
selfSay('You have successfully deposit '..count..' Gold Pieces')
else
selfSay(lost_track)
end
------------------------End!--deposit--Crap----
 
------------------------Begin!--Balance--Crap----
            elseif msgcontains(msg, 'balance') then
            if getPlayerPremiumDays(cid) > 0 then
            selfSay('do u want to check your balance?')
                    talk_state = 2
            else
                selfSay(bank_need_premium)
                talk_state = 0
            end
---Balance--Confurm--Yes
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerStorageValue(cid,300, oldcount) then
if(oldcount == -1) then
   oldcount = 0
   end
selfSay('You have '..oldcount..' Gold Pieces deposit.')
else
   selfSay(lost_track)
end
------------------------End!--Balance--Crap----
 
------------------------Begin!--withdraw--Crap----
            elseif msgcontains(msg, 'withdraw') then
            if getPlayerPremiumDays(cid) > 0 then
            selfSay('How mutch would u like to withdraw?')
                    talk_state = 3
            else
                selfSay(bank_need_premium)
                talk_state = 0
            end
---withdraw--Confurm--Yes
elseif isNumber(getCount(msg)) and talk_state == 3 then
talk_state = 0
if count <= oldcount then
setPlayerStorageValue(cid,300, oldcount-count)
doPlayerAddMoney(cid, count)
selfSay('You have successfully withdrawed '..count..' Gold Pieces.')
else
selfSay(low_money_deposit)
end
------------------------End!--withdraw--Crap----
 
---No--To--All
        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 3) then
            selfSay('Why the fuck dit you start this conversation anywais?')
            talk_state = 0
            end
 
        return true
           end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

I found this one for u it should work on TFS (by Mokerhammer)
 
Is there any possibility to merge those 2 NPCs? I men if this jiddo system npc will transfer to balance in database
 
This is nice job... Gesior is my idol :p your scripts are THE BEST!
 
It works for me, except it will not transfer to players that are offline..

[13/11/2008 12:15:34] data/npc/scripts/gesiorbank.lua:427: LuaSQL: there are open cursors
[13/11/2008 12:15:34] stack traceback:
[13/11/2008 12:15:34] [C]: in function 'close'
[13/11/2008 12:15:34] data/npc/scripts/gesiorbank.lua:427: in function 'getBA'
[13/11/2008 12:15:34] data/npc/scripts/gesiorbank.lua:216: in function <data/npc/scripts/gesiorbank.lua:36>
 
Back
Top