# Configuration

This document explains the configuration settings for the crew system in your FiveM server. Use this as a reference to understand and customize the behavior of the system.

***

### General Settings

#### Config.framework

Defines the framework used in your server.

* **Options:** `QB`, `ESX`
* **Default:** `QB`

```lua
Config.framework = "QB"
```

Specifies the gang script used to determine gang affiliations.

* **Supported Values:**
  * `QB`: Uses QB-Core's built-in gang system.
  * `ESXJOBS`: Uses ESX job system.
  * `RCORE`, `C8RE`, `AK47`, `T1GER`, `GUILLE`: Third-party scripts.
  * `OTHER`: For custom gang scripts; configure events in `server/editable_functions.lua`.
* **Default:** `QB`

```lua
Config.gangScript = "QB"
```

#### Config.language

Sets the language used in menus and notifications.

* **Default:** `English`

```lua
Config.language = English
```

#### Config.debug

Enables or disables debug logs in the console.

* **Options:** `true`, `false`
* **Default:** `false`

```lua
Config.debug = false
```

***

### Gang Groups

The `Config.groups` table holds the configuration for different AI gangster groups.

#### Common Properties

* **name:** Name identifier for the group.
* **gang:** Gang affiliation.
* **spawns:** Array of spawn points (with position and heading) for the NPCs.
* **outfit:** Array of outfit names for NPCs.
* **useCustomModel:** Boolean to specify whether to use a custom NPC model.
* **customModel:** Custom model name (if `useCustomModel` is `true`).
* **weaponFire:** Weapon for ranged attacks.
* **weaponMelee:** Weapon for melee attacks.
* **weaponDefault:** Default weapon mode (`FIRE`, `MELEE`, `UNARMED`).
* **followLeadWeapon:** Boolean to determine if NPCs follow the player’s weapon level.
* **health:** NPC health.
* **precision:** Shooting precision (0-100).
* **drivingSpeed:** Target driving speed when NPC is chauffeuring.
* **combatStyle:** Combat movement behavior (`defensive`, `offensive`).

#### Example Groups

**Group 1: Stub City**

```lua
{
    name = "Stub City",
    gang = "lostmc",
    spawns = {
        vector4(53.4545, 3642.3967, 39.5725, 278.5718),
        vector4(53.9219, 3644.2827, 39.6071, 210.8582),
        vector4(52.7403, 3637.2991, 39.6196, 274.9316)
    },
    outfit = {"BIKER1", "BIKER2"},
    useCustomModel = false,
    customModel = "g_m_y_lost_02",
    weaponFire = "weapon_pistol",
    weaponMelee = "weapon_machete",
    weaponDefault = "FIRE",
    followLeadWeapon = true,
    health = 200,
    precision = 85,
    drivingSpeed = 50.0,
    combatStyle = 'offensive',
},
```

**Additional Groups**

Repeat the structure for additional gang groups. Example configurations include:

* **Ballas:** `"gang = 'ballas'"`
* **Vagos:** `"gang = 'vagos'"`
* **Families:** `"gang = 'families'"`
* **Marabunta Grande:** `"gang = 'marabunta'"`
* **Triads:** `"gang = 'triads'"`

To add more groups, append them to the `Config.groups` array following the format above. Customize as needed to fit your server's requirements.

***

### Key Binds

**Config.recruitMember**

Key to recruit members into your crew.

* **Default:** `E`

```lua
Config.recruitMember = "E"
```

**Config.openMenu**

Key to open the crew menu.

* **Default:** `N`

```lua
Config.openMenu = "N"
```

#### Automatic Defense

**Config.autoDefend**

Automatically defends the gang's territory when enemies enter and no allies are nearby.

* **Default:** `true`

```lua
Config.autoDefend = true
```

**Config.useAllies**

Specifies whether alliances between gangs should be considered.

* **Default:** `false`

```lua
Config.useAllies = false
```

**Config.allies**

Defines gang alliances. If listed, allied gangs will not trigger automatic defense.

```lua
Config.allies = {
    {"BALLAS", "VAGOS"},  -- BALLAS and VAGOS are allies
    {"VAGOS", "LOSTMC"}   -- VAGOS and LOSTMC are allies
}
```

#### Cooldown Time

**Config.cooldownTime**

Cooldown duration (in seconds) before NPC gangster respawn after death or dismissal.

```lua
Config.cooldownTime = 60
```

#### Damage Behavior

**Config.sufferHeadshot**

Determines whether NPC gangsters are affected by headshot damage.

```lua
Config.sufferHeadshot = false
```

**Config.ragdoll**

Determines whether NPC gangsters can ragdoll when pushed or shot.

* **Default:** `false`

```lua
Config.ragdoll = false
```

#### Driving Style

**Config.customDrivingStyle**

Custom driving style for NPC gangster drivers.

* **Default:** `0`

```lua
Config.customDrivingStyle = 0
```

#### Formation

**Config.defaultFormation**

Defines the formation for gangster movement.

