Create Card
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
endLast updated