buildingApartments

Configure starting apartment selection for new characters.

🏠 Overview

When Config.ApartmentStart = true, new characters will see an apartment selection screen before spawning. This integrates with apartment/housing systems.


⚙️ Enable Apartments

In config/config.lua:

Config.ApartmentStart = true  -- Enable apartment selection for new characters

📁 Configuration File

Apartments are configured in:

config/apartments.lua

🏗️ Apartment Structure

local Apartments = {}

Apartments.List = {
    ['qb-core'] = {
        {
            id = 'apartment_1',
            label = 'South Rockford Drive',
            img = 'integrity-way',
            icon = 'fa-solid fa-building',
            coords = vec4(-667.02, -1105.01, 14.63, 242.32),
        },
        -- More apartments...
    },
    ['es_extended'] = {
        -- ESX apartments...
    },
    ['qbx_core'] = {
        -- QBox apartments...
    },
}

-- Function called when player selects an apartment
Apartments.SpawnCreateCharacter = function(apartmentType)
    -- Integration with your apartment/housing script
end

return Apartments

⚙️ Apartment Properties

Property
Type
Description

id

string

Unique identifier for the apartment

label

string

Display name

img

string

Image filename (in web/build/imgs/)

icon

string

FontAwesome icon class

coords

vec4

Spawn coordinates (x, y, z, heading)


🎮 Framework-Specific Configuration

QBCore

ESX


🔧 Spawn Function

The SpawnCreateCharacter function is called when a player selects their apartment:


🖼️ Adding Apartment Images

  1. Take a screenshot of the apartment exterior

  2. Save as PNG in web/build/imgs/

  3. Reference the filename (without extension) in config


📋 Complete Example


❓ Troubleshooting

Apartment Selection Not Showing

  1. Ensure Config.ApartmentStart = true

  2. Check that apartments are configured for your framework

Apartment Not Assigned

  1. Check integration with your housing script

  2. Verify SpawnCreateCharacter function

  3. Check server console for errors

Last updated