Business Taxes Integration
Read carefully!
If you want to implement the tax system from VMS City Hall into your external resource (e.g., esx_policejob), you will also need VMS Boss Menu to allow players to pay and view their current paid or unpaid taxes.
Without the mentioned resource, the full potential of the tax system cannot be utilized!
Source Code: https://github.com/esx-framework/esx_taxijob
RegisterNetEvent('esx_taxijob:success', function()
local xPlayer = ESX.GetPlayerFromId(source)
local timeNow = os.clock()
if xPlayer.job.name ~= 'taxi' then
print(('[^3WARNING^7] Player ^5%s^7 attempted to ^5esx_taxijob:success^7 (cheating)'):format(source))
return
end
if not lastPlayerSuccess[source] or timeNow - lastPlayerSuccess[source] > 5 then
lastPlayerSuccess[source] = timeNow
local total = math.random(Config.NPCJobEarnings.min, Config.NPCJobEarnings.max)
if xPlayer.job.grade >= 3 then
total = total * 2
end
-- VMS City Hall & VMS Boss Menu - Business Taxes Integration --
-- VMS City Hall & VMS Boss Menu - Business Taxes Integration --
local society = exports['vms_bossmenu']:getSociety('taxi')
if society then -- We check whether the "taxi" company is registered.
-- If the company is registered, we continue to work with the company and taxes
local playerMoney = ESX.Math.Round(total / 100 * 30)
local societyMoney = ESX.Math.Round(total / 100 * 70)
xPlayer.addMoney(playerMoney, "Taxi Fair")
exports['vms_bossmenu']:addMoney('taxi', societyMoney, function()
-- After adding money for the company, we add tax:
exports['vms_cityhall']:addCompanyCustomTaxAmount(
'taxi', -- Job Name
total, -- Total amount
8 -- For example, 8% of the amount of total amount is additional tax
)
end)
xPlayer.showNotification(TranslateCap('comp_earned', societyMoney, playerMoney))
else
xPlayer.addMoney(total, "Taxi Fair")
xPlayer.showNotification(TranslateCap('have_earned', total))
end
-- VMS City Hall & VMS Boss Menu - Business Taxes Integration --
-- VMS City Hall & VMS Boss Menu - Business Taxes Integration --
end
end)
Last updated
Was this helpful?