Menan AK47
MENAN AK47DOCS
DiscordStore
Navigation
Menu
Welcome
FAQ
ak47_lib
Framework
Client
Server
Integration
Interface
Events
Imports
ak47_target
ak47_ambulancejob
ak47_banking
ak47_business
ak47_carboosting
ak47_cardealer
ak47_clothingshop
ak47_crafting
ak47_crime
ak47_crutch
ak47_deliveryjob
ak47_drugdealerv2
ak47_drugmanagerv3
ak47_drugmissions
ak47_ecommerce
ak47_farming
ak47_fishing
ak47_fraudsystem
ak47_fuelstations
ak47_gangs
ak47_garage
ak47_garbagejob
ak47_hookahloungev2
ak47_housing
ak47_hud
ak47_iclothingv3
ak47_idcardv2
ak47_inventory
ak47_jobgarage
ak47_khusbites
ak47_khusland
ak47_leafnlatte
ak47_mafiasupply
ak47_mechanic
ak47_moneywash
ak47_multicharacter
ak47_npcmed
ak47_outfitbag
ak47_playershop
ak47_policejob
ak47_prospecting
ak47_radio
ak47_rentalcar
ak47_safezone
ak47_sitchair
ak47_smokingv2
ak47_supermarket
ak47_switch
ak47_territories
ak47_vehiclekeys
ak47_vipshop
Loaf
DocsPluginsClient

Client

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.Framework

A 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)")
end

Lib47.GetCoreConfig

Retrieves 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))
end

Client Player Data

These functions allow you to access player data directly on the client side, updated automatically when framework events fire.

Lib47.GetJob

Returns 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!")
end

Lib47.GetPlayerData

Returns the raw framework-specific player data table (QBCore.PlayerData or ESX PlayerData).

--- @return table
local data = Lib47.GetPlayerData()

Lib47.GetTargetMetaValue

A 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.GetCoreConfig

Retrieves the active framework's core configuration table.

--- @return table The core config table
local config = Lib47.GetCoreConfig()

Lib47.GetIdentifier

Returns the unique identifier (CitizenID/Identifier) for the local player directly from the client.

--- @return string The unique identifier
local identifier = Lib47.GetIdentifier()

Lib47.GetCharacterName

Returns the full character name of the local player.

--- @return string The full name (Firstname Lastname)
local name = Lib47.GetCharacterName()

Lib47.AddStress / Lib47.RemoveStress

Modifies 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.

Previous
Framework
Next
Server
On this page
Client Player Data