# Personal Taxes Integration

***

{% hint style="info" %}
**The following tax integration example is based on the publicly available resource `esx_property`.**

After reviewing and carefully reading this guide, you'll understand how to implement the tax system into other resources as well.

Please note that implementation is only possible in open-source resources - **it's not possible to introduce functional taxation in escrow-protected scripts**.\
In such cases, we recommend contacting the author of the resource and requesting compatibility with our system.
{% endhint %}

Source Code: [**https://github.com/esx-framework/esx\_property**](https://github.com/esx-framework/esx_property/blob/4fe06372730651b2f891c71095f02cbb5da7556f/server/main.lua#L185-L202)

{% code title="esx\_property" %}

```lua
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)
```

{% endcode %}


---

# 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.vames-store.com/assets/vms_cityhall/guides/personal-taxes-integration.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.
