> For the complete documentation index, see [llms.txt](https://documentation.rcore.cz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.rcore.cz/paid-resources/rcore_drugs/api/client.md).

# Client

Use these exports only if you want to integrate another resource with `rcore_drugs` client features.

## 🎮 Minigame Exports

<details>

<summary>StartMinigame</summary>

Starts a minigame and waits for the result.

```lua
---@param name string
---@return boolean success
local success = exports.rcore_drugs:StartMinigame(name)
```

Example:

```lua
local success = exports.rcore_drugs:StartMinigame('meth_reaction_tank')

if success then
    print('Minigame completed')
end
```

</details>

<details>

<summary>StartMinigameAsync</summary>

Starts a minigame and returns the result in a callback.

```lua
---@param name string
---@param callback fun(success: boolean)
exports.rcore_drugs:StartMinigameAsync(name, callback)
```

Example:

```lua
exports.rcore_drugs:StartMinigameAsync('weed_packaging', function(success)
    if success then
        print('Packaging completed')
    end
end)
```

</details>

<details>

<summary>IsMinigameActive</summary>

Checks if a minigame is currently active.

```lua
---@param name string
---@return boolean
local active = exports.rcore_drugs:IsMinigameActive(name)
```

</details>

<details>

<summary>CancelMinigame</summary>

Cancels an active minigame by name.

```lua
---@param name string
exports.rcore_drugs:CancelMinigame(name)
```

</details>

## 📡 Net Events

<details>

<summary>onDealSuccess</summary>

Triggered on the client when the player successfully completes a drug deal.

```lua
RegisterNetEvent('rcore_drugs:api:client:onDealSuccess', function(selectedDrugs, totalPrice)
    print('Deal completed for $' .. totalPrice)
end)
```

Parameters:

| Name            | Type     | Description                                                  |
| --------------- | -------- | ------------------------------------------------------------ |
| `selectedDrugs` | `table`  | Array of sold drugs, each entry contains `name` and `amount` |
| `totalPrice`    | `number` | Total price of the deal                                      |

`selectedDrugs` example:

```json
[{"amount": 1, "name": "joint"}]
```

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://documentation.rcore.cz/paid-resources/rcore_drugs/api/client.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.
