# Configuration

## **Basic explanation:**

```lua
--Administration--
Config.UpdateChecker = true -- Set to false if you don't want to check for resource update on server startup.
Config.AdminCommands = true -- Set to false if you don't want admins to be able to set players hunger and thirst.

-- Inventory --
Config.Inventory = 'OX' -- Options: 'QB', 'PS', 'OX', 'CodeM', 'Quasar', 'Tgiann'

-- Progressbar --
Config.Progressbar = 'QB' -- 'QB' | 'OX' | 'Custom' | false

-- Notify --
Config.Notify = 'QB' -- 'QB' | 'OX' | 'Custom' | false

-- Stress --
Config.Stress = 'QB' -- Options: 'QB', 'Custom', false

Config.Translations = {
    NotifyCancelled = {
        title = ' ',
        text = 'You have cancelled!',
        texttype = 'error',
        duration = 5,
        icon = 'fa-solid fa-utensils',
    },
    MaxUses = {
        title = ' ',
        text = 'You have reached max uses.',
        texttype = 'error',
        duration = 5,
        icon = 'fa-solid fa-utensils',
    },
}

Config.ConsumablesCustom = {
    ['pixelsandwich'] = {
        -- Item removal and receiving
        ['item'] = {
            remove = { 
                { item = 'pixelsandwich', amount = 1 } -- Item and amount to remove upon consumable use
            },
            receive = { 
                { item = nil, amount = nil } -- Item and amount to receive upon consumable use (set to nil for no item)
            },
            maxuses = nil, -- The max amount of times the item can be used per player, per server restart.
        },
        -- Notification settings (works if using Config.Notify)
        ['notify'] = { 
            title = ' ', -- Title for the notification
            text = 'You have finished eating!', -- Text to display in the notification
            texttype = 'success', -- Type of notification (success, error, etc.)
            duration = 5, -- Duration of the notification (1 = 1 second)
            icon = 'fa-solid fa-utensils', -- Icon for the notification (optional)
        },
        -- Progressbar settings (works if using Config.Progressbar)
        ['progress'] = {
            title = ' ', -- Title for the progress bar (optional)
            text = 'Eating', -- Text for the progress bar
            duration = 5, -- Duration of the progress (1 = 1 second)
            icon = 'fa-solid fa-utensils', -- Icon for the progress bar (optional)
            useWhileDead = false, -- Whether the progress bar can be used while dead
            canCancel = false, -- Whether the progress bar can be canceled
        },
        -- Control restrictions during consumable use.
        ['controlDisables'] = {
            disableMovement = false, -- Disable movement
            disableCarMovement = false, -- Disable car movement
            disableMouse = false, -- Disable mouse control
            disableCombat = true, -- Disable combat
        },
        -- Animation settings during consumable use.
        ['animation'] = {
            scene = nil, -- Custom animation scene (optional)
            animDict = "mp_player_inteat@burger", -- Animation dictionary
            anim = "mp_player_int_eat_burger", -- Animation name
            duration = 5, -- Duration of the animation (1 = 1 second)
            flags = 49, -- Animation flags (optional)
        },
        -- Custom prop settings for consumable use.
        ['prop'] = {
            model = "bv_sw_blackforestham", -- Model of the prop
            bone = 18905, -- The bone of the prop (18905 = left hand, 57005 = right hand)
            coords = vector3(0.13, 0.05, 0.03), -- Position of the prop
            rotation = vector3(-60.0, 150.0, -10.0), -- Rotation of the prop
        },
        -- Second custom prop settings for consumable use.
        ['prop2'] = {
            model = nil,
            bone = nil,
            coords = nil,
            rotation = nil,
        },
        -- Replenish settings (Hunger/Thirst)
        ['replenish'] = {
            type = 'Hunger', -- 'Hunger', 'Thirst' or { 'Hunger', 'Thirst' } for both.
            amount = 20, -- Amount to replenish
            max = nil, -- The max threshold to replenish to
        },
        -- Deplete settings (Hunger/Thirst)
        ['deplete'] = {
            type = nil, -- 'Hunger', 'Thirst' or { 'Hunger', 'Thirst' } for both.
            amount = nil, -- Amount to deplete (optional)
            min = nil, -- The min threshold to deplete to
        },
        -- Stress settings (works if using Config.Stress)
        ['stress'] = {
            type = nil, -- 'relieve' or 'gain' (optional)
            amount = nil, -- Amount to modify stress (optional)
        },
        -- Alcohol-related settings
        ['alcohol'] = {
            lightalcohol = nil, -- Amount drank where light alcohol effects start
            heavyalcohol = nil, -- Amount drank where heavy alcohol effects start
            duration = nil, -- Duration of alcohol effects (1 = 1 second)
        },
        -- Drug-related effects
        ['drug'] = {
            drugeffect = nil, -- Effects like 'psychedelic', 'dizzy', etc.
            duration = nil, -- Duration of drug effects (1 = 1 second)
        },
        -- Buff settings (With or without values)
        ['buffs'] = {
            novaluebuff = nil, -- Buffs without a value (e.g., 'superJump')
            valuebuff = nil, -- Buffs with values (e.g., 'runningspeed' = 1.0)
            duration = nil, -- Duration of the buffs (1 = 1 second)
        }
    }
}
```

