New_banking Money Transfer

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!

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.

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

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 :slight_smile:

No. After changing both have stopped working. No tranfers and the balance isn’t shown
No worries!

No errors on server and client console?

I’ll check!

Nothing. No errors

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!

That error is from esx menu default

What would you recommend me to do? :frowning: I am unsure

If i was you i start with updating extended and essential

I think this code is wrong :slight_smile:

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)

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)