# Extra Controls

## Introduction

The "extra\_controls" plugin handles specific extra toggling on demand using key bindings. The allows players the ability to toggle spotlights, light cuts, scene lights conveniently without navigating through existing menus. Controls can be set by default or left disabled, if `allow_custom_controls` is set to true, players can change each control combo and key in game through an LVC menu.

<figure><img src="https://camo.githubusercontent.com/7fcb8ee3d541d0287bd197a9724976b482db5083de3260cddecd07ec07e8f71b/68747470733a2f2f692e6779617a6f2e636f6d2f32613235336232383539376631373033336364653633656338643937336165332e6a7067" alt=""><figcaption></figcaption></figure>

## Configuration

1. Ensure that `plugins_installed` is set to true in `lvc/SETTINGS.lua`.
2. Open the SETTINGS.lua located in `/plugins/extra_controls`. Adjust settings to your liking.
3. Determine a set of controls/combos that players can use. Configure the EXTRA\_CONTROLS table to your liking.\
   List of Key&#x73;**:** [CFX Game Reference - Controls](https://docs.fivem.net/docs/game-references/controls/)

   *Example:*

   <pre class="language-lua" data-title="SETTINGS.lua"><code class="lang-lua">CONTROLS = {
   	-- COMBOS = { &#x3C;list of index/key ID of approved combo-keys> }, 
   	-- KEYS = { &#x3C;list of index/key ID of approved toggle keys> }
   	COMBOS = { 326, 155, 19, 349 },    --LCTRL, LSHIFT, LALT, TAB
   	KEYS = { 187, 188, 189, 190, 20 }  -- ARROW DWN, UP, LFT, RGT, Z
   }
   </code></pre>
4. Configure the EXTRA\_CONTROLS table to your liking. \
   \&#xNAN;*Example:*

   <pre class="language-lua" data-title="SETTINGS.lua"><code class="lang-lua">EXTRA_CONTROLS = {
   	['DEFAULT'] = { 	},	
   	['LAPD'] = { 
   			--  	{ '&#x3C;name>', Extras = {&#x3C;extras table>}, Combo = &#x3C;default combo>, Key = &#x3C;default key>, (opt.) Audio = &#x3C; button soundFX> }
   				{ Name = 'Front Cut', Extras = {add = 8, remove = 9, repair = true}, Combo = 155, Key = 20, Audio = true }, 
   				{ Name = 'Scene Lights', Extras = {toggle = 9, repair = true}, Combo = 349, Key = 20, Audio = true }, 
   				{ Name = 'Pass. Spot Light', Extras = {add = 3, remove = 4, repair = true}, Combo = 326, Key = 20, Audio = false }, 
   	},	
   	['so3'] = { 
   			--  	{ '&#x3C;name>', Extras = {&#x3C;extras table>}, Combo = &#x3C;default combo>, Key = &#x3C;default key>, (opt.) Audio = &#x3C; button soundFX> }
   				{ Name = 'Test', Extras = {add = 4, remove = 9, repair = true}, Combo = 155, Key = 20, Audio = true }, 
   				{ Name = 'Test2', Extras = {toggle = 5, repair = true}, Combo = 349, Key = 20, Audio = true }, 
   				{ Name = 'Test3', Extras = {add = 6, remove = 7, repair = true}, Combo = 326, Key = 20, Audio = false }, 
   	},
   }
   </code></pre>

{% hint style="warning" %}
Every default `Combo` and `Key` assignment need to be present at a minimum in the CONTROLS table.
{% endhint %}

### Extras Table

#### **Toggle**

A toggle key will toggle a single extra on trigger or multiple extra if a table is passed in.

* Single Example: \
  `{ Name = 'Test', Extras = { toggle = 4 }, Combo = 155, Key = 20 }`&#x20;
* Multiple Example: \
  `{ Name = 'Test', Extras = {` toggle`= { 4, 5 } }, Combo = 155, Key = 20 }`&#x20;

#### **Add & Remove**

An add and remove key will add the passed extra(s) on trigger and remove passed extras(s) on trigger. When the control is pressed again, the behavior will reverse adding the removed extra(s) and removing the added extra(s).

* Single Example: \
  \``{ Name = 'Test', Extras = { add = 4, remove = 5 }, Combo = 155, Key = 20}`&#x20;
* Multiple Example: \
  `{ Name = 'Cruise', Extras = { add = { 4, 8 }, remove = { 5, 9 }, Combo = 155, Key = 20}`

#### **Repair Flag**

A repair flag can optionally be added for higher poly extras. GTA will set extras of low poly items without repairing the vehicle, however for things like spotlights, lightbars, etc. the repair flag may need to be set. By default `repair` is set to disabled, to override add `repair = true` somewhere inside the desired trigger table.

* Examples:
  * `{ Name = 'Test', Extras = { toggle = 4, repair = true }, Combo = 155, Key = 20 }`
  * `{ Name = 'Cruise', Extras = { add = { 5 }, remove = { 6 }, repair = true }, Combo = 155, Key = 20 }`

#### Controls

* Combo: *combokey* to be pressed in addition to *key* in order to activate profile. `Combo = 0` to disable the need for a combo key.
* Key: *control* to be pressed with *combokey* (if set) in order to activate profile.

#### Audio

The audio flag determines if the plugin plays a button press soundfx (like heard when toggling siren) when the extra\_control profile is toggled.

{% hint style="success" %}
Finished, configure your personal settings in game under 'Plugins->Extra Control' menu.
{% endhint %}
