# Config

{% tabs %}
{% tab title="Config.lua" %}

```lua
Config = {}

-- 'auto_detect' for auto detect framework
-- 'esx' for ESX
-- 'qb' for QB
Config.Framework = 'auto_detect'

-- Used export method
-- If you have getObject problem change this option to false
Config.MethodExport = true

-- This is name for your framework
Config.NameListResource = {
    ['esx'] = 'es_extended',
    ['qb'] = 'qb-core'
}

-- Your triggers names 
Config.ListEvent = {
    ['esx'] = {
        ['esx'] = 'esx:getSharedObject',
        ['addonaccount'] = 'esx_addonaccount:getSharedAccount'
    },

    ['qb'] = {
        ['boss_add'] =  'qb-bossmenu:server:addAccountMoney',
        ['boss_remove'] =  'qb-bossmenu:server:removeAccountMoney'
    }
}

-- If you put a number, it will be the number of hours to collect taxes again
-- If you enter Hour and Minute it will be at this time when the taxes are charged
Config.TimeTaxe = 3 -- or {Hour = 20, Minute = 00} -- for schedule

-- Do you want taxes to be applied to disconnected players?
-- NOTE: This option is not highly recommended due to the amount of load on the database but many clients have asked me for it.
Config.ApplyToOfflinePlayers = false

-- if you use qbus ignore this
-- 'new' esx 1.2, 1.2 final, legacy
-- 'old' esx 1.0, 1.1
Config.VerEsx = 'new'

-- 'automatic'
-- 'bill' -- IMPORTANT This option for qbus you must add yourself in customise_me.lua
-- 'none'
-- NOTE: if you use payment bill you must set up a SocietyDestination
Config.TypePayment = 'automatic'

-- Payment will go to society
-- 'none' 
-- 'society' example in esx - 'society_ambulance', in qb - 'ambulance'
Config.SocietyDestination = 'none'

-- Type society only qbus if your used esx ignored this
-- 'auto_detect' for auto detect society system (qb-banking, qb-management, boss-menu, okokBanking)
-- IMPORTANT - If you use the new version of qb and have another banking system other than those mentioned, enter the name of your banking system here
Config.QbTypeSociety = 'auto_detect'

-- Allow money from offline players to society
-- false the money of the players who are disconnected will not be deposited in the society
-- true money from disconnected players will be sent to society
Config.AllowPaymentOfflineSociety = false

-- Here you can collect taxes for the vehicles that the player has
-- Enable = true or false
-- TypeTaxe = 'static' or 'percentage' or 'custom' Note: if you use custom you must set the function at the end of customise_me.lua
-- Amount = Taxe for car owned, example 10 * 500 = $5000 the taxes, 10 = amount the cars
-- IgnoreVehicleJob - if ignore vehicles jobs
-- SelectWhere - Only the vehicles that the condition of the columns is true will be returned
Config.Cars = {
    Enable = true,
    TypeTaxe = 'static',
    Amount = 500,
    IgnoreVehicleJob = true,
    SelectWhere = { -- OPTIONAL
        --"`COLUMN` = 1",
    },
}

-- If the player does not have enough money in the bank or cash, he will collect the remaining money in the bank and will go negative
Config.BankNegativeMoney = false

-- Here you can collect taxes on the money in the bank that the players have
-- Enable = true or false
-- TypeTaxe = 'percentage' or 'custom' Note: if you use custom you must set the function at the end of customise_me.lua
-- Amount = Bankmoney * Amount, example 50000 * 0.01 = $500 the taxes
Config.MoneyBank = {
    Enable = true,                                                           
    TypeTaxe = 'percentage',
    Amount = 0.01
}

-- Here you can collect taxes on the money in cash
-- Enable = true or false
-- TypeTaxe = 'percentage' or 'custom' Note: if you use custom you must set the function at the end of customise_me.lua
-- Amount = Cashmoney * Amount, example 50000 * 0.01 = $500 the taxes
Config.MoneyCash = {
    Enable = false,                                                           
    TypeTaxe = 'percentage',
    Amount = 0.01
}

-- Here you can collect taxes for the number of houses the player has
-- Enable = true or false
-- TypeTaxe = 'static' or 'percentage' or 'custom' Note: if you use custom you must set the function at the end of customise_me.lua
-- Amount = PriceHouse * 0.01, example 50000 * 0.01 = $500 the taxes
Config.Houses = {
    Enable = true,
    TypeTaxe = 'static',                                                         
    Amount = 5000                                                                      
}

-- Here you can collect taxes on company money
-- Enable = true or false
-- Names = company names
-- Amount = MoneySociety * 0.01, example 50000 * 0.01 = $500 the taxes
Config.Societys = {
    Enable = false,
    Names = {
        ['esx'] = {
            'society_police',
            'society_mechanic',
            'society_ambulance'
        },
        ['qb'] = {
            'police',
            'mechanic',
            'ambulance'
        }
    },
    Amount = 0.01
}

-- Table name in your database
-- Name of the identifier column of your database
Config.TablesSQL = {
    ['esx'] = {
        ['cars'] = {
            table = 'owned_vehicles',
            column = 'owner',
        },
        ['houses'] = {
            table = 'allhousing',
            column = 'owner',
            selectColumn = { -- NOTE selectColumn only works if you use typePayment custom in houses
                'owner',
                'shell',
                'price',
            }
        },
        ['bills'] = {
            table = 'billing'
        },
        ['players'] = {
            table = 'users',
            column = 'identifier'
        },
        ['vehicles'] = {
            table = 'vehicles',
            column = 'model'
        }
    },

    ['qb'] = {
        ['cars'] = {
            table = 'player_vehicles',
            column = 'citizenid'
        },
        ['houses'] = {
            table = 'player_houses',
            column = 'citizenid',
            selectColumn = { -- NOTE selectColumn only works if you use typePayment custom in houses
                'citizenid',
                'tier',
                'price'
            }
        },
        ['players'] = {
            table = 'players',
            column = 'citizenid'
        }
    }
}

-- Discord Webhook
-- Color message - you need to convert it to decimal https://www.rapidtables.org/convert/number/hex-to-decimal.html
Config.Discord = true
Config.Webhook = ''
Config.Color = 2328783                                                                     

-- List names for groups admins
-- Groups ignore for taxes
Config.IgnoreTaxesAdmin = false
Config.Groups = {
    ['esx'] = {                                                                         
        'superadmin',
        'admin'
    },
    ['qb'] = {
        'admin',
        'god'
    }
}

--██╗      █████╗ ███╗   ██╗ ██████╗ ██╗   ██╗ █████╗  ██████╗ ███████╗███████╗
--██║     ██╔══██╗████╗  ██║██╔════╝ ██║   ██║██╔══██╗██╔════╝ ██╔════╝██╔════╝
--██║     ███████║██╔██╗ ██║██║  ███╗██║   ██║███████║██║  ███╗█████╗  ███████╗
--██║     ██╔══██║██║╚██╗██║██║   ██║██║   ██║██╔══██║██║   ██║██╔══╝  ╚════██║
--███████╗██║  ██║██║ ╚████║╚██████╔╝╚██████╔╝██║  ██║╚██████╔╝███████╗███████║
--╚══════╝╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝ ╚═════╝ ╚══════╝╚══════╝                                                                  
Config.Language = 'en'
Config.Languages = {
	['en'] = {
        ['LOGS_PLAYERS'] = 'Cashed players',
        ['LOGS_TAXES_ONLINE'] = 'Logs Taxes Online',
        ['LOGS_TAXES_OFFLINE'] = 'Logs Taxes Offline',
        ['LOGS_NEW_TAXES'] = 'New taxes have been paid',
        ['LOGS_NEW_TAXES_SEND'] = 'New tax bills were sent',
        ['LOGS_TOTAL_COLLECTED'] = 'Total collected $%s',
        ['LOGS_TOTAL_BILLS'] = 'Total amount of invoices sent $%s',
        ['LOGS_TOTAL_PLAYERS'] = '%s players paid their taxes',
        ['PAYMENT_TAXES'] = 'You have paid $%s in taxes',
        ['NOT_TAXES'] = 'Great you dont have taxes to pay',
        ['NOT_TAXES_ADMIN'] = 'For being an admin you do not pay taxes',
        ['TAXES_BILL'] = 'Taxes',
        ['TAXES_NOTIFY'] = 'New Taxe bill',
    },

	['es'] = {
        ['LOGS_PLAYERS'] = 'Jugadores cobrados',
        ['LOGS_TAXES_ONLINE'] = 'Logs impuestos Online',
        ['LOGS_TAXES_OFFLINE'] = 'Logs impuestos Offline',
        ['LOGS_NEW_TAXES'] = 'Impuestos pagados por los jugadores',
        ['LOGS_NEW_TAXES_SEND'] = 'Nuevas facturas de taxes fueron enviadas',
        ['LOGS_TOTAL_COLLECTED'] = 'Total recaudado $%s',
        ['LOGS_TOTAL_BILLS'] = 'Precio total de las bills enviadas $%s',
        ['LOGS_TOTAL_PLAYERS'] = '%s jugadores pagaron sus impuestos',
        ['PAYMENT_TAXES'] = 'Has pagado $%s de impuestos al gobierno',
        ['NOT_TAXES'] = 'No tienes impuestos que pagar',
        ['NOT_TAXES_ADMIN'] = 'Eres admin y no pagas impuestos',
        ['TAXES_BILL'] = 'Impuestos',
        ['TAXES_NOTIFY'] = 'Nueva factura de impuestos',
    }
}
```