* **Options:**
  * `0`: Freedom to move
  * `1`: Circle Around Leader (Look In)
  * `2`: Circle Around Leader (Look Out)
  * `3`: Line, with Leader at the center
  * `4`: Line Follow Formation
* **Default:** `0`

```lua
Config.defaultFormation = 0
```

#### Weapon Configurations

**Config.nonBackupNeededWeapons**

List of weapons that do not trigger gangster engagement.

```lua
Config.nonBackupNeededWeapons = {
    "WEAPON_Grenade", 
    "WEAPON_StickyBomb", "WEAPON_ProximityMine", "WEAPON_BZGas", "WEAPON_Molotov", "WEAPON_FireExtinguisher", 
    "WEAPON_PetrolCan", "WEAPON_Flare", "WEAPON_Ball", "WEAPON_Snowball", "WEAPON_SmokeGrenade"
    -- Add more weapons to the blacklist as necessary
}
```

#### Blacklisted Zones

**Config.useBlacklistedZones**

Determines whether to enable blacklisted zones.

* **Default:** `false`

```lua
Config.useBlacklistedZones = false
```

**Config.blacklistedZones**

Defines restricted areas where AI gangsters are dismissed upon entry.

```lua
Config.blacklistedZones = {
    {
        name = "Cayo",  -- Name of the zone for easier identification
        northwest = {x = 3667.6230, y = -4227.0049},  -- Northwest corner (top-left)
        southeast = {x = 5863.0356, y = -6076.5122},  -- Southeast corner (bottom-right)
        minZ = 0.0,  -- Minimum height (z value)
        maxZ = 100.0 -- Maximum height (z value)
    },
    {
        name = "Paletto",  -- Name of the zone for easier identification
        northwest = {x = -1298.5864, y = 7074.6636},  -- Northwest corner (top-left)
        southeast = {x = 845.3663, y = 5729.2217},  -- Southeast corner (bottom-right)
        minZ = 0.0,  -- Minimum height (z value)
        maxZ = 100.0 -- Maximum height (z value)
    }
}
```

#### Config.outfits

Defines predefined outfits for different characters or gangs. Each outfit includes specifications for gender, skin type, hair, beard, clothing, and gear.

**Example Configuration**

```lua
Config.outfits = {
    ["PURPLE1"] = {
        gender = "male", -- male or female
        skin = "dark", -- dark or light or random
        hairs = {0, 0, 0, 0, 1, 2, 3, 4, 5},
        beards = {0, 0, 0, 0, 1, 2, 3, 4, 5},
        clothing = {
            MASK = {
                { clothingItem = 51, textureId = 6 },
                { clothingItem = -1, textureId = 0 }
                },
            ACCESSORIES = { clothingItem = -1, textureId = 0 },
            UPPER = { -- Random Item 
                { clothingItem = 0, textureId = 0 },
                { clothingItem = 74, textureId = 0 },
            },
            LOWER = { clothingItem = 117, textureId = 9 },
            SHOES = { clothingItem = 6, textureId = 0 },
            UNDERSHIRT = { clothingItem = 15, textureId = 0 },
            KEVLAR = { clothingItem = -1, textureId = 0 },
            BADGE = { clothingItem = -1, textureId = 0 },
            JACKET = { clothingItem = 350, textureId = 0 },
        },
        gear = {
            HAT = { -- Random Item 
                { clothingItem = -1, textureId = 0 },
            },
            GLASSES = { -- Random Item 
                { clothingItem = -1, textureId = 0 },
                { clothingItem = 7, textureId = 0 },
            },
            EARS = { clothingItem = -1, textureId = 0 },
        }
    }
    }
```

### Advanced configuration

#### Core framework

Specifies the core object used from a QBCore-based framework.

\- If you are using a QBCore-based framework, this value does not require modification.

\- Compatible with default QBCore and ESX frameworks.

```lua
Config.core = 'qb-core'
```

***

#### **Menu Framework**

* **Description**: Defines the menu framework used in the script.
* **Default Value**: `'qb-menu'`
* **Options**:
  * `'ox'`
  * `'esx'`
  * `'qb-menu'`
* **Notes**:
  * Update this value based on your menu framework preference.

```lua
Config.coremenu = 'qb-menu'
```

***

#### **Menu Position**

* **Description**: Determines the position of the menu on the screen for ESX and `ox_lib` menus.
* **Default Value**: `'top-left'`
* **Options**:
  * `'top-left'`
  * `'top-right'`
  * `'bottom-left'`
  * `'bottom-right'`
* **Notes**:
  * This setting is applicable only for ESX and `ox_lib` menus.
  * Ensure the position is suitable for your interface layout.

```lua
Config.positionmenu = 'top-left'
```

***

#### **Server Tick**

* **Description**: Defines the server tick interval for the script.
* **Default Value**: `1000`
* **Notes**:
  * It is recommended **not to change** this value for optimal performance.

```lua
Config.serverTick = 1000
```

***

### Notes

For advanced configurations, modify the editable files in accordance with your server's requirements.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enyo-scripts.gitbook.io/documentations/fivem-scripts/ai-gangs/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
