# Configuration

This section outlines customizable parameters for the **AI Mechanic and Towing System,** designed for ESX, qb-core, or standalone frameworks, it balances flexibility and realism. Configure AI behavior, pricing, locations, roleplay rules, and third-party integrations.

***

### Player Commands

| Command       | Description           | Client Event              |
| ------------- | --------------------- | ------------------------- |
| /mech         | Summon AI mechanic    | enyo-aimechanic:call      |
| /cancelmech   | Cancel active service | enyo-aimechanic:cancel    |
| /tow (Police) | Police-requested tow  | enyo-aimechanic:policeTow |

**Features**:

·        `Config.callAnimation = true` enables phone animation during summons

·        60-second cooldown between requests (`Config.commandsCooldown`)

***

### Service Costs

```lua
Config.Bill = 1000          -- Base service fee
```

```lua
Config.BillForHeli = true   -- Helicopter recovery adds extra charge
```

·        💸 Billing system compatible with ESX/qb-core economies

·        Standalone mode requires custom payment implementation

***

### Vehicle & NPC Models

| Role                | Model                  | Notes                      |
| ------------------- | ---------------------- | -------------------------- |
| Mechanic NPC        | s\_m\_y\_xmech\_02\_mp | Default GTA mechanic model |
| Standard Tow Truck  | towtruck               | Civilian towing            |
| Police Tow Truck    | towtruck2              | Illegal/police operations  |
| Recovery Helicopter | cargobob               | Livery index 0 (default)   |

**Helicopter Settings**:

```lua
Config.HeliEnabled = true
Config.HeliPickup = "hook"  -- 'magnet' or 'hook' attachment
Config.MaxSpeed = 13.0      -- Flight speed (higher = riskier)
```

***

### Repair Modes

```lua
Config.fixMode = "auto"  -- Options: 'auto', 'garage', 'onplace'
```

| Mode    | Behavior                                               |
| ------- | ------------------------------------------------------ |
| Auto    | On-site repair attempt → Tow if damage below threshold |
| Garage  | Always tow to garage (even for minor damage)           |
| Onplace | Full repairs at current location (no towing)           |

**Towing Thresholds**:

```lua
Config.minEngineHealthToTow = 800.0  -- 0-1000 scale
Config.minBodyHealthToTow = 800.0    -- 0-1000 scale
```

***

### Mechanic Job Management

```lua
Config.useMaxMechanics = true   -- Enable human mechanic priority
Config.MaxMechanics = 5         -- AI disabled if ≥5 human mechs online
Config.JobMechanic = 'lscustom' -- Your server's mechanic job name
```

***

### Garage Locations

```etlua
Config.mechanics = {
    {
        parking = vector3(-370.14, -114.34, 38.05),  -- Spawn coordinates
        goToPlatform = false,  -- Teleport to repair platform? (Not recommended)
        platform = vector3(-337.46, -137.74, 39.01)  -- Repair location
    },
    -- Add mulyiple garage locations if needed
}
```

***

### Police & Admin Permissions

```lua
Config.TowingPermission = {
    jobs = {"police", "sheriff"},        -- Authorized job names
    groups = {"admin", "superadmin"},    -- Admin groups
    identifiers = {"steam:..."}          -- Standalone mode IDs
}
```

***

### Restricted Zones

#### 🚫 No-Parking Zones (Auto-Tow)

```lua
Config.useNoParkingZones = true
```

**Example Zone**:

```lua
{
    name = "Hospital Parking",
    northwest = {x=268.18, y=-536.34}, 
    southeast = {x=370.70, y=-648.13},
    whitelistedModels = {"ambulance"}  -- Allowed vehicles
}
```

#### 🚁 Air-Only Zones

```lua
Config.useOnlyAirZones = true
Config.safePlaceOutOfAirZones = vector3(-425.58, -253.43, 36.24)
```

·        Helicopter required for vehicles in these zones

·        Replace vehicle from only air zone to safe location to be towed

***

### Notifications & UI

**Preconfigured Messages**:

```lua
Config.notifications = {
    ["Towtruck"] = "🚚 Tow truck en route!",
    ["Cooldown"] = "⏳ Wait %d seconds!"  -- %d = cooldown timer
}
```

***

### Advanced Settings

#### 🏎️ Driving Behavior

```lua
Config.customDrivingStyle = 525092  -- GTA driving style flag
Config.maxSpawnDistance = 160.0     -- Max NPC spawn range
```

#### 🐞 Debug Mode

```lua
Config.debug = false  -- Enable diagnostic logging
```


---

# 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-mechanic-and-towing/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.
