Commands#
Apartments registers four chat commands and one keybind. Every name is a setting in config/main.lua, so you can rename them.
Command | Who | Description |
|---|---|---|
| Players | Opens the Apartment Menu to claim an apartment, for a player who has none. The name is |
| Inside an apartment | Opens Apartments Location to place the stash, the wardrobe or the charger. The name is |
| Inside an apartment | Opens the decoration menu. Bound to |
| Admins | Opens the Furniture Creator. Anybody else is told You do not have permissions. The name is |
| Debug only | Exists only while |
Who counts as an admin is set by your framework — see Admin Access in Installation.
Client Exports#
For asking where the player is from your own scripts — a phone app, a radial menu, a job that should not run at home — and for extending the catalogue.
Is the player at home or decorating?
local atHome = exports['qs-apartments']:InApartment() -- inside any apartment
local decorating = exports['qs-apartments']:inDecorate() -- the decoration menu is openBoth return true or false — use them to keep a menu, a weapon or an emote out of the way.
Add furniture from another resource
exports['qs-apartments']:AddFurniture('chair', {
object = 'prop_chair_01a',
label = 'Garden chair',
description = 'Plastic, but comfortable.',
price = 150,
img = 'https://...',
colorlabel = 'White',
colors = {},
})The first argument is an existing category key from config/furniture.lua. The piece is added to that player's decoration menu until the resource restarts, so call it on every client. For a permanent piece every player gets and can sell back, use the Furniture Creator or config/furniture.lua instead.
Add a shell tier
exports['qs-apartments']:AddShell({ model = 'shell_michael' })Appends a tier to Config.Shells on that client — the next free number. Adding it to the config file is simpler; either way the tier needs its exit door placed once.
Shared Exports#
Available on both the client and the server.
GetApartments
Every building, in the shape qb-apartments used, so a spawn selector or phone app written for it keeps working:
local apartments = exports['qs-apartments']:GetApartments()
-- { Starting = true, Locations = { [key] = { name, label, image, description, price, tier, coords, area } } }
for key, building in pairs(apartments.Locations) do
print(key, building.label, building.price, building.coords.enter)
endEvents#
The same events the built-in menus use, for driving Apartments from a spawn selector, a radial menu or an admin tool.
Give a player an apartment
Sent from the player's own client. It is free — nothing is charged:
-- building key, label, first spawn
TriggerServerEvent('apartments:server:CreateApartment', 'sr_drive_a', 'South Rockford Drive', true)A number is added to the label, the player is told You have received an apartment and their blips are set. With true as the last argument they are also walked inside and the character creator opens — the starter-apartment flow.
Send a player into their apartment
-- server side: the apartment ID and its building key, from player_apartments
TriggerClientEvent('apartments:client:SpawnInApartment', source, 'sr_drive_a4821', 'sr_drive_a')Open the menus from a radial menu
ExecuteCommand('ApartmentDecoration') -- the decoration menu
TriggerEvent('qs-apartments:client:locations') -- stash, wardrobe and charger points
TriggerEvent('apartments:client:HandleLeaveApartment') -- walk out
TriggerEvent('apartments:client:SetHomeBlip', 'sr_drive_a') -- redraw the blips, this one as homeThe first two only open while the player is inside an apartment.
Know when a player goes home
Apartments fires two client events, meant for scripts that work inside homes:
AddEventHandler('weed:handleEnterZone', function(apartmentId)
-- the player just walked in
end)
AddEventHandler('weed:handleExitZone', function()
-- the player just left
end)While a player is home, their framework metadata also holds inside.apartment.apartmentType (the building) and inside.apartment.apartmentId, as qb-apartments did.
Furniture With Your Own Event#
Any piece can do something of yours: a laptop that opens a computer, a jukebox, a safe. List its model in Config.DynamicFurnitures with an event and an offset — where the prompt sits on the model:
-- config/furniture.lua
Config.DynamicFurnitures = {
['prop_laptop_01a'] = {
event = 'my-laptop:open',
offset = { x = 0.0, y = 0.0, z = 0.3 },
},
}Once a player has placed that model, standing at it shows [E] - Interact — or Interact with object with a target — and the event fires on their client with the piece's ID:
-- client side, in your resource
AddEventHandler('my-laptop:open', function(furnitureId)
-- furnitureId is unique to this placed piece
end)The model must also be a piece in a furniture category, or players have nothing to buy. Do not use event on a piece that is already a stash or a wardrobe.
About the Messages#
Everything a player reads comes from locales/<language>.json, in the language set by Config.Locale. To reword a prompt or a notification, edit it there — the keys are grouped by where they appear: entrance_menu, drawtext, vault_code, decorate, furniture_creator, junk, cleaner.



