> For the complete documentation index, see [llms.txt](https://oph3zdev.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oph3zdev.gitbook.io/docs/paid-scripts/inventory/configuration/sling.md).

# Sling

Everything in <mark style="color:$primary;">config/sling.lua</mark>. The sling shows a player's carried weapons visibly on their body - a rifle on the back, a stun gun on the thigh - for everyone nearby.

### Master settings

* `enabled` - `false` = nothing is ever shown on the body.
* `command` - `/sling` toggles, `/sling back` or `/sling front` picks the side directly.
* `defaultSide` - the side used until a player picks their own.
* `distance` - meters within which other players' slings are drawn.

```lua
Config.Sling = {
    enabled = false,
    command = "sling",
    defaultSide = "back",
    distance = 30.0,
    spots = { ... },
    groups = { ... },
    weapons = { ... }
}
```

### Spots

Where weapons sit on the body. Each spot has a `back` and a `front` position - a bone id plus position and rotation offsets. Three spots ship: `long` (rifles and other two handed weapons), `sidearm` (thigh) and `melee` (belt).

```lua
spots = {
    long = {
        back = { bone = 24818, pos = vector3(0.1, -0.16, -0.05), rot = vector3(0.0, 175.0, 5.0) },
        front = { bone = 24818, pos = vector3(-0.12, 0.19, -0.02), rot = vector3(0.0, 185.0, 5.0) }
    },
    sidearm = {
        back = { bone = 51826, pos = vector3(0.06, 0.02, -0.16), rot = vector3(-90.0, 0.0, 0.0) },
        front = { bone = 51826, pos = vector3(0.06, 0.02, -0.16), rot = vector3(-90.0, 0.0, 0.0) }
    },
    melee = {
        back = { bone = 24818, pos = vector3(-0.16, -0.14, 0.1), rot = vector3(0.0, 180.0, 340.0) },
        front = { bone = 51826, pos = vector3(-0.06, 0.04, -0.14), rot = vector3(-90.0, 0.0, 180.0) }
    }
}
```

### Groups

Which weapon group uses which spot. A group that is not listed is never shown - the shipped config shows long guns and stun guns but keeps pistols and melee hidden, uncomment them to show those too.

```lua
groups = {
    GROUP_RIFLE = "long",
    GROUP_SHOTGUN = "long",
    GROUP_SNIPER = "long",
    GROUP_MG = "long",
    GROUP_SMG = "long",
    GROUP_HEAVY = "long",
    -- GROUP_PISTOL = "sidearm",
    GROUP_STUNGUN = "sidearm",
    -- GROUP_MELEE = "melee"
}
```

### Per weapon corrections

Fine tune a single weapon when it sits slightly off. Only the fields you set are overridden.

```lua
weapons = {
    -- weapon_pistol = { back = { pos = vector3(0.06, 0.02, -0.14) } }
}
```
