# Framework Setup

#### ESX

No additional setup required. The script uses:

* `ESX.GetPlayerFromId` / `ESX.GetPlayerFromIdentifier`
* `ESX.RegisterServerCallback` / `ESX.TriggerServerCallback`
* `xPlayer.getMoney()` / `xPlayer.removeMoney()` / `xPlayer.addMoney()` / `xPlayer.addAccountMoney()`
* `xPlayer.identifier` for player identity

#### QBCore

No additional setup required. The script uses:

* `QBCore.Functions.GetPlayer` / `QBCore.Functions.GetPlayerByCitizenId`
* `QBCore.Functions.CreateCallback` / `QBCore.Functions.TriggerCallback`
* `Player.Functions.GetMoney('cash')` / `Player.Functions.RemoveMoney('cash')` / `Player.Functions.AddMoney('bank')`
* `Player.PlayerData.citizenid` for player identity

#### QBox

No additional setup required. The script uses:

* `exports.qbx_core:GetPlayer`
* `exports.qbx_core:RegisterCallback`
* `exports.qbx_core:GetMoney` / `exports.qbx_core:RemoveMoney` / `exports.qbx_core:AddMoney`
* `Player.PlayerData.citizenid` for player identity

#### Custom Framework

Set `Framework = 'custom'` and fill in both bridge files:

**`bridge/custom_server.lua`** — implement these functions:

| Function                                    | Description                                                                             |
| ------------------------------------------- | --------------------------------------------------------------------------------------- |
| `CustomRegisterCallback(name, handler)`     | Register a server callback clients can trigger                                          |
| `CustomGetPlayerFromId(source)`             | Return a player object for the given server ID                                          |
| `CustomGetPlayerFromIdentifier(identifier)` | Return a player object for the given identifier string, or `nil` if offline             |
| `CustomGetIdentifier(source)`               | Return the unique identifier string for the player                                      |
| `CustomGetName(source)`                     | Return the display name of the player                                                   |
| `CustomGetSourceFromPlayer(player)`         | Return the server source ID from a player object                                        |
| `CustomGetMoney(source)`                    | Return the player's current cash balance                                                |
| `CustomRemoveMoney(source, amount)`         | Deduct cash from the player                                                             |
| `CustomAddMoneyBank(source, amount)`        | Add money to the player's bank account                                                  |
| `CustomAddMoneyCash(source, amount)`        | Add money to the player's cash                                                          |
| `CustomOnPlayerLoaded(cb)`                  | Register a handler that fires when a player fully loads — call `cb(source, identifier)` |

**`bridge/custom_client.lua`** — implement these functions:

| Function                               | Description                                                             |
| -------------------------------------- | ----------------------------------------------------------------------- |
| `CustomTriggerCallback(name, cb, ...)` | Trigger a server callback and await the response                        |
| `CustomOnPlayerLoaded(cb)`             | Register a handler for the player loaded event — call `cb()` when ready |

**`fxmanifest.lua`** — ensure bridge files are loaded first:

```lua
server_scripts {
    'bridge/custom_server.lua',
    'server.lua',
    -- ...
}

client_scripts {
    'bridge/custom_client.lua',
    'client.lua',
    -- ...
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://s0u-scripts.gitbook.io/s0u-scripts-docs/lottery-script/framework-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
