Personal Taxes Integration
Source Code: https://github.com/esx-framework/esx_property
ESX.RegisterServerCallback("esx_property:buyProperty", function(source, cb, PropertyId)
local xPlayer = ESX.GetPlayerFromId(source)
local Price = Properties[PropertyId].Price
if xPlayer.getAccount("bank").money >= Price then
xPlayer.removeAccountMoney("bank", Price, "Bought Property")
-- VMS City Hall - Personal Taxes Integration --
-- VMS City Hall - Personal Taxes Integration --
exports['vms_cityhall']:addPlayerCustomTaxToPay(
xPlayer.identifier, -- Player Identifier like steam hex/ rockstar license or citizenid for qb-core
Price, -- The price on which the tax is to be calculated
15, -- For example, 15% of the amount of property is additional tax
"Property Purchase TAX" -- Tax title visible in city hall menu
)
-- VMS City Hall - Personal Taxes Integration --
-- VMS City Hall - Personal Taxes Integration --
Properties[PropertyId].Owner = xPlayer.identifier
Properties[PropertyId].OwnerName = xPlayer.getName()
Properties[PropertyId].Owned = true
Log("Property Bought", 65280, {{name = "**Property Name**", value = Properties[PropertyId].Name, inline = true},
{name = "**Price**", value = ESX.Math.GroupDigits(Price), inline = true},
{name = "**Player**", value = xPlayer.getName(), inline = true}}, 1)
TriggerClientEvent("esx_property:syncProperties", -1, Properties)
if Config.OxInventory then
exports.ox_inventory:RegisterStash("property-" .. PropertyId, Properties[PropertyId].Name, 15, 100000, xPlayer.identifier)
end
end
cb(xPlayer.getAccount("bank").money >= Price)
end)
Last updated
Was this helpful?