Skip to content

Spawn Selector

Configure where and how players spawn after selecting a character.

๐ŸŽฏ Spawn Configuration#

Located in config/config.lua:

lua
Config.ApartmentStart = false
Config.NewPlayerSpawnCoords = vec4(-1037.74, -2737.75, 20.17, 327.06)
Config.SkipSpawnSelector = true
Config.SpawnSelector = '0r-spawn'

โš™๏ธ Configuration Options#

Skip Spawn Selector#

lua
Config.SkipSpawnSelector = true  -- Skip selector, spawn at last location
ValueBehavior
truePlayers spawn directly at their last location
falsePlayers see the spawn location selector

Spawn Selector Type#

lua
Config.SpawnSelector = '0r-spawn'  -- Which spawn system to use
ValueDescription
'0r-spawn'Built-in spawn selector (recommended)
'qb-spawn'QBCore's spawn system
'qbx_spawn'QBox spawn system
'um-spawn'UM spawn selector
'vms_spawnselector'VMS spawn selector
'custom'Use custom export function

New Player Spawn#

Where newly created characters spawn:

lua
Config.NewPlayerSpawnCoords = vec4(-1037.74, -2737.75, 20.17, 327.06)

Format: vec4(x, y, z, heading)


Apartment Start#

Enable apartment selection for new characters:

lua
Config.ApartmentStart = false  -- Show apartment selection for new characters

When true, new characters choose their starting apartment from config/apartments.lua.


๐Ÿ“ Spawn Locations#

Configure available spawn points in Config.SpawnLocations:

lua
Config.SpawnLocations = {
    {
        id = 1,
        label = 'Legion Square',
        img = 'legion-square',           -- Image in web/build/imgs/
        icon = 'fa-solid fa-city',       -- FontAwesome icon
        coords = vec4(195.17, -933.77, 29.7, 144.5)
    },
    {
        id = 2,
        label = 'Paleto Bay',
        img = 'paleto-bay',
        icon = 'fa-solid fa-mountain-city',
        coords = vec4(80.35, 6424.12, 30.67, 45.5),
    },
    {
        id = 3,
        label = 'Motels',
        img = 'motels',
        icon = 'fa-solid fa-house',
        coords = vec4(327.56, -205.08, 53.08, 163.5),
    },
    -- Add more locations...
}

Location Properties#

PropertyTypeDescription
idnumberUnique identifier
labelstringDisplay name
imgstringImage filename (without extension)
iconstringFontAwesome icon class
coordsvec4Spawn coordinates (x, y, z, heading)

๐Ÿ–ผ๏ธ Adding Custom Location Images#

  1. Create a 16:9 image (recommended: 400x225 pixels)
  2. Save as PNG in web/build/imgs/
  3. Reference by filename (without .png)
lua
{
    id = 10,
    label = 'My Custom Location',
    img = 'my-custom-location',  -- web/build/imgs/my-custom-location.png
    icon = 'fa-solid fa-star',
    coords = vec4(100.0, 200.0, 30.0, 90.0)
}

๐Ÿ”ง Custom Spawn Function#

For advanced spawn logic, use the custom export:

lua
Config.SpawnSelector = 'custom'

Config.CustomSpawnExports = function(playerId, position)
    -- Your custom spawn logic here
    -- playerId = player's server ID
    -- position = last known position
    
    -- Example: Trigger your own spawn system
    TriggerClientEvent('my-spawn:open', playerId)
end

๐ŸŽฎ HUD Integration#

Control HUD visibility during spawn selection:

lua
Config.CustomHud = function(status)
    if status then
        -- HIDE HUD during spawn selection
        exports['my-hud']:hideHud()
    else
        -- SHOW HUD after spawning
        exports['my-hud']:showHud()
    end
end

๐Ÿ“‹ Complete Example#

lua
-- Skip spawn selector - spawn at last location
Config.SkipSpawnSelector = false  -- Show the selector
Config.SpawnSelector = '0r-spawn'
Config.ApartmentStart = false
Config.NewPlayerSpawnCoords = vec4(195.17, -933.77, 29.7, 144.5)

Config.SpawnLocations = {
    {
        id = 1,
        label = 'Legion Square',
        img = 'legion-square',
        icon = 'fa-solid fa-city',
        coords = vec4(195.17, -933.77, 29.7, 144.5)
    },
    {
        id = 2,
        label = 'Paleto Bay',
        img = 'paleto-bay',
        icon = 'fa-solid fa-mountain-city',
        coords = vec4(80.35, 6424.12, 30.67, 45.5)
    },
    {
        id = 3,
        label = 'Sandy Shores',
        img = 'sandy-shores',
        icon = 'fa-solid fa-sun',
        coords = vec4(1841.35, 3668.89, 33.68, 213.45)
    },
    {
        id = 4,
        label = 'Hospital',
        img = 'hospital',
        icon = 'fa-solid fa-hospital',
        coords = vec4(285.21, -579.42, 43.23, 70.61)
    },
}

Config.CustomHud = function(status)
    -- Your HUD toggle logic
end

๐Ÿ  Apartment Configuration#

See the dedicated apartments page: