> For the complete documentation index, see [llms.txt](https://docs.mosotoscripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mosotoscripts.com/scripts/mst_breathalyzer/configurations.md).

# Configurations

***

<details>

<summary>Breathalyzer</summary>

```lua
Config.Debug = false -- Enable/disable debug mode
```

{% hint style="info" %}
**Description:** Controls debug information and detailed logging.
{% endhint %}

**Options:**

* `true`: Enables debug mode with detailed console output
* `false`: Disables debug mode (recommended for production)

{% hint style="danger" %}
**Use Cases:** Enable only when troubleshooting issues.
{% endhint %}

***

```lua
Config.Breathalyzer = {
    authorizedJobs = {    -- Jobs with minimum grade allowed to use
        ["police"] = 0,   -- Police job with minimum grade 0
        ["ambulance"] = 0 -- Ambulance job with minimum grade 0
    }
}
```

{% hint style="info" %}
**Description:** Controls which jobs can use the breathalyzer device.
{% endhint %}

**Format:** `["job_name"] = minimum_grade`

* `job_name`: The exact job name from your server
* `minimum_grade`: Minimum job grade required (0 = all grades)

***

```lua
Config.Breathalyzer = {
    scale = 0.9,                  -- Scale of the breathalyzer device
    showCommand = "breathalyzer", -- Command to open breathalyzer
    itemName = "breathalyzer",    -- Name of the breathalyzer item
    enableItemUsage = true,       -- Enable/disable usage of the item
}
```

**Scale:**

{% hint style="info" %}
**Description:** Controls the size of the breathalyzer device on screen
{% endhint %}

* **Range:** `0.1` to `1.5`
* **Default:** `0.9` (90% of original size, recommended)
* **Use Cases:** Adjust for different screen resolutions or preferences

**Show Command:**

{% hint style="info" %}
**Description:** The command players can type to open the breathalyzer
{% endhint %}

* **Default:** `'breathalyzer'`
* **Usage:** Players type `/breathalyzer` in chat

**Item Name:**

{% hint style="info" %}
**Description:** The exact name of the breathalyzer item in your inventory
{% endhint %}

* **Must Match:** The item name in your database/items configuration
* **Example:** If your item is named `'breathalyzer_device'`, change this to match

**Enable Item Usage:**

{% hint style="info" %}
**Description:** Controls whether the breathalyzer item can be used
{% endhint %}

* **Options:** `true` (enabled), `false` (disabled)
* **Use Cases:** Disable if you only want command-based access

***

```lua
Config.Breathalyzer = {
    clock = {
        useGameTime = false, -- true = in-game time, false = system time
        format24Hour = true  -- true = 24-hour format, false = 12-hour AM/PM
    }
}
```

**Use Game Time:**

{% hint style="info" %}
**Description:** Controls which time system the breathalyzer displays
{% endhint %}

**Options:**

* `true`: Shows in-game server time
* `false`: Shows real system time

**24-Hour Format:**

{% hint style="info" %}
**Description:** Controls time display format
{% endhint %}

**Options:**

* `true`: 24-hour format (13:30, 23:45)
* `false`: 12-hour format (1:30 PM, 11:45 PM)

***

```lua
Config.Breathalyzer = {
    controls = {
        blowKey = 38,  -- Key for blowing into breathalyzer
        closeKey = 177 -- Key for closing the UI
    }
}
```

**Blow Key:**

{% hint style="info" %}
**Description:** The key players press to blow into the breathalyzer
{% endhint %}

* Default: `38` (E key)

**Close Key:**

{% hint style="info" %}
**Description:** The key to close the breathalyzer interface
{% endhint %}

* Default: `177` (ESC key)

**Key Code Reference:** [FiveM Controls Documentation](https://docs.fivem.net/docs/game-references/controls/) (If you want to assign a different button, get its code from the link.)

***

```lua
Config.Breathalyzer = {
    pedDistance = 1.5 -- Distance to detect nearest player for paired test
}
```

{% hint style="info" %}
**Description:** Controls how far the breathalyzer can detect other players for paired testing.
{% endhint %}

**Range:**

* **Lower Values:** More precise, requires players to be very close (recommended)
* **Higher Values:** More forgiving, can test players from further away

</details>

<details>

<summary>Alcohol</summary>

```lua
Config.AlcoholSystem = {
    effectsEnabled = true,
    drinkingAnimationEnabled = true
}
```

***

```lua
Config.AlcoholSettings = {
    -- BAC (Blood Alcohol Content) thresholds
    sober = { min = 0.00, max = 0.50 },    -- Sober range
    impaired = { min = 0.51, max = 1.00 }, -- Impaired range
    drunk = { min = 1.01, max = 4.0 },     -- Drunk range
}
```

{% hint style="info" %}
**Description:** Defines the BAC ranges that determine a player's intoxication level.
{% endhint %}

**Customization:** You can adjust these ranges to match your server's gameplay style:

* **Sober Range:** Light effects
* **Impaired Range:** Medium effects
* **Drunk Range:** Heavy effects

***

***

```lua
Config.AlcoholSettings = {
    reduceBAC = {
        amount = 0.008,        -- Amount BAC decreases per interval
        interval = 15,         -- Interval in seconds for BAC reduction
        -- Time calculation for 1.00 BAC:
        -- 1.00 ÷ 0.008 = 125 intervals
        -- 125 intervals × 15 seconds = 1875 seconds = 31.25 minutes
    }
}
```

{% hint style="info" %}
**Description:** Controls how quickly players sober up over time.
{% endhint %}

**Customization Options:**

* **Amount:** 0.001 to as much as you want (BAC reduction per interval)
* **Interval:** 1 to as much as you want seconds (how often BAC decreases)

**Example:**

```lua
-- Default settings (0.008 every 15 seconds)
-- 1.00 BAC → 0.00 BAC = 31.25 minutes

-- Fast sobering (0.015 every 10 seconds)  
-- 1.00 BAC → 0.00 BAC = 11.1 minutes

-- Slow sobering (0.005 every 20 seconds)
-- 1.00 BAC → 0.00 BAC = 66.7 minutes

-- Very slow sobering (0.003 every 30 seconds)
-- 1.00 BAC → 0.00 BAC = 166.7 minutes (2.8 hours)
```

***

```lua
Config.AlcoholSettings = {
    hungerSensitivity = {
        enabled = true,                  -- Toggle hunger effect on BAC
        hungerSensitivityThreshold  = 30,-- Hunger percentage threshold
        hungerSensitivityMultiplier = 30 -- BAC increase percentage when hungry
    }
}
```

```lua
Config.AlcoholSettings = {
    hungerSensitivity = {
        enabled = true,                  -- Toggle hunger effect on BAC
        hungerSensitivityThreshold  = 30,-- Hunger percentage threshold
        hungerSensitivityMultiplier = 30 -- BAC increase percentage when hungry
    }
}
```

{% hint style="info" %}
**Description:** Makes alcohol effects stronger when players are hungry.
{% endhint %}

**Mechanics:**

* **Threshold:** When hunger drops below this percentage, effects amplify
* **Multiplier:** BAC effects increase by this percentage when hungry
* **Example:** At 30% hunger, 0.40 BAC becomes 0.52 BAC effect

***

```lua
effectRemovalItems = {
    ["yogurt"] = {
        time = 5000, -- Time in milliseconds to consume
        label = 'Yogurt', -- Display name for progress bar
        clearEffects = true, -- Remove drunk effects
        reduceBac = 0.30, -- Reduce BAC by amount (0.00 = no reduction)
        animation = {
            animDict = 'mp_player_intdrink',
            anim = 'loop_bottle'
        },
        prop = {
            model = 'prop_cs_script_bottle',
            bone = 60309,
            coords = vec3(0.0, 0.0, 0.03),
            rotation = vec3(0.0, 0.0, 0.0),
        },
    },
},
```

***

```lua
Config.AlcoholSettings = {
    ["whiskey"] = {
        bac = 0.40,         -- BAC increase when consumed
        time = 8000,        -- Time in milliseconds to consume
        thirstIncrease = 5, -- Increases thirst by 5%
        
        animation = {
            animDict = 'mp_player_intdrink', -- Animation dictionary
            anim = 'loop_bottle'             -- Animation name
        },
        
        prop = {
            model = 'prop_whiskey_bottle',  -- 3D model of the bottle
            bone = 60309,                   -- Bone ID to attach prop
            coords = vec3(0.0, 0.0, -0.18), -- Offset coordinates
            rotation = vec3(0.0, 0.0, -40)  -- Rotation in degrees
        }
    }
}
```

**Key Properties:**

* **BAC:** How much alcohol content the item adds (0.01 to your max BAC)
* **Time:** Consumption duration in milliseconds (1000 to 15000)
* **ThirstIncrease:** Dehydration effect (0 to 20)

**Animation & Props:**

* **animDict:** Animation library to use
* **anim:** Animation name
* **model:** 3D model name
* **bone:** Body part to attach item to
* **coords:** Position offset from bone
* **rotation:** Item rotation in degrees

**Add Your Item:**

```lua
["item_name"] = {
    bac = 0.20,         -- Adjust BAC increase (0.01 to 4.0)
    time = 8000,        -- Adjust consumption time (1000 to 15000 ms)
    thirstIncrease = 5, -- Adjust thirst increase (0 to 20)
    
    animation = {
        animDict = 'mp_player_intdrink', -- Keep default or change
        anim = 'loop_bottle'             -- Keep default or change
    },
    
    prop = {
        model = 'prop_your_item_model', -- Change to your item model
        bone = 60309,                   -- Keep default (right hand)
        coords = vec3(0.0, 0.0, -0.18), -- Adjust position if needed
        rotation = vec3(0.0, 0.0, -40)  -- Adjust rotation if needed
    }
}
```

</details>

<details>

<summary>Drunk Levels</summary>

```lua
Config.DrunkLevels = {
    {
        minBac = 0.21,        -- Minimum BAC level for these effects
        maxBac = 0.49,        -- Maximum BAC level for these effects
        
        onFoot = {             -- Effects when player is on foot
            statusEffects = { ... },
            walkingDifficulty = { ... }
        },
        
        combat = {              -- Effects during combat
            damage = { ... },
            accidentalShooting = { ... }
        },
        
        driving = {             -- Effects while driving
            steeringDrift = { ... },
            randomVehicleEvents = { ... }
        }
    }
}
```

**BAC Level Ranges:**

* **Level 1 (0.21-0.49):** Light effects, minor impairment
* **Level 2 (0.50-0.99):** Moderate effects, noticeable impairment
* **Level 3 (1.00-1.49):** Heavy effects, significant impairment
* **Level 4 (1.50-1.99):** Severe effects, major impairment
* **Level 5 (2.00+):** Extreme effects, dangerous impairment

**Effect Categories:**

* **OnFoot:** Walking, movement, and status effects
* **Combat:** Fighting, shooting, and damage effects
* **Driving:** Vehicle control and random event effects

***

```lua
onFoot = {
    statusEffects = {
        ragdoll = { enabled = true, chance = 15 }, -- Random ragdoll falls
        blackout = { enabled = true, chance = 5 }, -- Temporary unconsciousness
        vomiting = { enabled = true, chance = 25, thirstIncrease = 10 }
    },
    
    walkingDifficulty = {
        enabled = true,      -- Enable walking effects
        swayIntensity = 0.8, -- Walking sway amount
        speedReduction = 0.3 -- Movement speed reduction
    }
}
```

{% hint style="info" %}
**Description:** Controls how quickly players sober up over time.
{% endhint %}

**Customization Options:**

* **Amount:** 0.001 to as much as you want (BAC reduction per interval)
* **Interval:** 1 to as much as you want seconds (how often BAC decreases)

**Example:**

```lua
-- Default settings (0.008 every 15 seconds)
-- 1.00 BAC → 0.00 BAC = 31.25 minutes

-- Fast sobering (0.015 every 10 seconds)  
-- 1.00 BAC → 0.00 BAC = 11.1 minutes

-- Slow sobering (0.005 every 20 seconds)
-- 1.00 BAC → 0.00 BAC = 66.7 minutes

-- Very slow sobering (0.003 every 30 seconds)
-- 1.00 BAC → 0.00 BAC = 166.7 minutes (2.8 hours)
```

***

```lua
Config.AlcoholSettings = {
    hungerSensitivity = {
        enabled = true,                  -- Toggle hunger effect on BAC
        hungerSensitivityThreshold  = 30,-- Hunger percentage threshold
        hungerSensitivityMultiplier = 30 -- BAC increase percentage when hungry
    }
}
```

{% hint style="info" %}
**Description:** Makes alcohol effects stronger when players are hungry.
{% endhint %}

**Mechanics:**

* **Threshold:** When hunger drops below this percentage, effects amplify
* **Multiplier:** BAC effects increase by this percentage when hungry
* **Example:** At 30% hunger, 0.40 BAC becomes 0.52 BAC effect

***

```lua
Config.AlcoholSettings = {
    ["whiskey"] = {
        bac = 0.40,         -- BAC increase when consumed
        time = 8000,        -- Time in milliseconds to consume
        thirstIncrease = 5, -- Increases thirst by 5%
        
        animation = {
            animDict = 'mp_player_intdrink', -- Animation dictionary
            anim = 'loop_bottle'             -- Animation name
        },
        
        prop = {
            model = 'prop_whiskey_bottle',  -- 3D model of the bottle
            bone = 60309,                   -- Bone ID to attach prop
            coords = vec3(0.0, 0.0, -0.18), -- Offset coordinates
            rotation = vec3(0.0, 0.0, -40)  -- Rotation in degrees
        }
    }
}
```

**Key Properties:**

* **BAC:** How much alcohol content the item adds (0.01 to your max BAC)
* **Time:** Consumption duration in milliseconds (1000 to 15000)
* **ThirstIncrease:** Dehydration effect (0 to 20)

**Animation & Props:**

* **animDict:** Animation library to use
* **anim:** Animation name
* **model:** 3D model name
* **bone:** Body part to attach item to
* **coords:** Position offset from bone
* **rotation:** Item rotation in degrees

**Add Your Item:**

```lua
["item_name"] = {
    bac = 0.20,         -- Adjust BAC increase (0.01 to 4.0)
    time = 8000,        -- Adjust consumption time (1000 to 15000 ms)
    thirstIncrease = 5, -- Adjust thirst increase (0 to 20)
    
    animation = {
        animDict = 'mp_player_intdrink', -- Keep default or change
        anim = 'loop_bottle'             -- Keep default or change
    },
    
    prop = {
        model = 'prop_your_item_model', -- Change to your item model
        bone = 60309,                   -- Keep default (right hand)
        coords = vec3(0.0, 0.0, -0.18), -- Adjust position if needed
        rotation = vec3(0.0, 0.0, -40)  -- Adjust rotation if needed
    }
}
```

</details>

<div align="center"><figure><img src="/files/dIHr5923MxpfHcJyeWiq" alt="Configurations"><figcaption><p><code>config.lua</code></p></figcaption></figure></div>
