> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlasscripts.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Player Data

> Read and mutate framework + inventory data through one normalized API — job, money, items, usables, and lifecycle hooks — the same on ESX, QBX, QB-Core, or standalone.

The `Bridge` global gives you one provider-agnostic surface for player data. Write against `Bridge.GetJob(src)` and `Bridge.Inventory.AddItem(src, ...)`, and the bridge routes to whatever framework and inventory the server runs. Account names and the job shape are **normalized**, so your code never branches on `ESX` vs `QBCore`.

<Note>
  Everything here is for resources building on the bridge. If you are configuring which framework/inventory the bridge uses, see [Providers](/atlas-bridge/providers).
</Note>

## Framework

The most-used calls hang off `Bridge` directly as shortcuts; the full surface is `Bridge.Framework`.

### Server

```lua theme={null}
local job = Bridge.GetJob(src)   -- { name, label, grade, gradeLabel, isBoss, onDuty }

Bridge.AddMoney(src, 'bank', 500, 'paycheck')   -- accounts: 'cash' | 'bank' | 'dirty'
Bridge.RemoveMoney(src, 'cash', 100, 'shop')
local cash = Bridge.GetMoney(src, 'cash')

Bridge.SetJob(src, 'police', 2)
Bridge.SetDuty(src, true)
if Bridge.IsAdmin(src) then end

local id   = Bridge.GetIdentifier(src)   -- license / primary identifier
local name = Bridge.GetName(src)         -- "First Last"
```

| Method                                              | Returns / effect                            |
| --------------------------------------------------- | ------------------------------------------- |
| `Bridge.GetJob(src)`                                | Normalized job table (below).               |
| `Bridge.SetJob(src, name, grade?)`                  | Change a player's job.                      |
| `Bridge.SetDuty(src, bool)`                         | Toggle duty.                                |
| `Bridge.GetMoney(src, account)`                     | Balance of `cash` / `bank` / `dirty`.       |
| `Bridge.AddMoney(src, account, amount, reason?)`    | Credit an account.                          |
| `Bridge.RemoveMoney(src, account, amount, reason?)` | Debit an account; returns `false` if short. |
| `Bridge.GetIdentifier(src)`                         | Primary identifier.                         |
| `Bridge.GetName(src)`                               | Display name.                               |
| `Bridge.GetPlayers()`                               | All loaded players.                         |
| `Bridge.IsAdmin(src)`                               | Framework admin check (see warning below).  |

The full `Bridge.Framework` surface also includes `GetSociety(job)`, `AddSociety(job, amount)`, `RemoveSociety(job, amount)`, and `GetPlayersByJob(job)`.

### Normalized job shape

```lua theme={null}
{
    name       = 'police',     -- internal job name
    label      = 'Police',     -- display label
    grade      = 2,            -- grade level (number)
    gradeLabel = 'Sergeant',   -- grade display label
    isBoss     = false,        -- boss/management grade
    onDuty     = true,         -- duty state
}
```

### Normalized accounts

Money accounts are always one of three normalized names, regardless of framework:

| Account | Notes                                                             |
| ------- | ----------------------------------------------------------------- |
| `cash`  | On-hand money.                                                    |
| `bank`  | Bank balance.                                                     |
| `dirty` | "Black"/dirty money — only on ESX (`black_money`) and standalone. |

<Note>
  Society balances require the framework's banking resource (`esx_addonaccount`, `qb-banking`, or `Renewed-Banking`). Without one, `GetSociety` / `AddSociety` / `RemoveSociety` are no-ops.
</Note>

### Client

```lua theme={null}
local data   = Bridge.GetPlayerData()  -- { identifier, name = { first, last }, job, money = { cash, bank, dirty } }
local job    = Bridge.GetJob()         -- normalized job table
local onDuty = Bridge.IsOnDuty()
```

<Warning>
  `Bridge.IsAdmin(src)` is a **framework** admin check (e.g. ESX/QB group), and is separate from the Discord-role permission system. For permission nodes backed by ACEs and Discord roles, use `Bridge.Permissions.Has(src, node)` — see [Permissions](/atlas-bridge/developer/permissions).
