AssignStarterApartment
exports['kartik-properties']:AssignStarterApartment(source, propertyId)๐น Description
Moves a player into a starter apartment from another resource, such as a custom multicharacter or spawn script. It:
- Creates a weekly lease at the unit's starter rent (the landlord is the unit's owner: company, job or state).
- Grants the player a key (
granted_by = 'starter'). - Takes the unit off the market and locks it.
- Sets the
inside_propertymetadata so the player spawns inside on their next load. - Updates the unit straight away: it shows in the entrance Select Unit list and the tablet building directory, and the player's map pins refresh. For a starter pool unit, the pool also files its next waiting unit.
The player can already be loaded (for example when the export is called from an NPC at a real estate office). No restart or relog is needed.
๐ง Parameters
| Name | Type | Required | Description |
|---|---|---|---|
source | number | โ | Server id of the player to move in. |
propertyId | number | string | โ | Id of a unit flagged as a starter. |
๐ค Returns
| Type | Description |
|---|---|
boolean | true on success, or if this player already leases the unit (nothing is created twice). false if the player has no character, the unit doesn't exist, isn't a starter, is frozen, or is already leased to another player. |
๐ง Example Usage
RegisterNetEvent('my-multichar:server:pickedStarter', function(propertyId)
local src = source
if exports['kartik-properties']:AssignStarterApartment(src, propertyId) then
TriggerClientEvent('kartik-properties:client:spawnInStarter', src, propertyId)
end
end)๐ Notes
This export does not check whether the starter system is switched on, or whether the player already has another home. It does refuse a unit that is leased to another player, so a false result can mean "pick another unit".
- The built-in starter flow (auto-assign / selection screen) does not need this export. It is only for custom spawn flows.
- See Starter Apartments for how starters are flagged and supplied.