> For the complete documentation index, see [llms.txt](https://beetle-studios.gitbook.io/beetle-studios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://beetle-studios.gitbook.io/beetle-studios-docs/beetle-studios/chow-drop/exports.md).

# Exports

Chow Drop exposes a small public API for other resources. Resource name: `bs_chowdrop`.

Always wait until the resource is started before calling exports.

while GetResourceState('bs\_chowdrop') \~= 'started' doWait(100)end

***

#### Server exports

**`GetDriverData(citizenid)`**

Returns the driver’s database row, or `nil` if none exists.

local driver = exports\['bs\_chowdrop']:GetDriverData(citizenid)if driver thenprint(driver.name, driver.level, driver.rating, driver.total\_deliveries)end

| Field              | Type          | Notes                               |
| ------------------ | ------------- | ----------------------------------- |
| `id`               | number        | Internal driver id                  |
| `citizenid`        | string        | QBX/QB citizenid, or ESX identifier |
| `name`             | string        | Character name                      |
| `xp`               | number        |                                     |
| `level`            | number        |                                     |
| `rating`           | number        |                                     |
| `total_deliveries` | number        |                                     |
| `total_earnings`   | number        |                                     |
| `pending_earnings` | number        |                                     |
| `is_fired`         | 0/1           | Deactivated for low rating          |
| `last_delivery`    | timestamp/nil |                                     |
| `cooldown_until`   | timestamp/nil | After cancel                        |

***

**`GetOnlineDrivers()`**

Returns a table of drivers currently online in the app (keyed by server id).

local online = exports\['bs\_chowdrop']:GetOnlineDrivers()for src, data in pairs(online) doprint(src, data.citizenid, data.name, data.level)end

Each entry:

| Field       | Type   |
| ----------- | ------ |
| `citizenid` | string |
| `driverId`  | number |
| `name`      | string |
| `level`     | number |

Empty / missing key = that player is not online for deliveries.

***

**`GetLeaderboard()`**

Returns the cached leaderboard array (same data used by the app).

local board = exports\['bs\_chowdrop']:GetLeaderboard()for \_, entry in ipairs(board) doprint(entry.rank, entry.name, entry.deliveries, entry.earnings, entry.rating, entry.level)end

| Field        | Type   |
| ------------ | ------ |
| `rank`       | number |
| `name`       | string |
| `deliveries` | number |
| `earnings`   | number |
| `rating`     | number |
| `level`      | number |

Refresh interval is controlled by `Config.Leaderboard.RefreshInterval`.

***

**`ResetDriver(citizenid)`**

Resets a fired (or existing) driver account: clears fired flag, rating back to 5.0, XP/level to defaults, deletes rating history.

local ok = exports\['bs\_chowdrop']:ResetDriver(citizenid)-- true if a driver row existed and was reset; false if no account

Same behavior as the admin reset command.

***

#### Client exports

Call these from client scripts only (local player).

**`IsDriverOnline()`**

local online = exports\['bs\_chowdrop']:IsDriverOnline()-- true if this client toggled "Go Online" in the app

***

**`IsOnDelivery()`**

if exports\['bs\_chowdrop']:IsOnDelivery() then-- player has at least one active deliveryend

Preferred way to check if the local player is mid-delivery (supports multiple concurrent orders).

***

**`GetDeliveryTimeRemaining(orderId?)`**

Seconds remaining on the delivery timer. Pass an order id, or omit to use the first active order. Returns `0` if none.

local seconds = exports\['bs\_chowdrop']:GetDeliveryTimeRemaining()local secondsFor = exports\['bs\_chowdrop']:GetDeliveryTimeRemaining(orderId)

***

**`GetActiveOrder()`**

Intended to return the local player’s active order object (or `nil`).

local order = exports\['bs\_chowdrop']:GetActiveOrder()

For “am I delivering?” logic, use `IsOnDelivery()` instead — the resource tracks multiple orders internally.

***

#### Example integrations

Block another job while delivering

\-- clientif exports\['bs\_chowdrop']:IsOnDelivery() thenlib.notify({ description = 'Finish your Chow Drop delivery first.', type = 'error' })returnend

Server: require min driver level

\-- serverlocal citizenid = -- your framework id for sourcelocal driver = exports\['bs\_chowdrop']:GetDriverData(citizenid)if not driver or driver.level < 3 or driver.is\_fired == 1 thenreturnend

Server: count online drivers

local n = 0for \_ in pairs(exports\['bs\_chowdrop']:GetOnlineDrivers()) don = n + 1end

***

#### Notes

* Identifier: Always pass the same id Chow Drop stores (`citizenid` / ESX `identifier`). Wrong id → `GetDriverData` / `ResetDriver` return nil/false.
* No other public exports — order create, staff, payment, and admin flows are internal (`lib.callback` / NUI), not third-party exports.
* Do not rely on undocumented net events as a stable API; they can change with updates.
* Ensure `bs_chowdrop` is in your resource dependencies (or start order) if another script calls these at boot.
