# S4 Carcontrol V2

## s4-carcontrol Lua Exports & Config Documentation

This document describes the available exports in the Lua codebase and explains the configuration options in `config.lua`.

***

### Lua Exports

Exports allow other resources or scripts to interact with s4-carcontrol's functionality.

#### client/client.lua

* **OpenMenu(mini: boolean)**
  * Opens the car control menu. If `mini` is true, opens the mini menu.
  * Usage: `exports['s4-carcontrol']:OpenMenu(true)`
* **IsMenuOpen()**
  * Returns whether the car control menu is currently open.
  * Usage: `local open = exports['s4-carcontrol']:IsMenuOpen()`

#### client/neon.lua

* **SetNeon(state, animation, speed, rainbow, color)**
  * Enables/disables neon lights, sets animation type, speed, rainbow effect, and color.
  * Usage: `exports['s4-carcontrol']:SetNeon(true, "wave", 150, false, "#ff00ff")`
* **setNeonColor(r, g, b)**
  * Sets neon color directly using RGB values.
  * Usage: `exports['s4-carcontrol']:setNeonColor(255, 0, 255)`

#### client/hl.lua

* **setHeadlightColor(r, g, b)**
  * Sets the vehicle's headlight color using RGB values.
  * Usage: `exports['s4-carcontrol']:setHeadlightColor(255, 255, 0)`

#### client/musicPlayer\_cl.lua

* (No direct exports, interacts via NUI and server events.)

***

### config.lua Options

`config.lua` contains settings to customize the resource's behavior:

* **Config.OpenKey**: Keyboard key to open the main menu (default: `"o"`).
* **Config.OpenKeyMini**: Keyboard key to open the mini menu (default: `"m"`).
* **Config.SportModeMultiplier**: Multiplier for sport mode vehicle power (default: `10.0`, set to `0.0` to disable).
* **Config.OnlyHearMusicInVehicle**: If `true`, music is only audible inside vehicles.
* **Config.Lang**: Language code for UI and notifications (e.g., `"en"`, `"tr"`, `"de"`, etc.).
* **Config.AllowedVehicleClasses**: Table specifying which vehicle classes can use car control features (indexed by class ID, `true`/`false`).

***

For further details, see the comments and usage examples in each Lua file.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0resmon.org/0resmon/0resmon-1/s4-resources/s4-carcontrol-v2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
