The ak47_lib automatically detects the running framework. You can access these functions by importing the lib export in your script.
local Lib47 = exports['ak47_lib']:GetLibObject()Lib47.FrameworkA built-in variable that stores the active framework detected by the library. This is highly useful for writing dynamic, multi-framework scripts that need to execute different logic depending on the server's core environment.
Expected Values: 'esx', 'qb', or 'qbx'.
--- @type string The name of the currently active framework
local currentFramework = Lib47.Framework
-- Example usage for framework-specific logic
if Lib47.Framework == 'qb' then
print("Detected Framework: QBCore")
-- Execute QBCore specific code here
elseif Lib47.Framework == 'esx' then
print("Detected Framework: ESX")
-- Execute ESX specific code here
elseif Lib47.Framework == 'qbx' then
print("Detected Framework: Qbox")
-- Execute Qbox specific code here
else
print("No supported framework detected (Standalone)")
endLib47.GetCoreConfigRetrieves the main configuration table of the active framework (e.g., QBCore.Config or ESX.GetConfig()). This is highly useful for fetching default framework settings without needing to directly reference the core objects, keeping your script standalone-friendly.
Note: When using ESX, you can optionally pass a specific string key to return a single value instead of the entire table. In QBCore/Qbox, the key parameter is ignored and the full configuration table is always returned.
--- @param key string|nil (Optional) Specific config key to fetch (Utilized by ESX)
--- @return table|any The core configuration table, or a specific value (if key is provided in ESX). Returns an empty table {} on failure.
-- Example 1: Fetching the entire config table (Works on all frameworks)
local coreConfig = Lib47.GetCoreConfig()
if coreConfig then
print("Core configuration loaded successfully.")
-- You can now access framework settings: e.g., coreConfig.DefaultSpawn
end
-- Example 2: Fetching a specific key (Useful for ESX servers)
if Lib47.Framework == 'esx' then
local startingAccountMoney = Lib47.GetCoreConfig('StartingAccountMoney')
print("Default starting money configured in ESX: " .. json.encode(startingAccountMoney))
endThese functions allow you to access player data directly on the client side, updated automatically when framework events fire.
Lib47.GetJobReturns the local player's job data standardized.
--- @return table { name, label, payment, isboss, grade = { name, level } }
local job = Lib47.GetJob()
if job.name == 'police' then
print("You are a cop!")
endLib47.GetPlayerDataReturns the raw framework-specific player data table (QBCore.PlayerData or ESX PlayerData).
--- @return table
local data = Lib47.GetPlayerData()Lib47.GetTargetMetaValueA utility function to fetch metadata from another player (server-side) via a callback. Useful for checking status like isdead or inlaststand on a target player.
--- @param targetServerId number
--- @param metaKey string
--- @return any
local isDead = Lib47.GetTargetMetaValue(targetPlayerId, 'isdead')Lib47.GetCoreConfigRetrieves the active framework's core configuration table.
--- @return table The core config table
local config = Lib47.GetCoreConfig()Lib47.GetIdentifierReturns the unique identifier (CitizenID/Identifier) for the local player directly from the client.
--- @return string The unique identifier
local identifier = Lib47.GetIdentifier()Lib47.GetCharacterNameReturns the full character name of the local player.
--- @return string The full name (Firstname Lastname)
local name = Lib47.GetCharacterName()Lib47.AddStress / Lib47.RemoveStressModifies the local player's stress levels across frameworks.
--- @param amount number
Lib47.AddStress(10)
Lib47.RemoveStress(10)Here is the missing client-side documentation formatted in Markdown, ready to be added to your official API reference.