How to use Starter Apartments
1. Prepare the Property
Enter the server, go to the /housing admin menu and create a Building. Then:
Save the property
Go to your database and find the
idof the new property in thehousestableCopy that ID and paste it into the
Objectfield in the config below
2. Configure Starter Apartments
Go to the config.lua file and find this code:
Config.StarterApartments = {
Object = 114, -- You need to have a property building created and here is to find the id of this building from the database.
Name = 'Starting Apartment #%s', -- Name of the starter apartment, which will be displayed in the menu.
Type = 'shell', -- 'shell' / 'ipl'
Shell = 'standardmotel_shell',
Ipl = 'apa_v_mp_h_01_a',
DefaultPurchasePrice = 0, -- Default purchase price of the starter apartment. (By setting 0, the player will not be able to sell the property to make money)
DefaultRentPrice = 0, -- Default rent price of the starter apartment.
AllowFurnitureInside = true, -- true : Allow furniture inside the starter apartment
AllowChangeTheme = true, -- true : Allow changing the theme of the starter apartment IPL
DefaultThemeIpl = 'modern',
Delivery = {
Enabled = true,
Coords = vector4(2.4304, -2.1917, 498.4416, 79.99999237060547), -- Coords of the storage in the starter apartment
},
Storage = {
Enabled = true,
Coords = vector3(1.5388, -3.0803, 499.7162), -- Coords of the storage in the starter apartment
Slots = 20, -- Slots of the storage in the starter apartment
Weight = 25000, -- Weight of the storage in the starter apartment
},
Wardrobe = {
Enabled = true,
Coords = vector3(1.3227, 2.8945, 500.0726), -- Coords of the wardrobe in the starter apartment
},
}3. Assign Apartment Automatically
From your multicharacter, identity, or framework, call this server-side export when a player registers for the first time:
---@param {identifier: string}: Player Identifier (e.g. 'char1:1100113jadckz')
exports['vms_housing']:AddStarterApartment(identifier)Go to your
es_extended/server/main.luaFind your function
loadESXPlayerGo to the end of the function and add the highlighted code in the appropriate place:
TriggerEvent("esx:playerLoaded", playerId, xPlayer, isNew)
userData.money = xPlayer.getMoney()
userData.maxWeight = xPlayer.getMaxWeight()
xPlayer.triggerEvent("esx:playerLoaded", userData, isNew, userData.skin)
if setPlayerInventory then
setPlayerInventory(playerId, xPlayer, userData.inventory, isNew)
end
if isNew then
exports['vms_housing']:AddStarterApartment(identifier)
end
xPlayer.triggerEvent("esx:registerSuggestions", Core.RegisteredCommands)
print(('[^2INFO^0] Player ^5"%s"^0 has connected to the server. ID: ^5%s^7'):format(xPlayer.getName(), playerId))
endGo to your
qb-multicharacter/server/main.luaFind your function
GiveStarterItemsAdd the highlighted code in the appropriate place:
local function GiveStarterItems(source)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
for _, v in pairs(QBCore.Shared.StarterItems) do
local info = {}
if v.item == 'id_card' then
info.citizenid = Player.PlayerData.citizenid
info.firstname = Player.PlayerData.charinfo.firstname
info.lastname = Player.PlayerData.charinfo.lastname
info.birthdate = Player.PlayerData.charinfo.birthdate
info.gender = Player.PlayerData.charinfo.gender
info.nationality = Player.PlayerData.charinfo.nationality
elseif v.item == 'driver_license' then
info.firstname = Player.PlayerData.charinfo.firstname
info.lastname = Player.PlayerData.charinfo.lastname
info.birthdate = Player.PlayerData.charinfo.birthdate
info.type = 'Class C Driver License'
end
exports['qb-inventory']:AddItem(src, v.item, v.amount, false, info, 'qb-multicharacter:GiveStarterItems')
end
exports["vms_housing"]:AddStarterApartment(Player.PlayerData.citizenid)
end4. Additional Notes
Set
DefaultPurchasePriceandDefaultRentPriceto0to prevent players from selling the apartment.This system is perfect for giving new players a default place to live without extra steps.
You can fully customize the locations for delivery, wardrobe, and storage.
Once configured, your players will receive a starter apartment automatically when joining the server or creating their character.
Last updated
Was this helpful?