qb-houses

if not GetResourceState('qb-houses') == 'started' then return end

Property = {

  ---@param stateid string
  ---@return table A list of properties with keys: value, label, coords<optional>
  GetPlayerProperties = function(stateid)
    local result = MySQL.query.await(
      [[
        SELECT
          name as value,
          label,
          coords
        FROM
          houselocations
        WHERE
          citizenid = ?
      ]], { stateid }
    )

    if not result or #result == 0 then
      prints.error('Properties not found for stateid: %s', stateid)
      return {}
    end

    for i = 1, #result do
      local coords = json.decode(result[i].coords)
      result[i].coords = { x = coords.x, y = coords.y }
    end

    return result
  end
}

Last updated

Was this helpful?