You can easily add a check in here, to check if the player has enough money

Make sure you also not start it on the client if the person doesn’t have enough money

Here an example what I did

ESX.RegisterServerCallback('esx_dmvschool:pay', function(source, cb, price)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)

	if xPlayer.get('money') >= price then
		xPlayer.removeMoney(price)
		TriggerClientEvent('esx:showNotification', _source, _U('you_paid', ESX.Math.GroupDigits(price)))
		cb(true)
	else
		TriggerClientEvent('esx:showNotification', _source, _U('not_enough'))
		cb(false)
	end
end)

Than trigger that callback on the client and if the callback returns false you cancel the start of the driving exam

1 Like