> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-spawn-selector/cas-spawn-selector.md).

# CAS Spawn Selector

`cas-spawnv2` is a modern, cinematic spawn selection system for **RedM** servers running **VORP**. It replaces standard spawning with a stylish UI where players pick from custom locations — each with its own background, logo, description and coordinates. Plug-and-play and fully automated through VORP's character events.

## Highlights

* Cinematic orbit-camera **or** static background per location
* Custom art (background + logo), description and coords per card
* Optional **Last Location** card from VORP's saved coordinates
* Show on every join, or only on first character creation
* Zero server-side setup — the UI loads automatically

## At a glance

|               |                            |
| ------------- | -------------------------- |
| Framework     | VORP                       |
| Server config | None required              |
| Resource name | `cas-spawnv2`              |
| Config file   | `config/client_config.lua` |

## Installation

1. Add the `cas-spawnv2` resource to your server.
2. Add `ensure cas-spawnv2` to your `server.cfg`.
3. Done — the UI loads automatically, no server-side config.

## Configuration

All settings live in `config/client_config.lua`.

### Global options

```lua
Config.debug = true                  -- dev mode: manual open + logs (set false on live)
Config.debugCommand = "spawns"        -- command to open the UI in debug mode
Config.onlyOnFirstLogin = false       -- false = every join, true = first character only
Config.LastLocationText = "The last place you walked before fading out..."
```

When a player has a saved VORP location, a **Last Location** card is added automatically, using `LastLocationText` as its description.

### Locations

```lua
Config.locations = {
    valentine = {
        useImage = false,
        backgroundImage = "valentinebg",
        coords = { x = -240.68, y = 740.66, z = 115.87, h = 90.0 },
        locationText = "A rough Heartlands town...",
        locationLogo = "valentinelogo"
    },
}
```

| Field             | Description                                                                          |
| ----------------- | ------------------------------------------------------------------------------------ |
| `useImage`        | `false` = cinematic camera orbit around the coords; `true` = static background image |
| `backgroundImage` | Image name (no extension) from the UI assets, shown behind the card                  |
| `coords`          | Spawn position — `x, y, z` world coords and `h` heading                              |
| `locationText`    | Description shown on the card                                                        |
| `locationLogo`    | Logo/image shown in the card header                                                  |

## How spawning works

On join, the script checks `onlyOnFirstLogin` to decide whether to show the UI. The player is frozen, hidden and made invincible while the menu is open. Selecting a location fades out, teleports the player, applies the heading, then closes the UI and resumes normal play. Fully automated — no extra setup.

## Support

Join the [CAS Discord](https://discord.gg/X8bTK9Stwk) or use the support channel on your product page.