```
```

{% endtab %}

{% tab title="customise\_me.lua" %}

```lua
function SendBill(data)
	if Config.Framework == 'esx' then
		MySQL.Async.execute('INSERT INTO '..Config.TablesSQL[Config.Framework]['bills'].table..' (identifier, sender, target_type, target, label, amount) VALUES (@identifier, @sender, @target_type, @target, @label, @amount)',
		{
			['@identifier']  = data.identifier,
			['@sender']      = 'Taxes',
			['@target_type'] = 'society',
			['@target']      = Config.SocietyDestination,
			['@label']       = Lang['TAXES_BILL'],
			['@amount']      = data.amount
		}, function(rowsChanged)
			if data.src ~= 0 then
				TriggerClientEvent('esx:showNotification', data.src, Lang['TAXES_NOTIFY'])
			end
		end)
	elseif Config.Framework == 'qb' then
		-- Params
		-- data.src = source
		-- data.identifier = Player.PlayerData.citizenid
		-- data.amount = amount
		-- Add your code here for billing in qbus
		TriggerEvent('qb-phone:server:sendNewMailToOffline', data.identifier, {
			sender = data.name,
			subject = "Taxes",
			message = "You have been sent a bill for, <br>Amount: <br> $"..data.amount.." for Taxes<br><br> press the button below to accept the bill",
			button = {
				enabled = true,
				buttonEvent = "billing:client:AcceptBill",
				buttonData = {data.amount, data.identifier}
			}
		})
	end
end

function SendNotify(data)
	if Config.Framework == 'esx' then
		TriggerClientEvent('esx:showNotification', data.target, data.message)
	elseif Config.Framework == 'qb' then
		TriggerClientEvent('QBCore:Notify', data.target, data.message, data.type)
	end
end

-- This function is executed after collecting the player's taxes Only if the payment type is automatic
function SendTaxesPlayer(source, identifier, amount)
	TriggerEvent('qb-phone:server:sendNewMailToOffline', identifier, {
		sender = "Taxes",
		subject = "Taxes",
		message = "$"..amount.." in taxes have been collected from your account",
	})
end

-- This function only works if you put the payment type as custom
function customPayment(data)
	-- Params global
	-- data.src = source
	-- data.type = car or house
		
	local taxeAmount = 0
	if data.type == 'car' then
		-- data.car.price = price the car
		-- data.car.hash = hash the car
		if data.car.price >= 50000 then
			taxeAmount = 2500
		elseif data.car.price >= 100000 then
			taxeAmount = 5000
		else
			taxeAmount = 1000
		end
	elseif data.type == 'house' then
		-- data.house['column']
		if data.house['shell'] == 'Michaels' then
			taxeAmount = 5000
		elseif data.house['shell'] == 'HighEndV1' then
			taxeAmount = 10000
		else
			taxeAmount = 2500
		end
	elseif data.type == 'bank' then
		-- data.money = money in bank
		if data.money > 100000 then
			taxeAmount = data.money * Config.MoneyBank.Amount
		end
	end

	return taxeAmount
end
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.juca-scripts.com/assets/taxes/config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
