> For the complete documentation index, see [llms.txt](https://alt0.gitbook.io/alt0-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alt0.gitbook.io/alt0-docs/alt0-mdt/integrations.md).

# Integrations

Connect ALT0 MDT to your billing and prison scripts.

`integrations.lua` decides where fines and jail time go. You can point it at any script.

## Billing

```lua
Integrations.Billing = 'auto'
```

| Value         | What happens to a fine                                                                                                                                                                                                 |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `'auto'`      | The first one running: `alt0-bank`, then `renewed`, then `qbox`                                                                                                                                                        |
| `'alt0-bank'` | ALT0 Bank sends an invoice. The citizen pays it later from the bank, and the money goes to the agency's society account.                                                                                               |
| `'renewed'`   | Charged from the citizen's bank right away and paid into the agency account in Renewed-Banking. The citizen must be online.                                                                                            |
| `'qbox'`      | Charged from the citizen's bank right away through the framework (Qbox, QBCore or ESX). The citizen must be online. On Qbox and QBCore the balance may go negative: a fine is owed either way. ESX doesn't allow that. |
| `'none'`      | The fine is only recorded in the MDT                                                                                                                                                                                   |

The financial audit, the Fines page and invoice tracking need ALT0 Bank. With another option those pages stay hidden.

## Your own billing script

Add an entry to the `billers` table in `integrations.lua`, then set `Integrations.Billing` to its name:

```lua
local billers = {
    -- ... the existing 'alt0-bank', renewed and qbox entries ...

    mybilling = {
        available = function() return GetResourceState('my-billing') == 'started' end,
        bill = function(senderCid, senderName, targetCid, amount, reason, societyJob)
            -- send the fine with your script and return true when it worked
            return exports['my-billing']:CreateInvoice(targetCid, amount, reason, societyJob)
        end,
    },
}
```

```lua
Integrations.Billing = 'mybilling'
```

`my-billing` and `CreateInvoice` stand for your own script and its export.

## Prison

When a processed report has jail time, the MDT calls `Integrations.JailCitizen(cid, months, officerName, charges)`. By default it hands the sentence to `alt0-prison`. The function has a commented example for another prison script: replace it with your script's jail export.

The processing page also shows the current inmates from `Integrations.GetInmates()`. Return `{}` if your prison script can't list them.

## Detected automatically

| Script        | What happens                                                            |
| ------------- | ----------------------------------------------------------------------- |
| ALT0 Dispatch | Calls appear on the dashboard and live map; officers attach from either |
| ALT0 Bank     | Fines become invoices, plus the Fines page and the financial audit      |
| ALT0 Camera   | Department camera photos, prints and polaroids become evidence          |
| ALT0 Boosting | Stolen-car alarms and hack attempts arrive as dispatch calls            |
| sd-phone      | The Citizen Services app                                                |
