> For the complete documentation index, see [llms.txt](https://viceworks.gitbook.io/vice-works-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://viceworks.gitbook.io/vice-works-docs/resources/spawn/multicharacters/um-multicharacter.md).

# um-multicharacter

spawn.lua

```lua
local apartmentStart = GetConvar('um:NewPlayerApartmentInsideStart', 'false') == 'true'

function GetApartmentInsideStartSpawnUI(src, newData)
    if not apartmentStart then
        TriggerClientEvent('um-multicharacter:client:defaultSpawn', src)
        Debug('New Character NewPlayerApartmentInsideStart is disabled, defaulting to default spawn')
        return
    end

    if GetResourceState('um-spawn') == 'started' then
        TriggerClientEvent('um-spawn:client:startSpawnUI', src, newData)
        Debug('New Character um-spawn is started, using um-spawn')
    elseif GetResourceState('ps-housing') == 'started' then
        if GetResourceState('qbx_properties') == 'started' then
            TriggerClientEvent('apartments:client:setupSpawnUI', src)
            Debug('New Character ps-housing and qbox is started, using ps-housing')
            return
        end
        TriggerClientEvent('ps-housing:client:setupSpawnUI', src, newData, true, true)
        Debug('New Character ps-housing is started, using ps-housing')
    elseif GetResourceState('okokSpawnSelector') == 'started' then
        TriggerClientEvent('okokSpawnSelector:spawnMenu', src, true)
        Debug('New Character okokSpawnSelector is started, using okokSpawnSelector')
    elseif GetResourceState('vms_spawnselector') == 'started' then
        TriggerClientEvent('vms_spawnselector:open', src, true)
        Debug('New Character vms_spawnselector is started, using vms_spawnselector')
    elseif GetResourceState('qb-apartments') == 'started' then
        TriggerClientEvent('apartments:client:setupSpawnUI', src, newData, true, true)
        Debug('New Character qb-apartments is started, using qb-apartments')
    elseif GetResourceState('qbx_properties') == 'started' then
        TriggerClientEvent('apartments:client:setupSpawnUI', src)
        Debug('New Character qbx_properties is started, using qbx_properties')
    elseif GetResourceState('qbx_apartments') == 'started' then
        TriggerClientEvent('apartments:client:setupSpawnUI', src, newData)
        Debug('New Character qbx_apartments is started, using qbx_apartments')
    elseif GetResourceState('0r-apartment') == 'started' then
        TriggerClientEvent('apartments:client:setupSpawnUI', src, newData, true, true)
        Debug('New Character 0r-apartment is started, using 0r-apartment')
    elseif GetResourceState('vw-spawn') == 'started' then
        TriggerClientEvent('qb-spawn:client:setupSpawns', src, newData, true, true)
        Debug('New Character vw-spawn is started, using vw-spawn')
    else
        TriggerClientEvent('um-multicharacter:client:defaultSpawn', src)
        Debug('New Character No apartment resource found, defaulting to default spawn')
    end
end

function GetCharacterReadySpawnUI(src, cData)
    if Config.NoSpawnMenuOnlyLastLocation.Status then
        TriggerClientEvent("um-multicharacter:client:spawnLastCoords", src, json.decode(cData.position))
        Debug('Spawn NoSpawnMenuOnlyLastLocation is enabled, spawning last location')
        return
    end

    if GetResourceState('um-spawn') == 'started' then
        TriggerClientEvent('um-spawn:client:startSpawnUI', src, cData)
        Debug('Spawn um-spawn is started, using um-spawn')
    elseif GetResourceState('okokSpawnSelector') == 'started' then
        TriggerClientEvent('okokSpawnSelector:spawnMenu', src, false, json.decode(cData.position))
        Debug('Spawn okokSpawnSelector is started, using okokSpawnSelector')
    elseif GetResourceState('vms_spawnselector') == 'started' then
        TriggerClientEvent('vms_spawnselector:open', src)
        Debug('Spawn vms_spawnselector is started, using vms_spawnselector')
    elseif GetResourceState('qbx_spawn') == 'started' then
        TriggerClientEvent('qb-spawn:client:setupSpawns', src, cData?.citizenid)
        TriggerClientEvent('qb-spawn:client:openUI', src, true)
        Debug('Spawn qbx_spawn is started, using qb-spawn')
    elseif GetResourceState('qb-spawn') == 'started' then
        TriggerClientEvent('qb-spawn:client:setupSpawns', src, cData?.citizenid)
        TriggerClientEvent('qb-spawn:client:openUI', src, true)
    elseif GetResourceState('vw-spawn') == 'started' then
        TriggerClientEvent('qb-spawn:client:setupSpawns', src, cData?.citizenid)
        TriggerClientEvent('qb-spawn:client:openUI', src)
        Debug('Spawn vw-spawn is started, using vw-spawn')
    else
        TriggerClientEvent("um-multicharacter:client:spawnLastCoords", src, json.decode(cData.position))
        Debug('Spawn No spawn resource found, spawning last location')
    end
end
```


---

# 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:

```
GET https://viceworks.gitbook.io/vice-works-docs/resources/spawn/multicharacters/um-multicharacter.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.
