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

# Items

Each board as an inventory item for ESX, QBCore, Qbox or ox\_inventory: thrown down ahead of the player, picked up again with ox\_target. The custom boards' item, and the item pictures.

With ESX, QBCore or Qbox each board can be an item. Used from the inventory, the player takes the board out, swings it back and tosses it ahead of them, where it lands rolling, ready to be stepped on.

Every ready-made board has an item of the same name as its spawn name: `skateboard`, `skateboard_carbon` ... `skateboard_magma`. All custom boards share one more, `skateboard_custom`. The script registers them as usable with whichever framework runs (`Config.Item.Framework`, `'auto'` by default). The items themselves have to be in the framework's item list.

## Adding the items

{% tabs %}
{% tab title="ESX" %}
Run `install/esx_items.sql` on your database. It adds an `items` row for each board and the custom board (weight 3). Then `refreshitems` in the server console, or a restart.
{% endtab %}

{% tab title="QBCore / Qbox" %}
Add one line per board to `qb-core/shared/items.lua` (Qbox: `ox_inventory/data/items.lua`, see the next tab), for example:

```lua
skateboard = { name = 'skateboard', label = 'Skateboard', weight = 3000, type = 'item', image = 'skateboard.png',
               unique = true, useable = true, shouldClose = true, description = 'Throw it down and ride' },
skateboard_carbon = { name = 'skateboard_carbon', label = 'Carbon Pro Skateboard', weight = 3000, type = 'item',
               image = 'skateboard_carbon.png', unique = true, useable = true, shouldClose = true,
               description = 'Throw it down and ride' },
skateboard_custom = { name = 'skateboard_custom', label = 'Custom Skateboard', weight = 3000, type = 'item',
               image = 'skateboard_custom.png', unique = true, useable = true, shouldClose = true,
               description = 'Your own board' },
```

{% endtab %}

{% tab title="ox\_inventory" %}
Add one line per board to `ox_inventory/data/items.lua`:

```lua
['skateboard'] = { label = 'Skateboard', weight = 3000, stack = false, close = true },
['skateboard_carbon'] = { label = 'Carbon Pro Skateboard', weight = 3000, stack = false, close = true },
['skateboard_custom'] = { label = 'Custom Skateboard', weight = 3000, stack = false, close = true,
    server = { export = 'skateboard.useCustomItem' } },
```

ox\_inventory hands the use on to usable items registered with the framework. If it does not on your server, give each ready-made board's item `server = { export = 'skateboard.useItem' }`.
{% endtab %}

{% tab title="Another inventory" %}
Set `Config.Item.Framework = false` and have your inventory call this on the server when the item is used:

```lua
exports.skateboard:throwBoard(source, 'skateboard_carbon')
```

{% endtab %}
{% endtabs %}

`Config.Item.Items` names the board each item takes out. Leave out the boards you do not want as items.

## Item pictures

`install/images` has a picture for every item: `skateboard.png` ... `skateboard_magma.png` and `skateboard_custom.png`, 256 x 256 with a transparent background. Copy them into your inventory's image folder, for example `ox_inventory/web/images` or `qb-inventory/html/images`.

## The custom board item

With ox\_inventory, QBCore and Qbox every `skateboard_custom` item is one board: its data says which, and shows its name. Using it takes that board out.

ESX's own inventory keeps no data on an item, so there the item stands for "one of my boards": using it lists the player's boards, each with its picture, to choose from.

A custom board can only be taken out by its owner, and is never out twice. Taking it out, picking it up and putting it away work as for the other boards. With `Config.Custom.Item = false` custom boards are no items at all: `/myboards` (`Config.Custom.Menu`) lists a player's boards to take out.

A board that was out in the world when the server restarted is given back as an item the next time its owner is there.

## The board in the world is the item

With `Config.Item.Remove = true` (the default), taking the board out takes the item out of the inventory: the board lying in the world is the item now, and **picking it up** puts it back.

With ox\_target every board that came out of an inventory has a **Pick up Skateboard** option (`Config.Item.PickUp`): the player bends down for it, and it goes into their inventory, unless the inventory is full. `OwnOnly = true` lets only the player who took it out pick it up. Boards from `/skateboard`, `/car` or a garage are nobody's item and cannot be picked up.

`Target = false` leaves the option to a target script of your own, which calls `exports.skateboard:pickUp(board)`, and `exports.skateboard:canPickUp(board)` to decide whether to show it. See Exports.

## Keeping the item instead

With `Remove = false` the item stays in the inventory, a player can take out as many boards as they like, and picking one up only puts it away. Then:

| Setting         | What it does                                                                          |
| --------------- | ------------------------------------------------------------------------------------- |
| `OnePerPlayer`  | Taking out another board puts away the player's last one, unless someone stands on it |
| `RemoveOnLeave` | A player's board goes when they leave the server, unless someone stands on it         |

## The throw

`Config.Item.Throw` sets how fast and how high the board leaves the hand. `Enabled = false` puts the board down in front of the player at once instead.
