• 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.5 Global Bank request

pichetas

New Member
Joined
Nov 22, 2008
Messages
21
Reaction score
2
I'm using the latest TFS 1.5 downgraded to 8.6 by Nekiro, and i'm having problems to add the option that you can but items from npcs without having the money in your backpack and instead taking the cash from bp and also the rest from the bank.

Can anyone help me? I already search the whole forum and didnt find a solved for this version.

Thanks
 
Solution
E
tfs 1.5 doesn't have 050-function.lua, your problem is that you replaced original data/npc/lib files with files that doesn't support the data/lib/player.lua functions...

take a look at these changes and see what you need to change:
That function
I already have that function.
The only times I see it works is when buying houses, it seems like npcs doesnt consider the players bank balance.

Does anybody know where I can check that? I'm thinking the error is there

Edit: I think it may be in this part of the 050-function.lua, I thinks there's a function missing like doPlayerRemoveTotalMoney
Lua:
function doPlayerWithdrawMoney(cid, amount)
    if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
        return false
    end

    local balance = getPlayerBalance(cid)
    if(amount > balance or not doPlayerAddMoney(cid, amount)) then
        return false
    end

    doPlayerSetBalance(cid, balance - amount)
    return true
end

function doPlayerDepositMoney(cid, amount)
    if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
        return false
    end

    if(not doPlayerRemoveMoney(cid, amount)) then
        return false
    end

    doPlayerSetBalance(cid, getPlayerBalance(cid) + amount)
    return true
end
 
Last edited:
tfs 1.5 doesn't have 050-function.lua, your problem is that you replaced original data/npc/lib files with files that doesn't support the data/lib/player.lua functions...

take a look at these changes and see what you need to change:
 
Solution
tfs 1.5 doesn't have 050-function.lua, your problem is that you replaced original data/npc/lib files with files that doesn't support the data/lib/player.lua functions...

take a look at these changes and see what you need to change:
I tried it but didnt work, still the npcs doesnt see the money on my bank balance, just the one in my backpack. :(

I saw that the protocolgame.cpp in that tutorial shows this change:
Lua:
    msg.add<uint64_t>(player->getMoney());
    msg.add<uint64_t>(player->getMoney() + player->getBankBalance());
mine was like this:
Lua:
    msg.add<uint32_t>(player->getMoney());

I've tried with the change adding getbankbalance for 64 and 32, didnt work either way, but I dont know if that number has something to do
 
Last edited:
so you changed:

msg.add<uint32_t>(player->getMoney());

to:
msg.add<uint32_t>(player->getMoney() + player->getBankBalance());

and recompiled your server and it didn't work still?
 
for which function should be doPlayerWithdrawMoney replaced?
i was having that error so then i added the function in global.lua
everything is updated, i compare with changes that evil punker linked

Lua:
function doPlayerWithdrawMoney(cid, amount)
    if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
        return false
    end

    local balance = getPlayerBalance(cid)
    if(amount > balance or not doPlayerAddMoney(cid, amount)) then
        return false
    end

    doPlayerSetBalance(cid, balance - amount)
    return true
end
and there are no error in console now but nothing happen either

can deposit money, ask for balance but when try withdraw nothing happen
 
Back
Top