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. Functions
  5. Server

Create Card


The createCard function is used internally to generate information cards for citizen profiles. This system allows you to easily adapt and expand the information shown for each citizen by customizing which cards and data fields are generated.

  • Multiple cards can be created, each with it's own title and custom list of details.

  • Cards are used to organize profile information into clear sections, such as "Personal Information", "Medical Data" or any other categories relevant to your server.

  • You can modify which cards are shown and what data they include by adjusting the logic in your data-gathering functions (for example, adding more createCard calls in the card-generation process).

local cards = {}

---@param title string
---@param data table
local function createCard(title, data) -- Do not change this function
  table.insert(cards, {
    title = title,
    data = data
  })
end

---@param stateid number
local function getPlayerData(stateid)
  local result = MySQL.single.await(
    [[
      SELECT
        JSON_UNQUOTE(JSON_EXTRACT(`charinfo`, '$.birthdate')) AS birthdate,
        JSON_UNQUOTE(JSON_EXTRACT(`charinfo`, '$.height')) AS height,
        JSON_UNQUOTE(JSON_EXTRACT(`charinfo`, '$.nationality')) AS nationality,
        JSON_UNQUOTE(JSON_EXTRACT(`charinfo`, '$.phone')) AS phone,
        JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.bloodtype')) AS bloodtype,
        JSON_UNQUOTE(JSON_EXTRACT(`metadata`, '$.fingerprint')) AS fingerprint
      FROM
        `players`
      WHERE
        `citizenid` = ? 
    ]],
    { stateid }
  )

  if not result then
    prints.error('Failed to get player data for stateid %s', stateid)
    return
  end

  local data = {
    { label = 'Phone Number', value = result.phone or 'N/A' },
    { label = 'Date of Birth', value = result.birthdate or 'N/A' },
    { label = 'Height', value = result.height or 'N/A' },
    { label = 'Nationality', value = result.nationality or 'N/A' },
    { label = 'Blood Type', value = result.bloodtype or 'N/A' },
    { label = 'Fingerprint', value = result.fingerprint or 'N/A' }
  }

  createCard("Personal Information", data)
end

-- Add more createCard calls here to add more cards to citizen profile
---@param stateid number
---@return table
function generateCards(stateid) -- Do not change this function
  cards = {}

  getPlayerData(stateid)

  return cards
end

Last updated 12 days ago

Was this helpful?