Kartik Scripts

GetPropertyHousingData

exports['kartik-properties']:GetPropertyHousingData(propertyId)

🔹 Description

Returns detailed, normalized housing data for a specific property by its ID. Formatted for phone app detail pages, displaying entrance coords, lock status, owner citizen ID, and a list of all keyholders.


🔧 Parameters

NameTypeRequiredDescription
propertyIdnumber | string✅The property ID to query.

📤 Returns

TypeDescription
table | nilFormatted phone housing record (or nil if property does not exist).

📦 Returned Housing Object Shape

FieldTypeDescription
houseIdstringUnique property ID (tostring(id)).
labelstringProperty display label or address.
coordstableEntrance coordinates { x = 0.0, y = 0.0, z = 0.0 }.
keyholderstable[]Array of keyholders { name, identifier, isowner }.
ownerstringCitizen ID of the property owner.
lockedbooleantrue if the property door is currently locked.

🧠 Example Usage

local house = exports['kartik-properties']:GetPropertyHousingData(12)

if house then
    print(('Property %s has %s keyholders'):format(house.label, #house.keyholders))
    for _, k in ipairs(house.keyholders) do
        print((' - %s (%s) [Owner: %s]'):format(k.name, k.identifier, tostring(k.isowner)))
    end
end

On this page