qbx_properties

if not GetResourceState('qbx_properties') == 'started' then return end

Property = {

  ---@param source number
  ---@return table A list of properties with keys: value, label, coords<optional>
  GetPlayerProperties = function(stateid)
    local result = MySQL.query.await(
      [[
        SELECT
          id as value,
          property_name as label,
          coords
        FROM
          properties
        WHERE
          owner = ?
      ]], { 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?