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

# Configuration

`config.lua` holds everything a player sees, `server_config.lua` the Discord webhook.

### Basics

```lua
Config.Locale = 'en'
Config.VersionCheck = false
```

| Option                | Description                                                     |
| --------------------- | --------------------------------------------------------------- |
| `Config.Locale`       | Language of all texts, `'en'` or `'de'`                         |
| `Config.VersionCheck` | Prints a note in the server console when a newer version is out |

### Interaction

```lua
Config.Interaction = 'target'
Config.OpenKey = 38
Config.InteractDistance = 2.0
Config.DefaultRadius = 20.0
```

| Option                    | Description                                                                                 |
| ------------------------- | ------------------------------------------------------------------------------------------- |
| `Config.Interaction`      | `'target'` for an ox\_target option on the NPC, `'textui'` for an ox\_lib prompt with a key |
| `Config.OpenKey`          | Control id polled in textui mode, 38 is E                                                   |
| `Config.InteractDistance` | How close a player must stand to open the station, used by both modes                       |
| `Config.DefaultRadius`    | How far around a station injured players are picked up and listed                           |

Both distances can be overridden per station, see below.

### Medics

```lua
Config.Medics = {
    jobs = { 'ambulance' },
    limit = 2,
    onDutyOnly = false
}
```

| Option       | Description                                                                 |
| ------------ | --------------------------------------------------------------------------- |
| `jobs`       | Every job name that counts as a medic, add as many as you need              |
| `limit`      | Stations are blocked while this many medics are online                      |
| `onDutyOnly` | `true` counts only medics that are on duty, `false` ignores duty completely |

{% hint style="info" %}
`onDutyOnly = true` needs a job system that tracks duty, ESX Legacy does. Players whose system reports no duty info are treated as on duty, so it stays safe either way. Use `false` when your server does not work with on and off duty.
{% endhint %}

### Treatments

```lua
Config.Treatments = {
    { key = 'standard', price = 500, duration = 10, account = 'bank' },
    { key = 'premium', price = 2500, duration = 3, account = 'bank' }
}
```

Every entry becomes a toggle in the panel. The reviver pays `price` from `account` (`'bank'` or `'money'` for cash) when the treatment starts, and it is refunded if the treatment cannot finish. `duration` is the treatment time in seconds.

{% hint style="warning" %}
The label comes from the locale key `ui_<key>`. Add that key to both `locales/en.lua` and `locales/de.lua` for every new entry.
{% endhint %}

A price of `0` is allowed and makes that tier free, nothing is taken and nothing is refunded. `account` has to be `'bank'` or `'money'`, anything else is reported in the server console on start and would make every revive fail.

### Cooldowns

```lua
Config.ReviveCooldown = 2
Config.TargetCooldown = 0
```

| Option                  | Description                                                                               |
| ----------------------- | ----------------------------------------------------------------------------------------- |
| `Config.ReviveCooldown` | Seconds a player has to wait between two revives, anti spam                               |
| `Config.TargetCooldown` | Minutes a revived player cannot be station revived again, at any station. `0` disables it |

The target cooldown survives a relog and stops revive ping pong in fights. While it runs, that player is not listed at any station.

### Names, search and sorting

```lua
Config.NameMode = 'character'
Config.ShowId = false
Config.SearchFrom = 4
```

| Value         | Shows                                        |
| ------------- | -------------------------------------------- |
| `'character'` | Roleplay name, firstname and lastname        |
| `'player'`    | Account name, the FiveM player name          |
| `'anonymous'` | No name, everyone shows as an unknown person |

`Config.ShowId = true` puts the server id on every card next to the name. Together with `Config.NameMode` it decides which sort options the player gets, which one the panel starts with, and what the search field looks through:

| Setting                                    | Panel starts sorted by  | Sort options in the panel       | Search field                         |
| ------------------------------------------ | ----------------------- | ------------------------------- | ------------------------------------ |
| `ShowId = true`                            | Server id, lowest first | Name, id                        | Searches name and id                 |
| Names shown, `ShowId = false`              | Name, A to Z            | none, name is the only one left | Searches the name                    |
| `NameMode = 'anonymous'`, `ShowId = false` | nothing to sort by      | none                            | No field, there is nothing to search |

The player switches the order with the small Name / ID buttons next to the search field, and his choice is remembered for the next time he opens a station. An option only exists for something the card actually shows, so there is no sorting by an id nobody can see, and with only one option left the buttons are hidden.

The distance to the patient in metres sits on every card and updates while the panel is open, but the list is never sorted by it. A distance changes every second, so the rows would re-order under the player's cursor while he is about to click one.

`Config.SearchFrom` sets how many injured players have to be in the list before the search field shows up, four by default. A list with one or two cards needs no search, so the field slides in only once it is worth it. `0` shows it always.

{% hint style="info" %}
The search runs inside the panel on the list it already has. It never asks the server for anything, so typing costs nothing even at a busy station.
{% endhint %}

### Stations

```lua
Config.PedModel = 's_m_m_doctor_01'

Config.Blip = {
    enabled = true,
    sprite = 61,
    color = 1,
    scale = 0.8,
    shortRange = true
}

Config.Stations = {
    {
        id = 'pillbox',
        label = 'Pillbox Revive Station',
        coords = vec4(296.2164, -591.2310, 43.2754, 68.7512),
        radius = 20.0
    },
    {
        id = 'paleto',
        label = 'Paleto Revive Station',
        coords = vec4(-247.76, 6331.23, 32.43, 305.0),
        radius = 20.0
    }
}
```

`coords` is where the NPC stands, the fourth value is the heading. Optional per station:

| Field          | Description                                             |
| -------------- | ------------------------------------------------------- |
| `radius`       | Own listing radius instead of `Config.DefaultRadius`    |
| `distance`     | Own interact range instead of `Config.InteractDistance` |
| `model`        | Own NPC model instead of `Config.PedModel`              |
| `blip = false` | No map blip for this station                            |

{% hint style="warning" %}
`id` has to stay unique and should not be changed later, it identifies the station internally.
{% endhint %}

Set `Config.Blip.enabled = false` to hide the blips of all stations at once.

### Discord logging

In `server_config.lua`:

```lua
ServerConfig.Logs = {
    enabled = false,
    webhook = '',
    botName = 'l-revivestation',
    avatar = '',
    color = 3447003
}
```

Posts an embed for every completed revive: who revived whom, at which station, which treatment and how many medics were online. Stays off while `enabled = false` or the webhook is empty.

### Using another ambulance script

You do not have to run esx\_ambulancejob. The complete death and revive handling sits in `shared/ambulance.lua`, and that file is the only one you edit for it. It works on ESX events out of the box. See Another ambulance script.
