> For the complete documentation index, see [llms.txt](https://piotreq-scripts.gitbook.io/piotreq-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://piotreq-scripts.gitbook.io/piotreq-scripts/assets-and-guides/tuning-menu/exports-and-events.md).

# Exports and Events

## OpenTuningMenu

With following export you are able to open tuning menu.

{% tabs %}
{% tab title="Client Side" %}

* isStation `boolean`

```lua
exports['p_tuningmenu']:OpenTuningMenu(isStation)
```

{% endtab %}
{% endtabs %}

### Example of Usage

```lua
local isStation = false
exports['p_tuningmenu']:OpenTuningMenu(isStation)
-- THIS CODE WILL OPEN MENU WITH BUY OPTION

local isStation = true
exports['p_tuningmenu']:OpenTuningMenu(isStation)
-- THIS CODE WILL OPEN MENU WITHOUT BUY OPTION

local isStation = ESX.PlayerData.job.name == 'mechanic' and false or true
exports['p_tuningmenu']:OpenTuningMenu(isStation)
-- THIS CODE WILL OPEN MENU WITH BUY OPTION FOR PLAYER WITH JOB MECHANIC
```

***

## ForceCloseMenu

With this export you can force close menu for player.

{% tabs %}
{% tab title="Client Side" %}

```lua
exports['p_tuningmenu']:ForceCloseMenu()
-- THIS WILL INSTANT CLOSE MENU WITHOUT SAVING ANYTHING
```

{% endtab %}
{% endtabs %}

***

## MenuState

With this event handler you can follow menu state.

{% tabs %}
{% tab title="Client Side" %}

```lua
RegisterNetEvent('p_tuningmenu:MenuState', function(state)
    -- TOGGLE HUD EXPORT
end)
```

{% endtab %}
{% endtabs %}

### Example of Usage

```lua
RegisterNetEvent('p_tuningmenu:MenuState', function(state)
    exports['hud']:ToggleHud(state) -- state is boolean [true / false]
end)
```
