• 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!

NPC Bank system [0.3.6]

Mummrik

Hey!
Joined
Oct 22, 2007
Messages
707
Solutions
28
Reaction score
126
Location
Sweden
Tested and developed for tfs 0.3.6
It might work for 0.4 aswell

none vocation players cant transfer to other players, but if you have a vocation you can transfer money to any player even players whit none vocation.
There is no limit for non vocation players to deposit money to the bank account, thay just cant transfer money. It could be possible to abuse this script, if used on rook.
If botting money in rook and then make a lvl 8 and go to main, but i doubt ppl will do that on a OT

You need to fix a bug inside lib/050-function.lua
Change:
Code:
function playerExists(name)
   return getPlayerGUIDByName(name) ~= 0
end
To:
Code:
function playerExists(name)
   return getPlayerGUIDByName(name) ~= nil
end

above:
Code:
function onCreatureAppear(cid)           npcHandler:onCreatureAppear(cid)           end
You have to add this:
Code:
local Topic = {}
local Price = {}
local Transfer = {}

Npc script:
Code:
-- Banking system start
   elseif (npcHandler:isFocused(cid) and (msgcontains(msg, "balance"))) then
       Price[cid] = getPlayerBalance(cid)
       if (Price[cid] >= 100000) then
           npcHandler:say("You certainly have made a pretty penny. Your account balance is "..Price[cid].." gold.", cid)
       else
           npcHandler:say("Your account balance is "..Price[cid].." gold.", cid)
       end
       Price[cid] = nil
       Topic[cid] = nil
   elseif (npcHandler:isFocused(cid) and (msgcontains(msg, "deposit all"))) then
       Price[cid] = getPlayerMoney(cid)
       if (Price[cid] < 1) then
           npcHandler:say("You don't have any gold with you.", cid)
           Price[cid] = nil
           Topic[cid] = nil
       else
           npcHandler:say("Would you really like to deposit "..Price[cid].." gold?", cid)
           Topic[cid] = 101
       end
   elseif (npcHandler:isFocused(cid) and (msgcontains(msg, "deposit"))) then
           npcHandler:say("Please tell me how much gold it is you would like to deposit.", cid)
           Topic[cid] = 100
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 100 and (msgcontains(msg, msg))) then
       if (isNumber(msg)) then
           Price[cid] = tonumber(msg)
               if (Price[cid] > 0) then
                   if (getPlayerMoney(cid) >= Price[cid]) then
                       npcHandler:say("Would you really like to deposit "..Price[cid].." gold?", cid)
                       Topic[cid] = 101
                   else
                       npcHandler:say("You do not have enough gold.", cid)
                       Price[cid] = nil
                   end
               else
                   npcHandler:say("Please tell me how much gold it is you would like to deposit.", cid)
                   Price[cid] = nil
               end
       else
           npcHandler:say("Please tell me how much gold it is you would like to deposit.", cid)
           Price[cid] = nil
       end
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 101 and (msgcontains(msg, "yes$"))) then
       if (getPlayerMoney(cid) >= Price[cid]) then
           npcHandler:say("Alright, we have added the amount of "..Price[cid].." gold to your {balance}. You can {withdraw} your money anytime you want to.", cid)
           doPlayerDepositMoney(cid, Price[cid])
           Price[cid] = nil
           Topic[cid] = nil
       else
           npcHandler:say("I am inconsolable, but it seems you have lost your gold. I hope you get it back.", cid)
           Price[cid] = nil
           Topic[cid] = nil
       end
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 101 and (msgcontains(msg, "no$"))) then
       npcHandler:say("As you wish. Is there something else I can do for you?", cid)
       Price[cid] = nil
       Topic[cid] = nil
   elseif (npcHandler:isFocused(cid) and (msgcontains(msg, "withdraw"))) then
       if (getPlayerBalance(cid) > 0) then
           npcHandler:say("Please tell me how much gold you would like to withdraw.", cid)
           Topic[cid] = 102
       else
           npcHandler:say("You don't have any money on your bank account.", cid)
       end
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 102 and (msgcontains(msg, msg))) then
       if (isNumber(msg)) then
           Price[cid] = tonumber(msg)
               if (Price[cid] > 0) then
                   if (getPlayerBalance(cid) >= Price[cid]) then
                       npcHandler:say("Are you sure you wish to withdraw "..Price[cid].." gold from your bank account?", cid)
                       Topic[cid] = 103
                   else
                       npcHandler:say("There is not enough gold on your account.", cid)
                       Price[cid] = nil
                   end
               else
                   npcHandler:say("Please tell me how much gold you would like to withdraw.", cid)
                   Price[cid] = nil
               end
       else
           npcHandler:say("Please tell me how much gold you would like to withdraw.", cid)
           Price[cid] = nil
       end
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 103 and (msgcontains(msg, "yes$"))) then
       npcHandler:say("Here you are, "..Price[cid].." gold. Please let me know if there is something else I can do for you.", cid)
       doPlayerWithdrawMoney(cid, Price[cid])
       Price[cid] = nil
       Topic[cid] = nil
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 103 and (msgcontains(msg, "no$"))) then
       npcHandler:say("As you wish. Is there something else I can do for you?", cid)
       Price[cid] = nil
       Topic[cid] = nil
   elseif (npcHandler:isFocused(cid) and (msgcontains(msg, "transfer"))) then
           if (getPlayerVocation(cid) >= 1) then
               npcHandler:say("Please tell me the amount of gold you would like to transfer.", cid)
               Topic[cid] = 104
           else
               npcHandler:say("Your vocation cannot transfer money.", cid)
           end
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 104 and (msgcontains(msg, msg))) then
       if (isNumber(msg)) then
           Price[cid] = tonumber(msg)
               if (Price[cid] > 0) then
                   if (getPlayerBalance(cid) >= Price[cid]) then
                       npcHandler:say("Who would you like transfer "..Price[cid].." gold to?", cid)
                       Topic[cid] = 105
                   else
                       npcHandler:say("There is not enough gold on your account.", cid)
                       Price[cid] = nil
                   end
               else
                   npcHandler:say("Please tell me the amount of gold you would like to transfer.", cid)
                   Price[cid] = nil
               end
       else
           npcHandler:say("Please tell me the amount of gold you would like to transfer.", cid)
           Price[cid] = nil
       end
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 105 and (msgcontains(msg, msg))) then
       Transfer[cid] = msg
