> For the complete documentation index, see [llms.txt](https://wiki.qfdevelopers.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.qfdevelopers.com/scripts/editor-2/configuration.md).

# Configuration

Page dedicated to how to configure our Spawn Selector \[V2]

#### Configuration Guide (`config/config.lua` & `config/default_data.lua`)

**Behavioral Settings** The script's behavior drastically changes depending on whether you are using a character selection screen before it.

```lua
-- SET TO TRUE: If you are using qf_identity.
-- qf_identity will manually command the spawn selector to open when needed.
Config.UsingQFIdentity = true

-- Event fired by the "Back" button when you are NOT using qf_identity.
-- e.g. "esx:relog", "qb-multicharacter:client:chooseChar"
Config.RelogEvent = "esx:relog"

-- Shows the "Back" button that returns the player to the character selection.
Config.EnableBackButton = true

-- SET TO TRUE: ONLY if you are NOT using a multicharacter script.
-- This forces the spawn selector to automatically trigger the moment the player connects.
Config.AutoOpen = false

-- Toggles the iconic GTA V "zoom out to clouds, zoom into ground" cinematic camera effect.
Config.UseGTASwitch = true

-- Allows the player to select the exact coordinate where they previously disconnected.
Config.AllowLastLocation = true

-- Camera position while the player is choosing a spawn.
Config.SelectionCoords = vector4(-862.8547, -1606.7404, 52.8938, 353.5509)
```

{% hint style="danger" %}
**Danger: Conflicting Triggers** If `Config.AutoOpen` is set to `true` while a multicharacter script is active, players will experience overlapping UIs, broken cameras, and potential soft-locks. Ensure `AutoOpen` is strictly `false` when paired with multicharacter systems.
{% endhint %}

**Appearance & Language**

```lua
-- Accent colour of the interface.
Config.PrimaryColor = "#2F6AFE"

-- pl-PL, en-US, de-DE, es-ES, fr-FR, it-IT, ja-JP, ko-KR, pt-PT, ru-RU, tr-TR
Config.Locale = 'en-US'

-- Fallback icons, used when a spawn does not define its own `icon`.
Config.Icons = {
    location = "mdi:location",
    locationSelected = "mdi:location-circle",
    dollar = "lucide:dollar-sign",
    lock = "material-symbols:lock",
}
```

**Cinematic Spawn** The camera flight played once the player has confirmed their choice.

```lua
Config.CinematicSpawn = {
    enabled = true,
    skippable = true,    -- the player can skip the flight by pressing SPACE
    flyDuration = 4000,  -- ms, camera flying from top down in front of the character
    viewDuration = 2000, -- ms, how long the character is admired afterwards
    camOffset = vector3(0.0, 3.0, 0.5), -- camera position relative to the player
    scenarios = {
        "WORLD_HUMAN_SMOKING",
        "WORLD_HUMAN_AA_COFFEE",
        "WORLD_HUMAN_TOURIST_MAP"
    }
}
```

***

### Defining Spawn Locations

Locations are defined in `config/default_data.lua`, in the global table `DefaultSpawns`. You can restrict specific spawns to certain jobs or assign a cost to use a spawn point.

```lua
DefaultSpawns = {
    {
        id = "lspd_hq",
        label = "Mission Row PD",
        description = "Authorized personnel only.",
        type = "unlocked",
        price = 0,
        coords = vector4(425.1, -979.5, 30.7, 90.0),
        category = "Jobs",
        icon = "lock",
        -- JOB RESTRICTION: Only Police grade 0 or higher can see/use this spawn
        jobs = {
            { name = "police", grade = 0 }
        }
    },
    {
        id = "motel",
        label = "Pink Cage Motel",
        description = "A cheap place to crash.",
        type = "paid",
        price = 500, -- taken from cash first, then from the bank
        coords = vector4(314.5, -278.5, 54.1, 0.0),
        category = "Public",
        icon = "lucide:bed"
    }
}
```

#### Fields

| Field         | Required | Description                                                                                                                            |
| ------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `id`          | yes      | Unique key. Also the primary key in the database.                                                                                      |
| `label`       | yes      | Title shown in the list. `name` is accepted as an alias.                                                                               |
| `description` | no       | Subtitle. `desc` is accepted as an alias. Only shown for `unlocked` spawns — `paid` and `locked` display a translated line instead.    |
| `type`        | no       | `unlocked`, `paid` or `locked`. Defaults to `unlocked`.                                                                                |
| `price`       | no       | Only used by `paid`. Taken from cash first, then from the bank.                                                                        |
| `coords`      | yes      | `vector4`, the `w` component is the heading.                                                                                           |
| `category`    | no       | Free text grouping.                                                                                                                    |
| `icon`        | no       | Any Iconify name (`lucide:tree-pine`) or a key of `Config.Icons` (`location`, `dollar`, `lock`). Falls back to the icon of the type.   |
| `jobs`        | no       | List of `{ name = "police", grade = 0 }`. Absent or empty means visible to everyone. The player needs the job and at least that grade. |

#### Spawn types

* **`unlocked`** — open to everyone, subject to `jobs`. `free`, `open` and `public` are accepted as aliases, and any unrecognised value falls back to `unlocked`.
* **`paid`** — costs `price`. Hidden for a brand new character, since a fresh character cannot pay for it yet.
* **`locked`** — shown greyed out and cannot be selected. Use it as a teaser for locations you unlock later.

{% hint style="warning" %}
**`default_data.lua` is only imported into an empty database.** On the first start the spawns are copied into the `qf_spawnselector_spawns` table, and from that moment the database is the source of truth — later edits to the file appear to do nothing.

While you are building your spawn list, set `Config.AlwaysSyncDefaultSpawns = true`. The file is then written over the stored rows on every restart. Turn it back off once you are done, otherwise it overwrites changes made in `/spawnadmin`.
{% endhint %}

#### Editing in game

`/spawnadmin` opens the admin panel, where spawns can be created, edited, reordered, deactivated and deleted — including their job restrictions and icons. Changes are written to the database and pushed to connected players immediately.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://wiki.qfdevelopers.com/scripts/editor-2/configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
