Commands and Exports — Apartments | Quasar Store | Quasar Store
Documentation
Commands and Exports
Every Apartments command and keybind, plus the exports and events for FiveM scripts: InApartment, inDecorate, GetApartments, AddFurniture, starter apartments and furniture with your own event.
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
/Apartment
Players
Opens the Apartment Menu to claim an apartment, for a player who has none. The name is Config.ApartmentSelector.
/ApartmentLocation
Inside an apartment
Opens Apartments Location to place the stash, the wardrobe or the charger. The name is Config.ApartmentLocation.
/ApartmentDecoration
Inside an apartment
Opens the decoration menu. Bound to F9 (Config.DecorationMappingKey), listed in the game's key bindings as Open Mapping UI. The name is Config.ApartmentDecoration.
/apartmentfurniture
Admins
Opens the Furniture Creator. Anybody else is told You do not have permissions. The name is Config.FurniCreatorCommand.
/gizmo:apt
Debug only
Exists only while Config.Debug = true: a developer test that opens the decoration menu on a fixed apartment ID. Turn debug off on a live server.
Who counts as an admin is set by your framework — see Admin Access in Installation.
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?
lua
local atHome = exports['qs-apartments']:InApartment() -- inside any apartmentlocal decorating = exports['qs-apartments']:inDecorate() -- the decoration menu is open
Both return true or false — use them to keep a menu, a weapon or an emote out of the way.
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
lua
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.
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:
lua
-- 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
lua
-- 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
lua
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 home
The 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:
lua
AddEventHandler('weed:handleEnterZone', function(apartmentId)-- the player just walked inend)
AddEventHandler('weed:handleExitZone', function()-- the player just leftend)
While a player is home, their framework metadata also holds inside.apartment.apartmentType (the building) and inside.apartment.apartmentId, as qb-apartments did.
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:
lua
-- 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:
lua
-- client side, in your resource
AddEventHandler('my-laptop:open', function(furnitureId)-- furnitureId is unique to this placed pieceend)
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.
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.