-- Note: playerExists() on 0.3.6 needs to be fixed inside lib/050-function.lua (Change: return getPlayerGUIDByName(name) ~= 0 to: return getPlayerGUIDByName(name) ~= nil)
       if (playerExists(Transfer[cid])) then
           Transfer[cid] = getPlayerGUIDByName(Transfer[cid])
           Transfer[cid] = getPlayerNameByGUID(Transfer[cid])
           if (Transfer[cid] == "Account Manager" or Transfer[cid] == "Rook Sample" or Transfer[cid] == "Sorcerer Sample" or Transfer[cid] == "Druid Sample" or Transfer[cid] == "Paladin Sample" or Transfer[cid] == "Knight Sample") then
               npcHandler:say("This player does not exist.", cid)
               Price[cid] = nil
               Topic[cid] = nil
               Transfer[cid] = nil
           else
               npcHandler:say("So you would like to transfer "..Price[cid].." gold to "..Transfer[cid].."?", cid)
               Topic[cid] = 106
           end
       else
           npcHandler:say("This player does not exist.", cid)
           Price[cid] = nil
           Topic[cid] = nil
           Transfer[cid] = nil
       end
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 106 and (msgcontains(msg, "yes$"))) then
       npcHandler:say("You have transferred "..Price[cid].." gold to "..Transfer[cid]..".", cid)
       doPlayerTransferMoneyTo(cid, Transfer[cid], Price[cid])
       Price[cid] = nil
       Topic[cid] = nil
       Transfer[cid] = nil
   elseif (npcHandler:isFocused(cid) and Topic[cid] == 106 and (msgcontains(msg, "no$"))) then
       npcHandler:say("Ok. What is next?", cid)
       Price[cid] = nil
       Topic[cid] = nil
       Transfer[cid] = nil
-- Banking system end

Let me know if you have problem implement this code
 
Last edited:
OP
OP
Mummrik

Mummrik

Hey!
Joined
Oct 22, 2007
Messages
707
Solutions
28
Reaction score
126
Location
Sweden
Found a thread that it was possible to clone money when servers where using gesior aac, i did update the script so i should not be possible to send money to sample chars and account manager.
If you did use this script you have to update it

change
Code:
if (playerExists(Transfer[cid])) then
          Transfer[cid] = getPlayerGUIDByName(Transfer[cid])
          Transfer[cid] = getPlayerNameByGUID(Transfer[cid])
           npcHandler:say("So you would like to transfer "..Price[cid].." gold to "..Transfer[cid].."?", cid)
           Topic[cid] = 106
to
Code:
if (playerExists(Transfer[cid])) then
          Transfer[cid] = getPlayerGUIDByName(Transfer[cid])
          Transfer[cid] = getPlayerNameByGUID(Transfer[cid])
           if (Transfer[cid] == "Account Manager" or Transfer[cid] == "Rook Sample" or Transfer[cid] == "Sorcerer Sample" or Transfer[cid] == "Druid Sample" or Transfer[cid] == "Paladin Sample" or Transfer[cid] == "Knight Sample") then
               npcHandler:say("This player does not exist.", cid)
               Price[cid] = nil
               Topic[cid] = nil
               Transfer[cid] = nil
           else
               npcHandler:say("So you would like to transfer "..Price[cid].." gold to "..Transfer[cid].."?", cid)
               Topic[cid] = 106
           end
 
Last edited:
Top