# okokCrafting

[**YouTube Video**](https://www.youtube.com/watch?v=dFqGhPZaLKg)

## Installation Guide

#### Execute the following SQL code in your database:

In case you had the previous okokCrafting version (both ESX & QBCore) execute the code below, otherwise ignore it.

```sql
ALTER TABLE users DROP COLUMN xp;
```

**ESX**

```sql
ALTER TABLE users ADD COLUMN xp LONGTEXT NULL;
ALTER TABLE users ADD COLUMN okokcrafts LONGTEXT NULL;
```

**QBCore**

```sql
ALTER TABLE players ADD COLUMN xp LONGTEXT NULL;
ALTER TABLE players ADD COLUMN okokcrafts LONGTEXT NULL;
```

### Important

The `tableID` field on the config file is used to create the crafting buttons, so make sure you **ALWAYS set a different ID for each table**.

### Adding images to the items

To add images to the items simply drop them in **okokCrafting/web/icons**.

* The images should be in the **PNG** format;
* The image name should be the same as the item ID, if the item ID is "**bread**", then the image should be "**bread.png**".

### SetLevel Export

```lua
exports['okokCrafting']:SetLevel(target, level, workbenchID)
```

If you have `Config.SameLevelForAllTables` set to true then you don't need to set the workbenchID.

### Server artifacts

Make sure your server artifacts version is above the **5181**.

* Windows: <https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/>
* Linux: <https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/>


---

# 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://docs.okokscripts.io/scripts/okokcrafting.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.
