# 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. Inventory Management

**Auto Remove Empty Items**\
Automatically removes empty pepper spray or antidote items from the inventory based on your framework.

```lua
Config.AutoRemoveEmptyItems = {
    enabled = false,
    framework = {
        ESX = false,
        QBCore = false,
        OXInventory = false
    }
}
```

***

### 4. Recharge System

**Recharge Locations**\
Defines coordinates where players can refill their sprays.

```lua
Config.RechargeLocations = {
    vector3(-323.72, -1465.74, 30.55),
    vector3(-313.63, -1461.49, 30.54)
}
Config.RechargeRadius = 3.0 -- Radius around the recharge point (in meters)
```

***

### 5. Player Control Settings

Disable certain actions when affected by gas.

```lua
Config.DisableControl = {
    Sprint = true,
    EnterVehicle = true,
    Fight = true
}
```

***

### 6. Weapon Settings

**Weapon Display Names**\
Names displayed in the weapon wheel.

```lua
Config.WeaponWheelName = {
    pepperspray = 'Pepper Spray',
    antidote = 'Antidote'
}
```

**Cooldown Delay**\
Sets the cooldown time between certain actions to prevent spam.

```lua
Config.CooldownDelay = 500 -- In milliseconds
```

***

### 7. Pepper Spray Configuration

You can define multiple pepper spray types with their own stats.

```lua
Config.PepperSpray = {
    ['pepperspray'] = {
        weaponModel = 'WEAPON_PEPPERSPRAY', -- Weapon model name

        sprayQuantity = 500, -- Maximum spray capacity
        sprayDescentSpeed = 10, -- How quickly the spray runs out
        sprayRange = 4, -- Effective range
        sprayDamageMultiplier = 1, -- Affects how quickly the gas effect builds up

        gasDescentSpeed = 500, -- How quickly the gas effect fades

        coughEnabled = true, -- Enable coughing when the player is affected by the gas.
        coughSound = true, -- Enable sound effect when the player coughs. (only if the cough system is enabled)
            
        spitEnabled = true, -- Can the player spit to reduce effects?
        spitDescentSpeed = 5, -- Gas reduction per spit
        spitTimeout = 10000, -- Delay between spits in ms

        rubbingEnabled = true, -- Can the player rub their eyes?
        rubbingDescentSpeed = 2.0, -- Gas reduction speed when rubbing

        selfDecontamination = true, -- Allow use of decontamination spray

        effect = {
            timecycle = {
                [1] = { name = 'ufo', opacity = 1.0 },
                [2] = { name = 'MP_death_grade_blend01', opacity = 0.8 }
            },
            shakeCamera = {
                name = 'DRUNK_SHAKE',
                intensity = 3.0
            }
        },

        particle = {
            dict = 'core',
            particle = 'exp_sht_extinguisher',
            particleCoords = vector3(0.10, 0.0, 0.0),
            particleRotation = vector3(-80.0, 0.0, -90.0),
            particleSize = 0.5
        },

        gasMask = {
            [`mp_m_freemode_01`] = { [1] = {}, [2] = {} },
            [`mp_f_freemode_01`] = { [1] = {}, [2] = {} }
        }
    }
}
```

***

### 8. Decontamination Spray

```lua
Config.Decontamination = {
    command = 'antidote', -- Command to receive the spray
    weaponModel = 'WEAPON_ANTIDOTE', -- Model used for the spray
    decontaminationQuantity = 100, -- Max amount available
    decontaminationDescent = 10, -- How long the effect takes to go down
    decontaminationCooldown = 2000, -- Cooldown between uses
    decreaseLevel = 10, -- How much the effect is reduced per use
    particle = {
        dict = 'scr_bike_business',
        particle = 'scr_bike_spraybottle_spray',
        particleCoords = vector3(0.30, 0.0, 0.0),
        particleRotation = vector3(-80.0, 0.0, -90.0),
        particleSize = 1.5
    }
}  
```

***

### 9. Progress Bar Design

Customize the look of the progress bar when recovering.

```lua
Config.Design = {
    ProgressBar = {
        color = {52, 152, 219}, -- RGB color of the bar
        text = 'RECOVERY' -- Max 8 characters, leave empty to hide text
    }
}
```

***

### 7. Key Bindings

#### Spit Key

Set the key used to spit out the gas.

```lua
Config.Keys.SpitKey = 47 -- Key to spit the gas (default: G)
Config.Keys.SpitKeyString = '~INPUT_DETONATE~' -- Display name for the spit key
```

#### Rubbing Key

Set the key used to rub the eyes and reduce the gas effect.

```lua
Config.Keys.RubbingKey = 104 -- Key to rub the eyes (default: H)
Config.Keys.RubbingKeyString = '~INPUT_VEH_SHUFFLE~' -- Display name for the rubbing key
```

#### Replace Key

Set the key used to replace your pepper spray or antidote.

```lua
Config.Keys.ReplaceKey = 47 -- Key to replace the pepper spray (default: G)
Config.Keys.ReplaceKeyString = '~INPUT_DETONATE~' -- Display name for the replace key
```

***

### **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-pepper-spray/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.
