Skip to main content

Spawn Selector

Spawn location selector with camera flyover animations

This section

Spawn Selector

Choose a spawn location after selecting your character. Features camera flyover animations and configurable locations.

Spawn Modes

The behaviour after a player presses Play is controlled by two config options:

Config.UseSpawnSelectorConfig.CustomSpawnSelectorResult
true(ignored)The built-in spawn selector screen is shown
falsefalseNo selector — the player spawns directly at their last position (or Config.DefaultSpawn for new characters)
falsetrueNo built-in selector — your own spawn selector resource takes over (see below)

How It Works (built-in selector)

  1. Select your character from the selection screen
  2. The spawn selector appears with predefined locations
  3. Hover over a location to see a camera flyover preview
  4. Click to confirm your spawn point

Default Locations

NameDescription
Pillbox HillCentral city location
Mission RowNear the police station
Mirror ParkResidential area
Del PerroBeach/pier area
Last LocationSpawn at your last known position

Configuration

lua
Config.SpawnLocations = {
{ label = "Pillbox Hill", coords = vector4(...) },
{ label = "Mission Row", coords = vector4(...) },
-- add more locations...
}
OptionDefaultDescription
Config.UseSpawnSelectorfalseShow the built-in spawn selector screen
Config.CustomSpawnSelectorfalseHand off to your own spawn selector resource (requires UseSpawnSelector = false)
Config.UseQBHousesfalseInclude qb-apartments as spawn option
Config.DefaultSpawnvector4Default spawn coordinates

Using Your Own Spawn Selector

If you already have a spawn selector resource, you can let it take over. Set:

lua
Config.UseSpawnSelector = false,
Config.CustomSpawnSelector = true,

When a player picks a character and presses Play, the multicharacter script:

  1. Logs the character in on the server
  2. Closes its UI, releases NUI focus and destroys its camera
  3. Fires the client event below — then it's out of your way
lua
RegisterNetEvent("code9_multichar:client:spawnSelector", function(charData)
-- charData.position = the character's last saved position {x, y, z, w}
-- charData.identifier, charData.firstname, charData.lastname, ... are also available
-- The player is already logged in and the menu is closed here.
-- Open your own spawn selector and teleport the player wherever you want.

exports["my_spawn_selector"]:Open(charData)
end)