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

# Configuration

Every option in config.lua: language, lobby, match formats, match rules, assists, cameras, keys, computer players and stats.

All settings live in one open file:

```
shared/config.lua
```

Courts are configured separately in `shared/courts.lua`, covered in [Courts](/devmosaic/resources/devmosaic-dm-tennis/courts.md). Restart the resource after editing either file.

***

### Language And Units

```lua
Config.Locale = 'en'
Config.SpeedUnit = 'kmh'
```

| Option             | What it does                                                                                                                                                                                       |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Config.Locale`    | Language file from `locales/`. `en` and `ar` ship with the resource; see [Leaderboard And Languages](/devmosaic/resources/devmosaic-dm-tennis/leaderboard-and-languages.md#languages) to add more. |
| `Config.SpeedUnit` | Unit for shot and serve speeds on screen: `kmh` or `mph`.                                                                                                                                          |

### Lobby

```lua
Config.Lobby = {
    key = 'E',
    distance = 1.6,
    blips = true,
    blipSprite = 122,
    blipColour = 2,
    blipScale = 0.75,
    blipName = 'Tennis Court',
    allowBots = true,
    countdown = 5,
    defaultFormat = 'set'
}
```

| Option                                              | What it does                                                                                                  |
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `key`                                               | Key that opens the court terminal. Players can rebind it.                                                     |
| `distance`                                          | How close to the terminal a player must stand, in metres.                                                     |
| `blips`                                             | Show a map blip on every court.                                                                               |
| `blipSprite`, `blipColour`, `blipScale`, `blipName` | Blip appearance and the name shown on the map.                                                                |
| `allowBots`                                         | Show the **Add CPU** buttons so players can fill spots with computer players. `false` for human-only matches. |
| `countdown`                                         | Seconds between everyone pressing Ready and the first serve.                                                  |
| `defaultFormat`                                     | Match length the terminal starts on. Must be one of the `id` values in `Config.Formats`.                      |

### Match Formats

```lua
Config.Formats = {
    { id = 'tiebreak', label = 'format_tiebreak', sets = 1, games = 0, tiebreakPoints = 7 },
    { id = 'short', label = 'format_short', sets = 1, games = 4, tiebreakAt = 4, tiebreakPoints = 7 },
    { id = 'set', label = 'format_set', sets = 1, games = 6, tiebreakAt = 6, tiebreakPoints = 7 },
    { id = 'bo3', label = 'format_bo3', sets = 3, games = 6, tiebreakAt = 6, tiebreakPoints = 7, finalTiebreak = 10 },
    { id = 'bo3full', label = 'format_bo3full', sets = 3, games = 6, tiebreakAt = 6, tiebreakPoints = 7 }
}
```

Each entry is one button in the terminal. Remove the ones you do not want or add your own.

| Field            | What it does                                                                                                      |
| ---------------- | ----------------------------------------------------------------------------------------------------------------- |
| `id`             | Internal name, used by `Config.Lobby.defaultFormat`.                                                              |
| `label`          | Key of the button text in the locale file. Add a matching line in `locales/` for new formats.                     |
| `sets`           | Best of how many sets.                                                                                            |
| `games`          | Games needed to win a set. `0` makes the whole match a single tie-break.                                          |
| `tiebreakAt`     | Game score that starts a tie-break (`6` = tie-break at 6-6). Leave it out for sets that must be won by two games. |
| `tiebreakPoints` | Points to win a tie-break.                                                                                        |
| `finalTiebreak`  | Replace the deciding set with a tie-break to this many points.                                                    |
| `noAd`           | `true` makes the point at deuce decide the game.                                                                  |

### Match Rules

```lua
Config.Match = {
    changeEnds = true,
    serveClock = 25,
    forfeitAfter = 30,
    autoPosition = true,
    hawkEyeMargin = 15,
    spectatorRange = 70.0
}
```

| Option           | What it does                                                                                       |
| ---------------- | -------------------------------------------------------------------------------------------------- |
| `changeEnds`     | Players swap ends after every odd game, like real tennis.                                          |
| `serveClock`     | Seconds the server has to start the serve before it counts as a fault. `0` turns the clock off.    |
| `forfeitAfter`   | Seconds a player may stay away from the court before their team forfeits.                          |
| `autoPosition`   | Walk every player to their spot before each point.                                                 |
| `hawkEyeMargin`  | Balls landing within this many centimetres of a line get the review camera. `0` turns reviews off. |
| `spectatorRange` | Distance from the court, in metres, at which bystanders see the ball and the score.                |

### Assists

```lua
Config.Assist = {
    level = 'medium',
    landingMarker = true,
    aimMarker = true,
    accuracy = 'normal',
    timingText = true,
    tips = true
}
```

| Option          | What it does                                                                                                                                                                                                                                                                                                                    |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `level`         | How much the game helps. `full` runs to every ball and swings when the player is late (easiest, like the GTA minigame). `medium` lets players run with WASD and takes the last steps while a shot key is held, with no automatic swing. `light` only helps the final step. `none` leaves all running and hitting to the player. |
| `landingMarker` | Ring on the court where the incoming ball will bounce.                                                                                                                                                                                                                                                                          |
| `aimMarker`     | Marker on the far side showing where the shot is aimed.                                                                                                                                                                                                                                                                         |
| `accuracy`      | How forgiving shots are: `casual`, `normal` or `pro`.                                                                                                                                                                                                                                                                           |
| `timingText`    | Show PERFECT / GOOD / EARLY / LATE after every shot.                                                                                                                                                                                                                                                                            |
| `tips`          | Show the key hints at the bottom for the first seconds of every match.                                                                                                                                                                                                                                                          |

{% hint style="info" %}
`medium` is the sweet spot for most servers: players feel in control of their movement while timing still decides the shot. Use `full` for casual event servers and `pro` accuracy for competitive ones.
{% endhint %}

### Camera

```lua
Config.Camera = {
    tvCamera = true,
    toggleKey = 'V',
    height = 6.2,
    distance = 7.4,
    fov = 50.0
}
```

| Option               | What it does                                                                                          |
| -------------------- | ----------------------------------------------------------------------------------------------------- |
| `tvCamera`           | Start every match in the TV camera behind the player's baseline. `false` starts in the normal camera. |
| `toggleKey`          | Default key that switches between the two cameras. Players can rebind it.                             |
| `height`, `distance` | TV camera height and distance behind the baseline, in metres.                                         |
| `fov`                | TV camera field of view. Lower is more zoomed in.                                                     |

### Keys

```lua
Config.Keys = {
    topspin = 'MOUSE_LEFT',
    slice = 'MOUSE_RIGHT',
    flat = 'E',
    lob = 'Q',
    drop = 'R',
    leave = 'BACK'
}
```

These are the defaults for new players. Each one is a FiveM key mapping, so players can change them in **Settings > Key Bindings > FiveM**. Mouse buttons are `MOUSE_LEFT`, `MOUSE_RIGHT` and `MOUSE_MIDDLE`; keyboard keys use the FiveM key names.

{% hint style="warning" %}
Changing a default here only affects players who have never bound that key. Players who already have a binding keep it.
{% endhint %}

### Computer Players

```lua
Config.Bots = {
    defaultLevel = 'normal',
    models = { 'a_m_m_tennis_01', 'a_f_y_tennis_01', 'ig_tenniscoach' }
}
```

| Option         | What it does                                                                                                                 |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `defaultLevel` | CPU skill the terminal starts on: `easy`, `normal` or `hard`. Players can change it per match.                               |
| `models`       | Ped models used for computer players, picked at random. Any ped model works; the tennis peds already carry suitable outfits. |

### Stats

```lua
Config.Stats = {
    enabled = true,
    leaderboardSize = 10
}
```

| Option            | What it does                                                                                                 |
| ----------------- | ------------------------------------------------------------------------------------------------------------ |
| `enabled`         | Record wins, aces, longest rally and fastest serve per player, and show the Leaderboard tab in the terminal. |
| `leaderboardSize` | How many names the leaderboard shows.                                                                        |

### Debug

```lua
Config.Debug = false
```

Prints extra information to the console. Keep it `false` on a live server.
