Deltarix Scripts
TebexDiscord
  • Information
    • About Me - Deltarix
  • Keymaster
    • FiveM Asset Escrow
    • Authentication
    • Transfers
  • Paid Assets
    • MDT V3
      • Setup Guide
      • Configurations
        • Settings
        • Graphics
        • Locales
        • Themes
      • Exports
        • Server
          • OpenMDT
          • CloseMDT
          • CreateLog
          • GetBoloByLinkedId
          • GetIdentifierByStateId
          • GetOfficerByBadgenumber
          • GetOfficerByStateId
          • GetOfficerExists
          • GetOfficerFiredByStateId
          • GetOfficerSuspendedByStateId
          • GetPlayerFullNameByStateId
          • GetStateIdBySource
          • GetWantedByLinkedId
      • Public
        • Bridges
          • Server
            • Framework
              • qbx_core
              • qb-core
              • es_extended
            • Garage
              • qbx_garages
              • qb-garages
              • jg-advancedgarages
            • Inventory
              • ox_inventory
            • Licence
              • qbx_core
              • qb-core
            • Media
              • fivemanage
            • Property
              • qbx_properties
              • qb-apartments
              • qb-houses
              • qb-apartments & qb-housing
              • nolag_properties
              • qbx_properties & nolag_properties
        • Functions
          • Server
            • Create Card
            • Log
            • Prints
          • Client
            • Waypoint
            • Anim
      • Dependencies
    • MDT V2
      • Setup
      • Locales
      • Configurations
        • Server
        • Client
        • Settings
        • 10 Codes
        • Commands
      • Exports
        • Server
          • OpenMDT
          • OpenVehicleDetailsInMDT
          • GetStateId
          • GetOfficer
          • GetPlayerWanted
          • GetPlateFlagged
          • GetOfficerSuspended
          • GetWeaponRegistered
          • GetOfficerClockedIn
          • GetClosestCamera
          • CreateWeapon
          • CreateOfficer
          • DeleteOfficer
          • UpdateCitizenData
          • UpdateCitizenPoints
          • ToggleCamera
          • ToggleCameraTimeout
          • ToggleClock
        • Client
          • OpenMDT
          • InsertPhotoToGallery
      • Bridges
        • Server
          • Framework
            • es_extended
            • qb-core
            • qbx_core
          • Garage
            • esx_garage
            • qb-garages
            • qbx_garages
          • Inventory
            • ox_inventory
            • qb-inventory
          • Licence
            • es_extended
            • qb-core
            • qbx_core
          • Property
            • esx_property
            • qb-apartments
            • qbx_apartments
          • Utilities
            • Logger
        • Client
          • Garage
            • esx_garage
            • qb-garages
            • qbx_garages
          • Utilities
            • Camera
      • Dependencies
      • Known Bugs
      • Common Issues and Troubleshooting
    • Dispatch
      • Exports
        • Server
          • Notifications
          • IsDispatcher
          • GetDispatchersByGroup
          • GetGroups
          • GetStateId
        • Client
          • defaultNotification
          • officerNotification
          • dispatchNotification
          • Copy of dispatchNotification
      • Dependencies
Powered by GitBook
On this page

Was this helpful?

  1. Paid Assets
  2. MDT V3
  3. Public
  4. Bridges
  5. Server
  6. Property

qbx_properties & nolag_properties

local function isResourceStarted(resourceName)
  return GetResourceState(resourceName) == 'started'
end

Property = {

  ---@param stateid string
  ---@return table A list of properties with keys: value, label, coords<optional>
  GetPlayerProperties = function(stateid)
    local properties = {}

    -- Check for qbx_properties
    if isResourceStarted('qbx_properties') then
      local result = MySQL.query.await(
        [[
          SELECT
            id as value,
            property_name as label,
            coords
          FROM
            properties
          WHERE
            owner = ?
        ]], { stateid }
      )

      if result and #result > 0 then
        for _, property in ipairs(result) do
          local coords = json.decode(property.coords)
          property.coords = { x = coords.x, y = coords.y }
          table.insert(properties, property)
        end
      else
        prints.error('No properties found in qbx_properties for stateid: %s', stateid)
      end
    end

    -- Check for nolag_properties
    if isResourceStarted('nolag_properties') then
      local result = exports.nolag_properties:GetAllProperties(stateid, 'user', true)

      if result and next(result) ~= nil then
        for _, property in pairs(result) do
          property.value = property.id
          table.insert(properties, property)
        end
      else
        prints.error('No properties found in nolag_properties for stateid: %s', stateid)
      end
    end

    return properties
  end
}

Last updated 5 days ago

Was this helpful?