Add money to society

I have this code in server.lua of a script so I want to add that the society_mechanic receives the amount of money added to their society account that the use have to pay here.

RegisterNetEvent(‘esx_simplegarages:server:PayImpoundBill’)
AddEventHandler(‘esx_simplegarages:server:PayImpoundBill’, function(price)
local sourcePlayer = ESX.GetPlayerFromId(source)
sourcePlayer.removeMoney(price)
sourcePlayer.showNotification(“Du hast ~g~$” … price … “~w~ bezahlt, um dein Fahrzeug zurückzubekommen.”)
end)

I’m pretty sure that if you want to add money to your mechanic’s general account, you can always add it by adding money to your account (characters) and then give yourself a mechanic’s job and deposit via the boss’s menu. But for that you need another mechanic script, not standard

3 Likes

I fixed it by change to code to this one:

RegisterNetEvent('esx_simplegarages:server:PayImpoundBill')
AddEventHandler('esx_simplegarages:server:PayImpoundBill', function(price)
    local sourcePlayer = ESX.GetPlayerFromId(source)
    sourcePlayer.removeMoney(price)
    sourcePlayer.showNotification("Du hast ~g~$" .. price .. "~w~ bezahlt, um dein Fahrzeug zurückzubekommen.")

	TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account)
		if account then
			account.addMoney(price)
		else
			sourcePlayer.showNotification("Fehler")
		end
	end)
end)
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.