> 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/quicks/table-item.md).

# Table item

Players carry a Quicks table as an inventory item and put it up themselves, with a see-through preview. Picked up again with ox\_target or a command.

With the table item, players put up Quicks tables themselves. The item is `quicks_table`. Used from the inventory, a see-through table and its four chairs follow where the player looks; they turn it, put it up where it fits, and from then on it is a table like any other: everyone can play at it, and it stays over restarts. When they are done, they pick it up again and have the item back.

The script registers the item as usable with whichever framework runs (`Config.Item.Framework`, `'auto'` by default: Qbox, then QBCore, then ESX, else ox\_inventory on its own). The item itself has to be in the inventory's item list.

## Adding the item

{% tabs %}
{% tab title="ESX" %}
Run `install/esx_items.sql` on your database. It adds the `quicks_table` row (weight 8).
{% endtab %}

{% tab title="QBCore" %}
Add to `qb-core/shared/items.lua`:

```lua
quicks_table = { name = 'quicks_table', label = 'Quicks Table', weight = 8000, type = 'item',
    image = 'quicks_table.png', unique = true, useable = true, shouldClose = true,
    description = 'Put it up and play' },
```

{% endtab %}

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

```lua
['quicks_table'] = { label = 'Quicks Table', weight = 8000, stack = false, close = true,
    server = { export = 'quicks.useItem' } },
```

On Qbox, ESX or QBCore the `server` line can be left out: the framework hands the use on to the item the script registered. With ox\_inventory on its own it is needed.
{% 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.quicks:placeTable(source, 'quicks_table')
```

Taking the item out of the inventory and giving it back is then left to your own code; see [Exports and events](/organized-chaos-docs/quicks/exports-and-events.md).
{% endtab %}
{% endtabs %}

## Putting a table up

| Key                                           | What it does      |
| --------------------------------------------- | ----------------- |
| Mouse wheel, or the left and right arrow keys | Turn the table    |
| **E**                                         | Put it up         |
| Backspace, Esc or the right mouse button      | Put it away again |

The table follows where the player looks, up to `Config.Item.Place.Distance` (4 m) away. A ring on the ground shows whether it fits: green where it can stand, red where it cannot. It cannot stand

* on ground that is not level enough under the table and the chairs (`Radius`, `Slope`),
* in water, or with a car in the way,
* closer than `Spacing` (3.5 m) to the middle of any other table.

The table starts out facing the way the player does. On **E** the player works on it for a moment (`Animation`, `Time`) while it becomes solid, and then it stands. A fall, a car or death stops it, and the item stays where it was.

The table is kept in `tables.json` like those of `/quicks_place`, together with the item it came from and a token of the player who put it up (a hash of their licence; the licence itself is not sent to anyone). It gets a blip on the map like every other table.

## Picking it up

With ox\_target, aiming at such a table offers **Pick up the table**. Without ox\_target, `/quicks_pickup` takes down the nearest such table in reach. The player works on it for a moment, the table is gone, and the item is back in their inventory.

* With `OwnOnly = true` (the default) only the player who put it up can pick it up.
* Nobody may be sitting at it.
* Not into a full inventory.
* Tables of `Config.Tables` and of `/quicks_place` are no item and cannot be picked up.

`/quicks_remove` takes these tables away too, for admins; the item is then not given back.

## One table, or a licence

`MaxPerPlayer` (1 by default) is how many tables a player may have up at once; `0` is any number. With `Remove = false` the item stays in the inventory when the table is put up, as a licence to put up tables, and picking one up only takes it down.

## Settings

All in `Config.Item`, see [Configuration](/organized-chaos-docs/quicks/configuration.md#table-item). The texts are in `locales.lua`: `help_place`, `target_pick_up`, `table_picked_up` and the `item_...` messages.
