> For the complete documentation index, see [llms.txt](https://docs.menanak47.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.menanak47.com/plugins/ak47_lib/framework/client.md).

# Client

The `ak47_lib` automatically detects the running framework. You can access these functions by importing the lib export in your script.

```lua
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'`.

```lua
--- @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.*

```lua
--- @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.

```lua
--- @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).

```lua
--- @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.

```lua
--- @param targetServerId number
--- @param metaKey string
--- @return any
local isDead = Lib47.GetTargetMetaValue(targetPlayerId, 'isdead')
```

#### **`Lib47.GetCoreConfig`**

Retrieves the active framework's core configuration table.

```lua
--- @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.

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

#### **`Lib47.GetCharacterName`**

Returns the full character name of the local player.

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

#### **`Lib47.AddStress` / `Lib47.RemoveStress`**

Modifies the local player's stress levels across frameworks.

```lua
--- @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.
