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
id
of the new property in thehouses
tableCopy that ID and paste it into the
Object
field 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 {src: number}: Player Server ID
exports["vms_housing"]:AddStarterApartment(src)
Go to your
es_extended/server/main.lua
Find your function
loadESXPlayer
Go 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))
end
4. Additional Notes
Set
DefaultPurchasePrice
andDefaultRentPrice
to0
to 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?