</Warning>

## Lifecycle hooks

React to player load, job change, and unload without touching framework-specific events.

<Tabs>
  <Tab title="Server">
    ```lua theme={null}
    Bridge.Framework.OnPlayerLoaded(function(src)
        -- player fully loaded
    end)

    Bridge.Framework.OnJobChange(function(src, job)
        -- job is the new normalized job table
    end)

    Bridge.Framework.OnPlayerUnload(function(src)
        -- player dropped — flush per-player state here
    end)
    ```
  </Tab>

  <Tab title="Client">
    ```lua theme={null}
    Bridge.Framework.OnPlayerLoaded(function()
        -- local player loaded (no src on the client)
    end)

    Bridge.Framework.OnJobChange(function(job)
        -- local player's new job table
    end)
    ```
  </Tab>
</Tabs>

## Inventory

Item operations are normalized across `ox_inventory`, `qb-inventory`, `qs-inventory`, ESX legacy, and the bridge's virtual inventory.

### Server

```lua theme={null}
Bridge.Inventory.AddItem(src, 'water', 1)
Bridge.Inventory.RemoveItem(src, 'water', 1)

if Bridge.Inventory.HasItem(src, 'lockpick', 1) then end
local n   = Bridge.Inventory.GetItemCount(src, 'water')
local can = Bridge.Inventory.CanCarry(src, 'water', 10)
local all = Bridge.Inventory.GetItems(src)
```

| Method                             | Returns / effect                                       |
| ---------------------------------- | ------------------------------------------------------ |
| `AddItem(src, item, count, meta?)` | Give an item.                                          |
| `RemoveItem(src, item, count)`     | Take an item.                                          |
| `HasItem(src, item, count?)`       | Whether the player holds at least `count` (default 1). |
| `GetItemCount(src, item)`          | Quantity held.                                         |
| `CanCarry(src, item, count)`       | Whether the player has room/weight.                    |
| `GetItems(src)`                    | The player's full item list.                           |

### Client

```lua theme={null}
local items = Bridge.Inventory.GetItems()
local has   = Bridge.Inventory.HasItem('phone', 1)
```

### Usable items

Register a use handler from the **server**. The bridge wires it to whatever inventory's "use" path and calls your function with the player `src`.

```lua theme={null}
-- server
Bridge.Inventory.RegisterUsableItem('water', function(src)
    -- consume + apply effect
    Bridge.Inventory.RemoveItem(src, 'water', 1)
end)
```

<Warning>
  Treat every inventory action as server-authoritative. Never decide an item exists or a balance is sufficient on the client — call these server-side, and validate any client request through [`Bridge.Net`](/atlas-bridge/developer/networking) first.
</Warning>

## Running an unsupported stack?

If the bridge does not ship support for your framework or inventory, fill the editable adapter and point a convar at `custom`. The adapter contract is the exact method set documented here.

<CardGroup cols={2}>
  <Card title="Custom Framework" icon="https://mintcdn.com/atlasscripts/BwePy2Q7bMLnl0yQ/icons/plug-filled.svg?fit=max&auto=format&n=BwePy2Q7bMLnl0yQ&q=85&s=523bca8bdf53a69adf80f6699df734b4" href="/atlas-bridge/custom-framework" width="24" height="24" data-path="icons/plug-filled.svg">
    The framework adapter contract and a worked example.
  </Card>

  <Card title="Custom Inventory" icon="https://mintcdn.com/atlasscripts/BwePy2Q7bMLnl0yQ/icons/box-filled.svg?fit=max&auto=format&n=BwePy2Q7bMLnl0yQ&q=85&s=c228a3b89453b292c0cedb29c252b3ab" href="/atlas-bridge/custom-inventory" width="24" height="24" data-path="icons/box-filled.svg">
    The inventory adapter contract and item shapes.
  </Card>
</CardGroup>
