# Bins

This script provides users the ability to search for items&#x20;

***

{% hint style="success" %}
Models
{% endhint %}

* Define bin models that can be searched for items

```sql
Config.Bins = {
    models = { -- bin models that can be searched
        `prop_dumpster_01a`, `prop_dumpster_02a`, `prop_dumpster_02b`, `prop_dumpster_3a`, `prop_dumpster_4a`, `prop_dumpster_4b`,
        `prop_bin_05a`, `prop_bin_06a`, `prop_bin_07a`, `prop_bin_07b`, `prop_bin_07c`, `prop_bin_07d`, `prop_bin_08a`, `prop_bin_08open`,
        `prop_bin_09a`, `prop_bin_10a`, `prop_bin_10b`, `prop_bin_11a`, `prop_bin_12a`, `prop_bin_13a`, `prop_bin_14a`, `prop_bin_14b`,
        `prop_bin_beach_01d`, `prop_bin_delpiero`, `prop_bin_delpiero_b`, `prop_recyclebin_01a`, `prop_recyclebin_02_c`, `prop_recyclebin_02_d`,
        `prop_recyclebin_02a`, `prop_recyclebin_02b`, `prop_recyclebin_03_a`, `prop_recyclebin_04_a`, `prop_recyclebin_05_a`, `prop_gas_smallbin01`,
        `zprop_bin_01a_old`, `hei_heist_kit_bin_01`, `ch_prop_casino_bin_01a`, `vw_prop_vw_casino_bin_01a`, `mp_b_kit_bin_01`, `prop_recyclebin_04_b`,
    },
    --- other options
}
```

***

{% hint style="success" %}
Chances
{% endhint %}

* You can define chances to find items, get pricked by a dirty needle and lose health and also the chance to find cash

```lua
Config.Bins = {
    ---
    chances = {
        findItem = 80, --chance to find item or nothing at all
        dirtyNeedle = 10, -- chance to get pricked by a dirty needle and loose health
        money = 10, -- chance to find cash when searching
        cashAmount = math.random(100,250), -- cash amount found
    },
    ---
}
```

***

{% hint style="success" %}
Target
{% endhint %}

Define icon, label and distance for the target interactions

* Note: never set the target distance higher than the value set in `Config.CoreSettings.Security.Maxdistance` to prevent false positives for exploits

```lua

Config.Bins = {
    ---
    target = {
        icon = 'fa-solid fa-recycle', -- target icon
        label = 'Search Bin', -- target label
        distance = 3.0, -- target distance
    },
    ---
}
```

***

{% hint style="success" %}
Cooldown
{% endhint %}

Cooldowns can be set to prevent exploits and abuse

* The duration is the general cooldown timer for all interactions (default is 5 seconds)
* You can also determine the cooldown timer value for searching the same bin again (default is 60 seconds)

```lua

Config.Bins = {
    ---
    cooldown = { -- cooldown settings handled server side
        enabled = true, -- enable search cooldown
        duration = 2500, -- duration for cooldown
        sameBinSearch = 60000, -- duration before can search same bin again
    },
    ---
}
```

***

{% hint style="success" %}
Progress
{% endhint %}

Define progress circle settings such as the duration, label and animations

* For no animation set to nil like this `anim = nil,`

```lua

Config.Bins = {
    ---
    progress = { -- progressCircle settings
        duration = 10000, -- duration to search bin
        label = 'Searching through rubbish', -- label
        anim = { -- animation settings
            dict = 'mp_car_bomb', -- anim dict name
            clip = 'car_bomb_mechanic', -- anim clip name
            flag = 49, -- anim flag number
        },
    },
    ---
}
```

***

{% hint style="success" %}
Rewards
{% endhint %}

Define reward items found from searching bins

* You can use math.random() or have a static number for the amount
* The name is the item name and must be in your items.lua
* The amount is the amount of that item that can be found
* One item will be picked at random

```lua

Config.Bins = {
    ---
    rewards = { -- rewards given from searching bins
        --name is item name
        --amount is amount given
        --one item will be picked from this list as a reward
        {name = 'iron',         amount = math.random(1,4) },
        {name = 'plastic',      amount = math.random(1,4) },
        {name = 'rubber',       amount = math.random(1,4) },
        {name = 'glass',        amount = math.random(1,4) },
        {name = 'steel',        amount = math.random(1,4) },
        {name = 'aluminum',     amount = math.random(1,4) },
        {name = 'copper',       amount = math.random(1,4) },
        {name = 'recyclebox',   amount = math.random(1,4) },
    },
}
```

***

{% hint style="success" %}
Finished Config
{% endhint %}

Below is an example of a finished config for `Config.Bins`

```sql
--searchable bins
Config.Bins = {
    models = { -- bin models that can be searched
        `prop_dumpster_01a`, `prop_dumpster_02a`, `prop_dumpster_02b`, `prop_dumpster_3a`, `prop_dumpster_4a`, `prop_dumpster_4b`,
	`prop_bin_05a`, `prop_bin_06a`, `prop_bin_07a`, `prop_bin_07b`, `prop_bin_07c`, `prop_bin_07d`, `prop_bin_08a`, `prop_bin_08open`,
	`prop_bin_09a`, `prop_bin_10a`, `prop_bin_10b`, `prop_bin_11a`, `prop_bin_12a`, `prop_bin_13a`, `prop_bin_14a`, `prop_bin_14b`,
	`prop_bin_beach_01d`, `prop_bin_delpiero`, `prop_bin_delpiero_b`, `prop_recyclebin_01a`, `prop_recyclebin_02_c`, `prop_recyclebin_02_d`,
	`prop_recyclebin_02a`, `prop_recyclebin_02b`, `prop_recyclebin_03_a`, `prop_recyclebin_04_a`, `prop_recyclebin_05_a`, `prop_gas_smallbin01`,
        `zprop_bin_01a_old`, `hei_heist_kit_bin_01`, `ch_prop_casino_bin_01a`, `vw_prop_vw_casino_bin_01a`, `mp_b_kit_bin_01`, `prop_recyclebin_04_b`,
    },
    chances = {
        findItem = 80, --chance to find item or nothing at all
        dirtyNeedle = 10, -- chance to get pricked by a dirty needle and loose health
        money = 10, -- chance to find cash when searching
        cashAmount = math.random(100,250), -- cash amount found
    },
    target = {
        icon = 'fa-solid fa-recycle', -- target icon
        label = 'Search Bin', -- target label
        distance = 3.0, -- target distance
    },
    cooldown = { -- cooldown settings handled server side
        enabled = true, -- enable search cooldown
        duration = 2500, -- duration for cooldown
        sameBinSearch = 60000, -- duration before can search same bin again
    },
    progress = { -- progressCircle settings
        duration = 10000, -- duration to search bin
        label = 'Searching through rubbish', -- label
        anim = { -- animation settings
            dict = 'mp_car_bomb', -- anim dict name
            clip = 'car_bomb_mechanic', -- anim clip name
            flag = 49, -- anim flag number
        },
    },
    rewards = { -- rewards given from searching bins
        --name is item name
        --amount is amount given
        --one item will be picked from this list as a reward
        {name = 'iron',         amount = math.random(1,4) },
        {name = 'plastic',      amount = math.random(1,4) },
        {name = 'rubber',       amount = math.random(1,4) },
        {name = 'glass',        amount = math.random(1,4) },
        {name = 'steel',        amount = math.random(1,4) },
        {name = 'aluminum',     amount = math.random(1,4) },
        {name = 'copper',       amount = math.random(1,4) },
        {name = 'recyclebox',   amount = math.random(1,4) },
    },
}
```
