Hello
.
As The Title Says Its My Tax System
Overview
:
This Script Will Add 3 Exports for other scripts to use 
- CalculateTax(money) : Calculate a Money With Current Tax Percentage ( for example if current tax percent is 10% and you use CalculateTax(100) it will return : 110
exports["cyber_Tax"]:CalculateTax(money)
- GetCurrentTaxPercent() : This Export Returns Current Tax Percentage
exports["cyber_Tax"]:GetCurrentTaxPercent()
- RemoveMoneyWithTax(money,id) : it will Remove the money From the player + tax included , and if you have esx_society it will add the tax money to the given society name in config.lua
exports["cyber_Tax"]:RemoveMoneyWithTax(money,targetID)
2 Commands For Use 
- ChangeTax : If player has the requirement ( for example goverment job and grade 5 configaruable ) he can change the Tax percentage with this command
- CurrentTax : Player can Check the current tax Percentage with this command
2 Events To Use
:
- Cyber:RemoveMoneyWithTax(money) : basically Remove Money With Tax but instead of export with event ( For Usage in Client Side )
- GetCurrentTaxPercent : Call backs Current Tax Percentage ( For usage in Client side )
Requirements
:
- ESX v1 final
- ESX_Society (Optional. can be changed in config file)
How to Use
:
Script It Self does nothing. You need to modify your scripts to use the Tax system. for example you need to change this ( taken from esx_carwash ) 
`ESX.RegisterServerCallback('esx_carwash:canAfford', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
if Config.EnablePrice then
if xPlayer.getMoney() >= Config.Price then
xPlayer.removeMoney(Config.Price)
cb(true)
else
cb(false)
end
else
cb(true)
end
end)`
to use the Tax system Exports like this 
`ESX.RegisterServerCallback('esx_carwash:canAfford', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
if Config.EnablePrice then
if xPlayer.getMoney() >= exports['cyber_Tax']:CalculateTax(Config.Price) then
exports['cyber_Tax']:RemoveMoneyWithTax(Config.Price,source)
cb(true)
else
cb(false)
end
else
cb(true)
end
end)`
You can Change Any Scripts that you want to use the tax system.
For example:
- Shops!
- Vehicle Shop
- Gun Shop
- Housing Systems
and …
Github Link
:
7 Likes
Welp this makes my life easier, don’t have to add like 30 lines for the society (To clarify: don’t need to add like 30 lines for each script that I’d need to add tax too, lol)
1 Like
hello sir can you make compatible backwards for esx 1.1 
i don’t think there will be any problem using it with esx 1.1 | if you encountered any errors please provide me a screenshot so i can make another branch for esx 1.1
Hey,
i got this Error. What can i do? 
SCRIPT ERROR: @esx_addonaccount/server/classes/addonaccount.lua:9: attempt to perform arithmetic on a nil value (local ‘m’)