Skip to content

Exports ​

Use these from other resources to interact with the housing system.

Resource name: prp-property.

Manifest note

fxmanifest.lua lists a subset under server_exports / client_exports. Other exports below are still registered with exports("Name", ...) and work the same way.

Server — access & housing records ​

ExportParametersReturnsDescription
HasHousingAccess(stateId, housingId, privilege?)boolean / access rowOwner always true; otherwise checks keyholder privileges
HasPropertyUpgrade(housingId, upgradeName)booleanWhether the housing has that upgrade
GetHousing(housingId)table?Housing row by id
GetHousingFromLocationId(locationId)table?Housing row for a location
GetLocationFromHousingId(housingId)table?Location data for a housing id
GetProperties(term?, onlyOwner?)table[]Search / list properties
GetPropertiesByOwner(ownerStateId)table[]Properties owned by a character
GetPlayersCloseToHouse(housing)number[]Player sources near the property
IsHousingLoaded()booleanBoot finished and data loaded
ToggleLock(housingId, isUnlocked, doorIndex?)booleanLock or unlock a door

Examples ​

lua
local hasAccess = exports["prp-property"]:HasHousingAccess(stateId, housingId, "FURNISH")
lua
local housing = exports["prp-property"]:GetHousingFromLocationId(locationId)
if housing then
    exports["prp-property"]:ToggleLock(housing.id, true)
end
lua
local properties = exports["prp-property"]:GetPropertiesByOwner(stateId)
for _, property in ipairs(properties) do
    print(property.location_id)
end

Server — apartments ​

Requires prp-apartments started. See Apartments.

ExportParametersReturnsDescription
GetPlayerApartment(src)table / falseSession unit assigned to that player
GetApartment(apartmentId)table / falseUnit by physical apartment id
GetApartmentIdByStateId(stateId)number / nilPhysical unit id for a character
GetHousingFromApartmentId(apartmentId)housing, housingId / falsePersistent world_housing row (location_id = -1) for whoever is assigned that unit
EnsurePlayerApartmentHousing(src)table / falseEnsure / return the character’s apartment housing row

Apartment table fields:

FieldTypeDescription
idnumberPhysical unit id
roomstringRoom number (e.g. "101")
floornumberFloor
buildingnumberTower id (1–4)
coordsvector3 / tableUnit coordinates

Tower (building) ids:

buildingTower
1Lombank Tower 1
2Lombank Tower 2
3Eclipse Tower
4Tinsel Tower

Examples ​

lua
local apartment = exports["prp-property"]:GetPlayerApartment(src)
if apartment then
    print(apartment.room, apartment.floor, apartment.building)
end
lua
local apartment = exports["prp-property"]:GetPlayerApartment(src)
if not apartment then return end

local towerNames = {
    [1] = "Lombank Tower 1",
    [2] = "Lombank Tower 2",
    [3] = "Eclipse Tower",
    [4] = "Tinsel Tower",
}

print(("Room %s · Floor %s · %s"):format(
    apartment.room,
    apartment.floor,
    towerNames[apartment.building] or ("Tower " .. tostring(apartment.building))
))
lua
local housing = exports["prp-property"]:EnsurePlayerApartmentHousing(src)
if housing then
    print(housing.id, housing.location_id) -- location_id is always -1 for apartments
end
lua
local apartmentId = exports["prp-property"]:GetApartmentIdByStateId(stateId)
local unit = apartmentId and exports["prp-property"]:GetApartment(apartmentId)

Server — furniture & settings ​

ExportParametersReturnsDescription
GetFurniture(housingId)table[]All furniture in a property
GetFurnitureByIds(housingId, furnitureId)table?One furniture piece
DestroyFurniture(furnitureId)booleanRemove a furniture piece
IsBreachedStorage(housingId, furnitureId)booleanWhether that storage was breached
SetHousingLocationSetting(housingId, key, value)booleanSet a location setting
GetHousingLocationSetting(housingId, key)anyGet a location setting
AddPlaceHandler(category, handler)voidCustom place handler (server-side registration in furniture.lua)

Server — real estate / market / rent ​

