> For the complete documentation index, see [llms.txt](https://brunx-mods.gitbook.io/brunx-mods-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brunx-mods.gitbook.io/brunx-mods-docs/products/scripts/ice-o-rink-system/configuration/setting-up-controls.md).

# Setting up controls

{% stepper %}
{% step %}

#### Go to config.lua

You can easily configure or add a new control to our script by accessing the following directory: `brnx-iceorinksystem/modules/shared/config.lua`. This file provides all the necessary options for customization, ensuring a seamless integration tailored to your needs.
{% endstep %}

{% step %}

#### Create control

New actions by adding more entries to this list. Here's what each field means:

* **`firstControl`**: The main key that triggers the action. You can find control codes here: [FiveM Control Index](https://docs.fivem.net/docs/game-references/controls/).
* **`secondControl`** *(optional)*: If set, the action only triggers when both `firstControl` **and** `secondControl` are pressed together.
* **`action`**: The ID of the action to execute (e.g., turning, accelerating, etc). Reference: [FiveM Native Actions](https://docs.fivem.net/natives/?_0xC429DCEEB339E129).
* **`maxSpeed`** *(optional)*: Sets the maximum speed (in km/h) that the player can reach when this control is active.
* **`callback`** *(optional)*: A function that executes custom logic when the control is triggered (e.g., animations, boosts, etc).

You can mix and match control keys, actions, speed limits, and custom behavior to create a unique skating experience.

{% code title="brnx-iceorinksystem/modules/config/config.lua" %}

```lua
-- Here is an example of a new control

--[[ W + CTRL FUNCTION (Speed Boost) ]]--
{
    firstControl = 71,  -- W
    secondControl = 36, -- CTRL
    action = 9,         -- Optional: assign any predefined action ID
    maxSpeed = 45,      -- Maximum speed in km/h during this boost
    callback = function()
        local ply <const> = PlayerPedId()

        if not holdingBoost then
            holdingBoost = true

            Citizen.CreateThread(function()
                ClearPedTasks(ply)

                -- Optional animation for the boost (can be changed)
                TaskPlayAnim(ply, "move_m@brave", "run", 5.0, 8.0, 1500, 0, 0, false, false, false)

                -- Apply a velocity boost to the skates entity
                local velocity = GetEntityVelocity(Skates.Entity)
                SetEntityVelocity(Skates.Entity, velocity.x * 1.4, velocity.y * 1.4, velocity.z)

                -- Prevent spam by adding a short cooldown
                Citizen.Wait(1000)
                holdingBoost = false
            end)
        end
    end
},

```

{% endcode %}

{% hint style="warning" %}
After creating your custom control inside `config.controls`, you also need to **add an in-game description** so players know how to use it.

To do this, navigate to:\
**`brnx-iceorinksystem/modules/client/custom/functions/helpText.lua`**

Inside this file, there is a function responsible for displaying help messages on the screen (e.g., "Press W to move forward").

> 🔧 **You must add your new control here**, with a short instruction label, so it properly appears in the game for the player.

This makes your control not only functional, but also easy to understand and user-friendly.
{% endhint %}

<figure><img src="https://1908519456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWxl0ZtJZr7cOHZs1M6sR%2Fuploads%2Fn8O10qlvdSYvvXOLNfVW%2Flegacy-4.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}
