# configuration

All settings are in `config.lua`, which is loaded by both the client and the server before any other script. Do not rename or move this file.

***

## Full config

```lua
Config = {}

-- Framework: "qb-core" | "esx" | "standalone"
Config.Framework = "qb-core"

-- In-game command to open the CarPlay UI
Config.Command = "music"

-- Prefix used internally for every xsound identifier
Config.SoundPrefix = "moh_carplay_"

-- Default playback volume (0.0 – 1.0)
Config.DefaultVolume = 1.0

-- How often the playback loop syncs the current timestamp (ms)
Config.UpdateLoopInterval = 500

-- How often the main thread checks if the player is in a vehicle (ms)
Config.VehicleCheckInterval = 300

-- Wait after destroying a sound before starting a new one (ms)
Config.DestroyWait = 150

-- Wait after seeking to a new timestamp (ms)
Config.SeekWait = 50

-- Wait when stopping an active update loop (ms)
Config.LoopStopWait = 100

-- Notification display duration (ms)
Config.NotifyDuration = 5000

-- Separator used to split a song name into title and artist
-- Example: "Blinding Lights by The Weeknd"
Config.SongSeparator = " by "
```

***

## Options reference

### `Config.Framework`

Controls which notification system is used.

| Value          | Notification method       |
| -------------- | ------------------------- |
| `"qb-core"`    | `QBCore.Functions.Notify` |
| `"esx"`        | `ESX.ShowNotification`    |
| `"standalone"` | Native GTA feed ticker    |

***

### `Config.Command`

The command players type in chat to open the CarPlay UI.

```lua
Config.Command = "music"  -- /music
```

***

### `Config.SoundPrefix`

Internal prefix prepended to every xsound identifier. You only need to change this if you are running multiple resources that also use xsound and have naming conflicts.

```lua
Config.SoundPrefix = "moh_carplay_"
-- Results in identifiers like: moh_carplay_1234
```

***

### `Config.DefaultVolume`

Volume applied when no saved volume exists on the vehicle statebag. Range: `0.0` (silent) to `1.0` (full volume).

***

### Timing options

These control various waits and intervals inside the script. The defaults are stable — only adjust them if you experience specific sync issues.

| Key                    | Default | Description                                                                           |
| ---------------------- | ------- | ------------------------------------------------------------------------------------- |
| `UpdateLoopInterval`   | `500`   | How often (ms) the playback loop pushes the current timestamp to the statebag and NUI |
| `VehicleCheckInterval` | `300`   | How often (ms) the main thread checks if the player entered or left a vehicle         |
| `DestroyWait`          | `150`   | Milliseconds to wait after destroying a sound before starting a new one               |
| `SeekWait`             | `50`    | Milliseconds to wait after calling `setTimeStamp`                                     |
| `LoopStopWait`         | `100`   | Milliseconds to wait when stopping an active update loop                              |

***

### `Config.SongSeparator`

When a song name contains this string, the UI splits it into a **title** and an **artist**.

```lua
Config.SongSeparator = " by "

-- "Blinding Lights by The Weeknd"
-- → Title:  Blinding Lights
-- → Artist: The Weeknd
```

If the separator is not found in the song name, the full string is used as the title and the artist falls back to `"Unknown Artist"`.


---

# 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://mohssins.gitbook.io/mohscriptsdocs/moh-carplay/configuration.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.