ExportParametersReturnsDescription
CreateShellLocation(payload)locationId / falseCreate a shell-backed location
CreateIplLocation(payload)locationId / falseCreate an IPL interior location
GetMarketListings(filter?)table[]all / sale / rent / auction
GetMarketListing(locationId)table?Single market listing
PurchaseListing(src, locationId)ok, err?Bank purchase for direct sale
ListProperty(src, locationId, data)ok, err?Put on market (sale/offer/auction)
RemoveListing(src, locationId)ok, err?Clear sale listing + refund bids
PlaceOffer(src, locationId, amount)ok, bid/errOffer with deposit
PlaceAuctionBid(src, locationId, amount)ok, bid/errAuction bid with deposit
GetRentData(locationId)table?Rent data
SaveRentData(locationId, rentData)booleanUpsert rent row
ResetPlayerShell(src)voidReset a player's shell session / bucket
ResetPlayerIpl(src)voidReset a player's IPL interior session / bucket

Guide — phone app integration ​

  1. Declare / use the client export to open the built-in market UI:
lua
RegisterNetEvent("myphone:openHousingMarket", function()
    exports["prp-property"]:OpenMarket()
end)
  1. Or build a custom NUI: fetch listings on the server:
lua
lib.callback.register("myphone:housingListings", function(src, filter)
    if not src then return {} end
    return exports["prp-property"]:GetMarketListings(filter or "sale")
end)
  1. Load one listing: GetMarketListing(locationId).
  2. Purchase: PurchaseListing(src, locationId).
  3. Offers / auctions: PlaceOffer / PlaceAuctionBid.
  4. List / unlist: ListProperty / RemoveListing.

Staff tablet: exports["prp-property"]:OpenRealEstate().

Full market player flow: Market.

Server — electricity ​

ExportParametersReturnsDescription
GetMaxElectricity(housingId)numberMax electricity capacity
GetElectricityDrain(housingId)numberCurrent drain
GetPotentialElectricityDrain(housingId)numberPotential drain
CanUseFurnitureElectricity(housingId, …)booleanWhether furniture can draw power
TriggerElectricityOverload(housingId)voidForce an overload

See Electricity.

Server — misc ​

ExportParametersReturnsDescription
GetClosestOrganization(src)false / orgStubbed warehouse HQ helper — currently returns false

Client — apartments ​

ExportParametersReturnsDescription
GetMyApartment()table?Local player’s assigned unit (id, room, floor, building, coords)
GenerateApartments(floor, buildingId)void(Re)generate apartment door interactions for a floor
lua
local apartment = exports["prp-property"]:GetMyApartment()
if apartment then
    print(apartment.room, apartment.floor, apartment.building)
end

Same tower ids as the server section (building 1–4).

Client — garage & UI ​

ExportParametersReturnsDescription
GetClosestGarage(coords?, skipAccessCheck?)garage?, distance?Nearest property garage
OpenMarket()voidOpen the housing market NUI
OpenRealEstate()voidOpen the staff real estate tablet
lua
local garage = exports["prp-property"]:GetClosestGarage()
if garage then
    print(garage.housing_id)
end
lua
exports["prp-property"]:OpenMarket()
exports["prp-property"]:OpenRealEstate()

Client — furniture extensions ​

ExportParametersReturnsDescription
AddFurnitureModelInteraction(model, data)voidExtra target option on a furniture model
AddMoveEvent(model, data)voidMove/gizmo event for a model
lua
exports["prp-property"]:AddFurnitureModelInteraction("pr_furniture_tv_01", {
    label = "Turn On",
    onSelect = function(entity)
        -- custom logic
    end
})

HousingBridge (same resource) ​

HousingBridge in shared/bridge_adapter.lua is not a FiveM export. Call it only from within prp-property (or after editing that file). Useful helpers for integrators editing the resource:

HelperRole
isHousingStaff / hasConfiguredStaffJobStaff job / admin checks (Config.HousingStaff)
hasRePermission / getRePermissionsReal estate grade permissions
notify / notifySuccess / notifyErrorFramework notify
chargeBank / depositBankMoney
ensureStash / openStashInventory stashes
actionShow / actionHideTextUI
playLocationSpatial / doorbell feedback

Active electricity helpers live in server/electricity/electricity.lua (GetElectricityDrain, GetMaxElectricity, CanUseFurnitureElectricity, …). See Electricity.