qb-apartments
if not GetResourceState('qb-apartments') == 'started' then return end
local QBCore = exports['qb-core']:GetCoreObject()
Property = {
---@param stateid string
---@return table A list of properties with keys: value, label, coords<optional>
GetPlayerProperties = function(stateid)
local result = MySQL.single.await(
'SELECT apartment FROM players WHERE citizenid = ?',
{ stateid }
)
if not result or not result.apartment then
prints.error('Apartment not found for stateid: %s', stateid)
return {}
end
local apartmentId = result.apartment
local apartmentData = Apartments.Locations[apartmentId]
if not apartmentData then
prints.error('Apartment data not found for apartment ID: %s', apartmentId)
return {}
end
local coords = apartmentData.coords and apartmentData.coords.enter
local coordsTable = coords and { x = coords.x, y = coords.y } or nil
return {
{
value = apartmentId,
label = apartmentData.label or apartmentId,
coords = coordsTable
}
}
end
}
Last updated
Was this helpful?