> For the complete documentation index, see [llms.txt](https://docs.hyper-code.eu/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyper-code.eu/documentation/all-in-one-peds/config.md).

# Premium Ped System – Configuration

All options in shared/config.lua of Premium Ped System: loot callback, pickup animation, ped groups, aggro levels, item drops and static peds.

All settings are in `shared/config.lua`. This file is not escrowed. You can create as many groups and peds as you want.

## Loot callback

`Config.ItemDropCallback` runs on the server when a player picks up loot. The default gives the item with ESX:

```lua
Config.ItemDropCallback = function(source, type, item, count)
    local ESX = exports['es_extended']:getSharedObject()
    local xPlayer = ESX.GetPlayerFromId(source)

    if type == "item" then
        xPlayer.addInventoryItem(item, count)
    elseif type == "weapon" then
        xPlayer.addWeapon(item, count) -- count = ammo
    end
end
```

| Parameter | Description                                    |
| --------- | ---------------------------------------------- |
| `source`  | Server ID of the player who picked up the loot |
| `type`    | `"item"` or `"weapon"` (from `ItemDrops`)      |
| `item`    | Item or weapon name                            |
| `count`   | `amount` from `ItemDrops` (for weapons: ammo)  |

Replace the body with the functions of your framework or inventory if you do not use ESX.

## Pickup animation

```lua
Config.PickupAnim = {
    Animation = "pickup_low",
    Lib = "random@domestic"
}
```

Played when a player loots a dead ped.

## Ped groups

`Config.Groups` is keyed by a group name. Every group has `Defaults` and a list of `Peds`.

```lua
Config.Groups = {
    ["Grove"] = {
        Defaults = {
            Weapon = "WEAPON_MICROSMG",
            AggroLevel = 4,
            Accuracy = 15,
            Armour = 0,
            RespawnSeconds = -1,
            GroupCenterCoords = vector3(103.3628, -1939.7953, 20.8037),
            ItemDrops = {
                {type = "item", name = "case", amount = 1, chance = 5},
            }
        },
        Peds = {
            { coords = vector3(116.9127, -1927.4237, 20.7443), heading = 133.513, model = 'csb_ramp_gang', Weapon = "WEAPON_SMG", Armour = 100 },
            { coords = vector3(98.6607, -1930.4003, 20.7744), heading = 227.5839, model = 'csb_ramp_gang' },
        }
    },
}
```

### Group defaults

| Option              | Example             | Per ped | Description                                                                  |
| ------------------- | ------------------- | ------- | ---------------------------------------------------------------------------- |
| `Weapon`            | `"WEAPON_MICROSMG"` | yes     | Weapon of the peds (infinite ammo)                                           |
| `Accuracy`          | `15`                | yes     | Accuracy of the peds, `0`–`100`                                              |
| `Armour`            | `0`                 | yes     | Armour of the peds, `0`–`100`                                                |
| `ItemDrops`         | see below           | yes     | Loot table                                                                   |
| `AggroLevel`        | `4`                 | no      | Relationship of the group towards players, see [Aggro levels](#aggro-levels) |
| `RespawnSeconds`    | `-1`                | no      | Seconds until a dead ped respawns. `-1` = never                              |
| `GroupCenterCoords` | `vector3(...)`      | no      | Centre of the group. Use the position of one ped of the group.               |

Options marked **Per ped** can be set on a single ped entry to override the group default. `AggroLevel`, `RespawnSeconds` and `GroupCenterCoords` are always taken from `Defaults`.

### Ped entries

| Field                                       | Description                              |
| ------------------------------------------- | ---------------------------------------- |
| `coords`                                    | `vector3` spawn position                 |
| `heading`                                   | Heading                                  |
| `model`                                     | Ped model name                           |
| `Weapon`, `Accuracy`, `Armour`, `ItemDrops` | Optional overrides of the group defaults |

Peds are set up for a player as soon as the player is within **500 m** of `GroupCenterCoords`.

### Aggro levels

| Value | Meaning                |
| ----- | ---------------------- |
| `0`   | Companion              |
| `1`   | Respect                |
| `2`   | Like                   |
| `3`   | Neutral                |
| `4`   | Dislike                |
| `5`   | Hate (attacks players) |

### Item drops

```lua
ItemDrops = {
    {type = "item",   name = "bread",               amount = 1,   chance = 25},
    {type = "weapon", name = "WEAPON_ASSAULTRIFLE", amount = 150, chance = 50},
}
```

| Field    | Description                |
| -------- | -------------------------- |
| `type`   | `"item"` or `"weapon"`     |
| `name`   | Item or weapon name        |
| `amount` | Amount (for weapons: ammo) |
| `chance` | Chance in percent          |

A dead ped drops **at most one** entry. If all chances add up to less than 100, the rest is the chance for no drop (example above: 25 % bread, 50 % rifle, 25 % nothing). If they add up to 100 or more, an entry always drops and the chances act as weights.

Players see **Press E to loot item** near the body and pick it up within 2 m.

## Static peds

Static peds are frozen, invincible and ignore everything around them.

```lua
Config.StaticPeds = {
    {
        coords = vector3(222.8386, 205.9472, 104.5159),
        heading = 167.9034,
        model = 'csb_prolsec',
        animLib = "mp_player_inteat@burger", -- optional
        anim = "mp_player_int_eat_burger_fp" -- optional
    }
}
```

| Field             | Description                                                         |
| ----------------- | ------------------------------------------------------------------- |
| `coords`          | `vector3` position                                                  |
| `heading`         | Heading                                                             |
| `model`           | Ped model name                                                      |
| `animLib`, `anim` | Optional animation dictionary and name. Leave out for no animation. |
