[ESX]Log Money Transfers [Tutorial]

sorry for my bad English and the code that will happen to them is in Spanish anyway I hope it helps them,

I managed to make it recognize or work and here I share this, since originally it was not my idea, I hope it works for them and they give it good use.

1. install this.


2

CREATE TABLE IF NOT EXISTS `transferir_vehiculo` (
  `Envia` varchar(50) DEFAULT NULL,
  `Placa` varchar(50) DEFAULT NULL,
  `Recibe` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Vehicle Transfer Information';

3
find in esx_vehicleshop/server/main.lua

else
print("Did not transfer") 

and above that he writes/paste this.

            MySQL.Async.execute('INSERT INTO transferir_vehiculo (Envia, Placa, Recibe)VALUES (@Envia, @Placa, @Recibe) ',
	{
		['@Envia']   = myName,
		['@Placa']   = plate,
		['@Recibe']    = targetSteamName

	}
)
	

with this should be, restart server and you should have it working: D

image

1 Like

EDIT: okay it works, but the receiver’s name doesn’t come up.

look alls replys

1 Like

install heidiSQL

Hello, sorry for my stupid question. here my line from 290 to 300

				TriggerClientEvent('esx:showNotification', target,  _U('received_item', itemCount, ESX.Items[itemName].label, sourceXPlayer.name))
			end

		else
		-->	TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_quantity')) <-- line 294
		end

	elseif type == 'item_money' then

		if itemCount > 0 and sourceXPlayer.getMoney() >= itemCount then
			sourceXPlayer.removeMoney(itemCount)

should i add there? sorry im still newbie

Also do have an Idea how can I log every single time someone gets xPlayer.addmoney? I would like to to track whenever a person earns money from player/jobs.etc

Do you know how?

why doesn’t it work?
I checked on the db not entered.

To those who have issues, change [@Reciver] to [@Reciever]

1 Like

Thank for notifying me of the mispelling, I’ve fixed it in the original Post Appreciate it

Also, it doesn’t log bank for me.

Would you be able to show your es_extended file?

Any updated version for the latest es_extended?


hi everyone!
where shoud i add it to this???

Do you know how to log bank?

You must search item_money and item_account and paste that after : TriggerClientEvent('esx:showNotification', target, _U('received_account_money', ESX.Math.GroupDigits(itemCount), Config.AccountLabels[itemName], sourceXPlayer.name))

If you want to log with banking system you can do this :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
	local playerName = GetPlayerName(_source)
	local playerName2 = GetPlayerName(to)

	if(zPlayer == nil or zPlayer == -1) then
		TriggerClientEvent('bank:result', _source, "error", "Destinatario no encontrado.")
	else
		balance = xPlayer.getAccount('bank').money
		zbalance = zPlayer.getAccount('bank').money
		
		if tonumber(_source) == tonumber(to) then
			TriggerClientEvent('bank:result', _source, "error", "No puedes transferirte a ti mismo.")
		else
			if balance <= 0 or balance < tonumber(amountt) or tonumber(amountt) <= 0 then
				TriggerClientEvent('bank:result', _source, "error", "No tienes suficiente dinero en el banco.")
			else
				xPlayer.removeAccountMoney('bank', tonumber(amountt))
				zPlayer.addAccountMoney('bank', tonumber(amountt))
                MySQL.Async.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {
                    ['@identifier'] = zPlayer.identifier,
                }, function(result)
                    if result[1] then
                        local name = result[1].firstname .. " " .. result[1].lastname
                        MySQL.Async.fetchAll("INSERT INTO transfer (type, identifier, price, name) VALUES (@type, @identifier, @price, @name)", {
                            ["@type"] = 1,
                            ["@identifier"] = xPlayer.identifier,
                            ["@price"] = amountt,
                            ["@name"] = name
                        }, function(results)
                        end)
                    end
                end)
			   MySQL.Async.fetchAll("SELECT * FROM users WHERE identifier = @identifier", {
                    ['@identifier'] = xPlayer.identifier,
                }, function(result)
                    if result[1] then
                        local name = result[1].firstname .. " " .. result[1].lastname
                        MySQL.Async.fetchAll("INSERT INTO transfer (type, identifier, price, name) VALUES (@type, @identifier, @price, @name)", {
                            ["@type"] = 2,
                            ["@identifier"] = zPlayer.identifier,
                            ["@price"] = amountt,
                            ["@name"] = name
                        }, function(resultss)
                        end)
                    end
                end)
				TriggerClientEvent('bank:result', _source, "success", "Transferencia efectuada.")
			end
		end
	end
end)