Hey! I am having following issue on the Server I am running currently: Every time a Player tries to tranfer Money from their bank account using New Banking, Nothing happens. IDs are correctly typed in and amount aswell. I am not sure what causes this, as the tranfer is the only thing that doesn’t want to work.
Withdraws and deposits work fine, it’s only the transfering that needs Fixing.
Another thing would be: Is there any way for a player to “give” another player money deposited in the bank through the regular esx inventory? If so, help would be much appreciated.
Thank you in Advance!
Wokie
June 15, 2019, 11:48am
2
RegisterServerEvent('bank:transfer')
AddEventHandler('bank:transfer', function(to, amountt)
local _source = source
local sourceXPlayer = ESX.GetPlayerFromId(_source)
local targetXPlayer = ESX.GetPlayerFromId(tonumber(to))
local balance = sourceXPlayer.getAccount('bank').money
if _source == tonumber(to) then
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Transfer Money', 'No puedes transferirte a ti mismo!', 'CHAR_BANK_MAZE', 9)
else
if balance < 1 or balance < tonumber(amountt) or tonumber(amountt) < 1 then
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Transfer Money', 'No tienes suficiente para transferir!', 'CHAR_BANK_MAZE', 9)
else
sourceXPlayer.removeAccountMoney('bank', tonumber(amountt))
targetXPlayer.addAccountMoney('bank', tonumber(amountt))
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Transfer Money', 'Has transferido ~r~
``` .. amountt .. '~s~ a ~r~' .. to .. ' .', 'CHAR_BANK_MAZE', 9)
TriggerClientEvent('esx:showAdvancedNotification', to, 'Bank', 'Transfer Money', 'Has recibido ~r~
``` .. amountt .. '~s~ de ~r~' .. _source .. ' .', 'CHAR_BANK_MAZE', 9)
end
end
end)
Change the function transfer in your server.lua
I hope it helps
I am getting yet another issue with this. There is no balance showing up, now that I changed the function.
Wokie
June 15, 2019, 12:54pm
4
Can you post your client and server.lua?
Here They Are:
client.lua (9.5 KB)
server.lua (3.6 KB)
Thank you for trying to help me out btw!!
Wokie
June 15, 2019, 1:45pm
6
Im on my phone but for what i can see its all good.
Before the updated function you was able to see ur balance? And after the function update you are able to transfer the money?
Sorry about my english
No. After changing both have stopped working. No tranfers and the balance isn’t shown
No worries!
Wokie
June 15, 2019, 2:04pm
8
No errors on server and client console?
Wokie
June 15, 2019, 7:10pm
11
That is what i call bad luck,i get the function from the new_banking github-issue.
Check if is anything there that can help you
I checked and I am getting this error message every time I want to transfer something to another player!
Wokie
June 16, 2019, 1:08am
13
That error is from esx menu default
What would you recommend me to do? I am unsure
Wokie
June 16, 2019, 1:35pm
15
If i was you i start with updating extended and essential
Luiser
April 16, 2021, 11:11pm
16
I think this code is wrong
RegisterServerEvent('bank:transfer')
AddEventHandler('bank:transfer', function(to, amountt)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local zPlayer = ESX.GetPlayerFromId(to)
local balance = 0
balance = xPlayer.getAccount('bank').money
zbalance = zPlayer.getAccount('bank').money
if tonumber(_source) == tonumber(to) then
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Transfer Money', 'You cannot transfer to your self!', 'CHAR_BANK_MAZE', 9)
else
if balance <= 0 or balance < tonumber(amountt) or tonumber(amountt) <= 0 then
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Transfer Money', 'Not enough money to transfer!', 'CHAR_BANK_MAZE', 9)
else
xPlayer.removeAccountMoney('bank', tonumber(amountt))
zPlayer.addAccountMoney('bank', tonumber(amountt))
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Transfer Money', 'You transfered ~g~$' .. amountt .. '~s~ to ~g~' .. to .. ' .', 'CHAR_BANK_MAZE', 9)
TriggerClientEvent('esx:showAdvancedNotification', to, 'Bank', 'Transfer Money', 'You received ~g~$' .. amountt .. '~s~ from ~g~' .. _source .. ' .', 'CHAR_BANK_MAZE', 9)
end
end
end)
Ryujins
February 27, 2022, 7:40pm
17
WORK Nice Jobs
my Code:
RegisterServerEvent('bank:transfer')
AddEventHandler('bank:transfer', function(to, amountt)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local zPlayer = ESX.GetPlayerFromId(to)
local balance = 0
balance = xPlayer.getAccount('bank').money
zbalance = zPlayer.getAccount('bank').money
if _source == tonumber(to) then
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Převest', 'Nemůžeš přenest peníze sobě!', 'CHAR_BANK_MAZE', 9)
else
if balance < 1 or balance < tonumber(amountt) or tonumber(amountt) < 1 then
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Převest', 'Není dost peněz na převod!', 'CHAR_BANK_MAZE', 9)
else
xPlayer.removeAccountMoney('bank', tonumber(amountt))
zPlayer.addAccountMoney('bank', tonumber(amountt))
-- advanced notification with bank icon
TriggerClientEvent('esx:showAdvancedNotification', _source, 'Bank', 'Převod Peněz', 'Převedl jsi~r~Kč' .. amountt .. '~s~ Na ~r~' .. to .. ' .', 'CHAR_BANK_MAZE', 9)
TriggerClientEvent('esx:showAdvancedNotification', to, 'Bank', 'Převod peněz', 'Obdržel jste ~r~Kč' .. amountt .. '~s~ Od ~r~' .. _source .. ' .', 'CHAR_BANK_MAZE', 9)
end
end
end)