## **Examples and lists:**

{% tabs %}
{% tab title="item" %}

```lua
-- Below is an example of removing a cola and receiving back an empty can.
['item'] = {
    remove = { 
        { item = 'pixelcola', amount = 1 }, -- Item and amount to remove upon consumable use
    },
    receive = { 
        { item = 'emptycan', amount = 1 }, -- Item and amount to receive upon consumable use (set to nil for no item)
    },
},
```

{% endtab %}

{% tab title="alcohol" %}

<pre class="language-lua"><code class="lang-lua">-- Below is an example of drinking 5 to get light effects and 7 for heavy effects.
<strong>['alcohol'] = {
</strong>    lightalcohol = 5, -- Amount drank where light alcohol effects start
    heavyalcohol = 7, -- Amount drank where heavy alcohol effects start
    duration = 120, -- Duration of alcohol effects (1 = 1 second)
},
</code></pre>

{% endtab %}

{% tab title="drug" %}

<pre class="language-lua"><code class="lang-lua">-- Below is a list of all possible drug effects.
<strong>['drug'] = {
</strong>    drugeffect = {
        'psychedelic',
        'brightpsychedelic',
        'foggy',
        'flicker',
        'dizzy',
        'shaking',
        'focus'
    },
    duration = 120, -- Duration of drug effects (1 = 1 second)
},
</code></pre>

{% endtab %}

{% tab title="buffs" %}

```lua
-- Below is a list of all possible buff effects with and without values
['buffs'] = {
    novaluebuff = {
        'nostress', -- No stress will be received.
        'stamina', -- No stamina will be drained.
        'superjump' -- Will be able to do super jumps.
    },
    valuebuff = {
        -- All values default is 1, just increase them as you wish.
        strength = 1, -- Will give strength according to the set value.
        running = 1, -- Will increase speed based on set value.
        swimming = 1, -- Will increase swimming speed based on set value.
        health = 1, -- Will increase health every 2 seconds based on set value.
        armor = 1 -- Will increase armor every 2 seconds based on set value.
    },
    duration = nil, -- Duration of the buffs (1 = 1 second)
}
```

{% endtab %}
{% endtabs %}

## **Integration with other scripts:**

{% tabs %}
{% tab title="r14-evidence" %}
Below is a guide with everything needed to add or change for integration with r14-evidence.

* You will need to download the latest version of our consumables in order for this to work.
* You must replace the specified lines in the specified files with the code below.

**r14-evidence/config.lua - Line 210**

```lua
Config.Breathalyzer = {
    Enabled = true,
    UsingESX = false,
    EventTriggers = {
        [1] = {
            event = 'pixel-consumables:alcohol',
            type = 'client',
            alcoholArgPos = 1,
            alcoholArgValue = {
                ['pixelbeer'] = 10,
                ['pixelwhiskey'] = 300,
                ['pixelvodka'] = 300,
                ['pixelchampagne'] = 120,
                ['pixeltequilla'] = 300,
                ['pixelwine'] = 150,
            },
        },
    },
}
```

**r14-evidence/config.lua - Line 256**

```lua
Config.DrugTesting = {
    Enabled = true,
    UsingQBSR = false,
    DefaultPositiveTime = 3,
    Drugs = {
        ['pixeljoint'] = {
            label = 'Marijuana'
        },
        ['pixelcocaine'] = {
            label = 'Cocaine',
        },
        ['pixelmeth'] = {
            label = "Methamphetamine",
        },
        ['pixelshrooms'] = {
            label = 'Shrooms',
        },
        ['pixelecstasy'] = {
            label = 'Ecstasy',
        },
        ['pixeloxy'] = {
            label = 'Oxycodone',
        },
    },
    EventTriggers = {
        [1] = {
            event = 'pixel-consumables:drugs',
            type = 'client',
            drugArgPos = 1,
            drugArgValue = {
                ['pixeljoint'] = 'pixeljoint',
                ['pixelcocaine'] = 'pixelcocaine',
                ['pixelmeth'] = 'pixelmeth',
                ['pixelshrooms'] = 'pixelshrooms',
                ['pixelecstasy'] = 'pixelecstasy',
                ['pixeloxy'] = 'pixeloxy',
            }
        },
    }
}
```

**r14-evidence/client/main.lua - Line 1217**

```lua
local drugType = checkValue[checkArg]
local positiveTime = v.positiveTime or Config.DrugTesting.DefaultPositiveTime
                    
TriggerServerEvent('evidence:server:SetDrugStatus', {drug = drugType, hours = positiveTime})
```

{% endtab %}
{% endtabs %}
