# General Configuration

This guide will help you configure the script to suit your needs, covering all available options in the `config.lua` file. Each setting is explained step by step.

***

### **1. General Configuration**

#### **Language**

Set the language used by the script.

```lua
Config.Language = 'en' -- Available options: 'en' (English), 'fr' (French)
```

#### **Use Outdated Version**

Enable this option to suppress alert messages when using an older version of the script.

```lua
Config.UseOutdatedVersion = false -- Set to true if using an outdated script version.
```

***

### 2. Framework Compatibility

If you're using a framework like **ESX**, **QB**, or **OX Inventory**, enable this setting.

```lua
Config.UseFramework = false
```

* When `true`, the system uses the inventory (e.g., weapon usage) instead of command-based interactions.
* Setup instructions for each framework are available on:
  * [ESX Guide](https://docs.rytrak.fr/framework-compatibility/add-a-custom-weapon-on-esx)
  * [QBCore Guide](https://docs.rytrak.fr/framework-compatibility/add-a-custom-weapon-on-qbcore)
  * [OX Inventory Guide](https://docs.rytrak.fr/framework-compatibility/add-a-custom-weapon-on-ox-inventory)

***

### **3. Voice System Compatibility**

{% hint style="warning" %}
**Note:** Only one voice system can be enabled at a time.
{% endhint %}

#### **PMA-Voice Compatibility**

Enable this option if your server uses **PMA-Voice**.

```lua
Config.Compatibility.PMAVoice = {
    enabled = false, -- Set to true if using PMA-Voice.
    resourceName = 'pma-voice' -- Name of the PMA-Voice resource.
}
```

{% hint style="danger" %}
**Important:** If enabled, check the [official documentation](https://docs.rytrak.fr/scripts/advanced-megaphone-system/adapt-our-script-with-pma-voice).
{% endhint %}

***

#### **SaltyChat Compatibility**

Enable this option if your server uses **SaltyChat**.

If you're not sure which version of SaltyChat you are using:

* Try enabling the **new version** (`UseNewVersion = true`).
* Launch the game and test the megaphone.
* If you see an error in the **F8 client console**, switch to `UseNewVersion = false` and set `UseOldVersion = true`.

```lua
Config.Compatibility.SaltyChat = {
    UseNewVersion = true,  -- Use this for the latest SaltyChat (LUA or C# integration)
    UseOldVersion = false  -- Use this for older versions of SaltyChat support
}
```

***

#### **YACA Compatibility**

Enable this option if your server uses **YACA**.

```lua
Config.Compatibility.YACA = {
    enabled = false, -- Enable if using YACA.
    resourceName = 'yaca' -- Name of the YACA resource.
}
```

***

#### **Mumble-VOIP Compatibility**

Enable this option if your server uses **Mumble-VOIP**.

```lua
Config.Compatibility.MumbleVOIP = false -- Set to true if using Mumble-VOIP.
```

{% hint style="danger" %}
**Important:** If enabled, check the [official documentation](https://docs.rytrak.fr/scripts/advanced-megaphone-system/adapt-our-script-with-mumble-voip) for further setup.
{% endhint %}

***

### **4. Megaphone Behavior Settings**

#### **Auto Push-to-Talk**

Automatically activates push-to-talk while using the megaphone.

```lua
Config.AutoTalk = true -- Set to true to auto-enable push-to-talk when using the megaphone.
```

#### **Talk Distance**

Defines the speaking range of the megaphone.

```lua
Config.TalkDistance = 35.0 -- Adjust the distance players can hear the megaphone.
```

*For PMA-Voice users, modify this in `@pma-voice/client/megaphone.lua`.*

#### **Manage Volume**

Allows players to adjust megaphone volume.

```lua
Config.ManageVolume = true -- Set to true to enable volume control.
Config.Volume = 1.0 -- Default volume level.
```

#### **Voice Effects**

Applies frequency filters to simulate a real megaphone sound.

```lua
Config.Effects = {
    frequencyLow = 200.0, -- Low-frequency filter.
    frequencyHigh = 9000.0 -- High-frequency filter.
}
```

#### **Disable Joystick Controller**

```lua
Config.DisableJoystickController = false -- Disables the megaphone when the player uses a joystick
```

***

### **5. Vehicle Configuration**

#### **Enable Megaphone in Vehicles**

Allows megaphone usage while inside a vehicle.

```lua
Config.Vehicles.enabled = true -- Set to true to enable in-vehicle megaphone.
```

#### **Vehicle Notification Hint**

Displays a notification when inside a vehicle with a megaphone.

```lua
Config.Vehicles.hint = {
    enabled = true, -- Show hint at the top left of the screen.
    timeout = 4000 -- Display duration in ms.
}
```

#### **Restrict to Emergency Vehicles**

Limits megaphone use to emergency vehicles only.

```lua
Config.Vehicles.emergencyOnly = true -- Set to true to restrict usage to emergency vehicles.
```

#### **Additional Allowed Vehicles**

Specify additional vehicles that can use the megaphone.

```lua
Config.Vehicles.additionalVehicles = {
    'police',
    'fbi'
}
```

#### **Allowed Seat Positions**

Define which vehicle seats can use the megaphone.

```lua
Config.Vehicles.allowedSeats = {-1, 0} -- -1 = Driver, 0 = Front Passenger.
```

***

### **6. Megaphone Weapon Settings**

#### **Define Megaphone as a Weapon**

Sets the megaphone as a weapon in the game.

```lua
Config.Weapon = `WEAPON_MEGAPHONE` -- Megaphone weapon identifier.
```

#### **Megaphone Display Name**

Name displayed in the weapon wheel when equipping the megaphone.

```lua
Config.MegaphoneWeaponName = "Megaphone"
```

***

### **7. Key Bindings**

#### **Keys for Interaction**

Set the keys used for speaking into the megaphone.

```lua
Config.Keys = {
    SpeakKey = 92, -- Key to activate megaphone speaking.
    SpeakKeyString = '~INPUT_VEH_PASSENGER_ATTACK~', -- Display name for SpeakKey.

    SpeakInVehicleKey = 311, -- Key to activate megaphone inside a vehicle.
    SpeakInVehicleKeyString = '~INPUT_REPLAY_SHOWHOTKEY~' -- Display name for SpeakInVehicleKey.
}
```

Refer to the [FiveM Control Reference](https://docs.fivem.net/docs/game-references/controls/) for a list of control codes.

***

### **8. Language Library**

Edit the text displayed for different actions in multiple languages.


---

# 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.rytrak.fr/scripts/advanced-megaphone-system/general-configuration.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.
