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

TFS 1.X+ tfs 1.2 bank npc

ssiwyy158

Member
Joined
Jan 24, 2011
Messages
128
Solutions
2
Reaction score
13
Hello. I try install bank npc from this topic:

But when i try transfer i get error:
1.png
3.png
tfs 1.2 8.6 client
 
ok now it should work! on data/global.lua add this function at the bottom
Lua:
function Player.depositMoney(self, amount)
    if not self:removeMoney(amount) then
        return false
    end
    self:setBankBalance(self:getBankBalance() + amount)
    return true
end


function Player.transferMoneyTo(self, target, amount)
    local balance = self:getBankBalance()
    if amount > balance then
        return false
    end

    local targetPlayer = Player(target)
    if targetPlayer then
        targetPlayer:setBankBalance(targetPlayer:getBankBalance() + amount)
    else
        if not playerExists(target) then
            return false
        end
        db.query("UPDATE `players` SET `balance` = `balance` + '" .. amount .. "' WHERE `name` = " .. db.escapeString(target))
    end
    self:setBankBalance(self:getBankBalance() - amount)
    return true
end

and use this NPC instead:
👍
 
Last edited:
ok now it should work! on data/global.lua add this function at the bottom
Lua:
function Player.depositMoney(self, amount)
    if not self:removeMoney(amount) then
        return false
    end
    self:setBankBalance(self:getBankBalance() + amount)
    return true
end


function Player.transferMoneyTo(self, target, amount)
    local balance = self:getBankBalance()
    if amount > balance then
        return false
    end

    local targetPlayer = Player(target)
    if targetPlayer then
        targetPlayer:setBankBalance(targetPlayer:getBankBalance() + amount)
    else
        if not playerExists(target) then
            return false
        end
        db.query("UPDATE `players` SET `balance` = `balance` + '" .. amount .. "' WHERE `name` = " .. db.escapeString(target))
    end
    self:setBankBalance(self:getBankBalance() - amount)
    return true
end

and use this NPC instead:
👍
6.png
 
ok, now put this inside npc/lib/npcsystem folder and call it voiceModule.lua
then go to npc.lua located in npc/lib and add this in the top of the script
Lua:
dofile('data/npc/lib/npcsystem/voiceModule.lua')
before
Lua:
function msgcontains(message, keyword)
Post automatically merged:

@ssiwyy158 Or you can also delete this line from the npc file bank.lua
Lua:
local voices = { {text = 'It\'s a wise idea to store your money in your bank account.'} }
npcHandler:addModule(VoiceModule:new(voices))
 
Last edited:
ok, now put this inside npc/lib/npcsystem folder and call it voiceModule.lua
then go to npc.lua located in npc/lib and add this in the top of the script
Lua:
dofile('data/npc/lib/npcsystem/voiceModule.lua')
before
Lua:
function msgcontains(message, keyword)
Post automatically merged:

@ssiwyy158 Or you can also delete this line from the npc file bank.lua
Lua:
local voices = { {text = 'It\'s a wise idea to store your money in your bank account.'} }
npcHandler:addModule(VoiceModule:new(voices))
I use this script:
And work perfect
This script:
Lua:
function Player.depositMoney(self, amount)
   if not self:removeMoney(amount) then
       return false
   end

   self:setBankBalance(self:getBankBalance() + amount)
   return true
end

function Player.withdrawMoney(self, amount)
   local balance = self:getBankBalance()
   if amount > balance or not self:addMoney(amount) then
       return false
   end

   self:setBankBalance(balance - amount)
   return true
end

function Player.transferMoneyTo(self, target, amount)
   local balance = self:getBankBalance()
   if amount > balance then
       return false
   end

   local targetPlayer = Player(target)
   if targetPlayer then
       targetPlayer:setBankBalance(targetPlayer:getBankBalance() + amount)
   else
       if not playerExists(target) then
           return false
       end
       db.query("UPDATE `players` SET `balance` = `balance` + '" .. amount .. "' WHERE `name` = " .. db.escapeString(target))
   end

   self:setBankBalance(self:getBankBalance() - amount)
   return true
end
Add on player.lua no global.lua
 
Back
Top