> For the complete documentation index, see [llms.txt](https://k0ssek-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k0ssek-scripts.gitbook.io/docs/scripts/dart-game/installation.md).

# Installation

Requirements, convars, start order and admin access.

## Requirements

| Resource                                                                                                              | Required | Notes                                                                       |
| --------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------- |
| [ox\_lib](https://github.com/overextended/ox_lib)                                                                     | Yes      | UI, callbacks, zones, locales                                               |
| [oxmysql](https://github.com/overextended/oxmysql)                                                                    | Yes      | Database                                                                    |
| ESX, QBCore or QBX                                                                                                    | Optional | Detected automatically on start. Without one the script runs standalone.    |
| [ox\_target](https://github.com/overextended/ox_target) or [qb-target](https://github.com/qbcore-framework/qb-target) | Optional | Without one, use the `helptext` target option: a text prompt and the E key. |

## Install

{% stepper %}
{% step %}

### Download the resource

After purchase, the script is available in your [Cfx.re Portal](https://portal.cfx.re/assets/granted-assets). See [Download & Updates](/docs/getting-started/download-and-updates.md) for details.
{% endstep %}

{% step %}

### Add it to your server

Put the `kossek_darts` folder into your `resources` directory.
{% endstep %}

{% step %}

### Set the convars

Add these lines to `server.cfg` **above** the `ensure kossek_darts` line. Both are optional: without them the script uses English and ox\_target.

```cfg
setr kossek_darts:locale "en"
setr kossek_darts:target "ox_target"
```

| Convar                | Default     | Values                                                                                        |
| --------------------- | ----------- | --------------------------------------------------------------------------------------------- |
| `kossek_darts:locale` | `en`        | `en`, `pl`, `de`, `cs`, `es`, `fr`, `it`, `sv`, or the name of a file you added to `locales/` |
| `kossek_darts:target` | `ox_target` | `ox_target`, `qb_target`, `helptext`                                                          |

{% hint style="warning" %}
Use `setr`, not `set`. Both values are also read on the client, and a convar created with `set` never reaches it.
{% endhint %}

There is no framework convar. The framework is detected from the resources that are running.
{% endstep %}

{% step %}

### Start it in the right place

Start `kossek_darts` **after** ox\_lib, oxmysql, your framework and your target resource.

```cfg
ensure oxmysql
ensure ox_lib
ensure es_extended        # or qb-core / qbx_core
ensure ox_target          # or qb-target, if you use one

setr kossek_darts:locale "en"
setr kossek_darts:target "ox_target"
ensure kossek_darts
```

{% endstep %}

{% step %}

### Give your admins access

The board commands (`/darts_create`, `/darts_delete`, `/darts_list`) are for admins only.

**ESX**: a player is an admin when their group is listed in `config/server.lua`:

```lua
ConfigServer.AdminGroups = { 'admin', 'superadmin' }
```

**QBCore, QBX and standalone**: a player is an admin when they have the ace from `ConfigServer.AdminAce`. Grant it in `server.cfg`:

```cfg
add_ace group.admin command.darts_admin allow
```

{% endstep %}

{% step %}

### Check the console

On start the server console prints `DB migrations complete` and `Loaded 0 boards` (the number of boards you have placed).
{% endstep %}

{% step %}

### Set up your boards

Dartboard props that already exist in the world are picked up automatically. To add boards anywhere else, see [Board Placement](/docs/scripts/dart-game/board-placement.md).
{% endstep %}
{% endstepper %}

## Database

Nothing to import. The script creates its tables on the first start:

| Table          | Holds                                                       |
| -------------- | ----------------------------------------------------------- |
| `darts_stats`  | One row per player: level, XP, games played, games won, Elo |
| `darts_boards` | Boards placed with `/darts_create`                          |

The table names can be changed in `config/server.lua` (`ConfigServer.DB`).

## Updating

Replace the resource folder, then put back the folders you edited: `config/`, `bridge/` and `locales/`. Compare your config with the new one and add any new options. Player stats and placed boards live in the database, so they are kept.
