> For the complete documentation index, see [llms.txt](https://docs.lostdev.store/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lostdev.store/territories/configuration.md).

# Configuration

All global configuration lives in `config/config.lua`. Per-territory values can override these defaults in `config/territories.lua`.

## `Config.Debug` / `Config.Locale`

```lua
Config.Debug  = false -- enables extra debug logging (client + server console)
Config.Locale = 'en'  -- locale file to load from config/locales/ ('en' | 'pt')
```

## `Config.Framework`

```lua
Config.Framework = {
    type     = 'qbx',  -- 'qbcore' | 'qbx' | 'esx' | 'standalone' (nil = auto-detect)
    resource = nil,     -- only needed if auto-detection fails
}
```

Defines which framework is used to fetch player identity (job/gang). If `type` is `nil`, the bridge tries to auto-detect based on the resources currently running (`qb-core`, `qbx_core`, `es_extended`).

## `Config.Identity`

```lua
Config.Identity = {
    provider = 'framework', -- 'framework' | 'custom'
    custom = {
        GetPlayerGroup = nil, -- function(source) return groupName end
        GetGroupColor  = nil, -- function(groupName) return '#RRGGBB' end
        GetGroupLabel  = nil, -- function(groupName) return 'Pretty Name' end
    },
}
```

Lets you completely replace the source of a player's "faction" with your own logic (for example, a custom faction system instead of the framework's gang/job).

## `Config.Zones`

```lua
Config.Zones = {
    drawDebug       = false, -- draws a 3D marker + text over each territory
    debugLineHeight = 0.3,   -- height of the debug text above the marker (meters)
}
```

Only has an effect with `Config.Debug = true`.

## `Config.Admin`

```lua
Config.Admin = {
    enabled            = true,
    permission         = 'territories.admin', -- ACE permission (fallback)
    allowZoneCreation  = true,
    allowZoneDeletion  = true,
    defaultZoneRadius  = 60.0,
    logChanges         = true, -- logs admin actions to history (shield icon in the tablet)
    allowedGroups = {
        'admin', 'superadmin', 'god', 'mod', 'moderator',
    },
}
```

Controls access and capabilities of the tablet's **ADMIN** tab. See full details in [Admin Panel](/territories/admin-panel.md).

## `Config.Persistence`

```lua
Config.Persistence = {
    enabled      = true,
    saveInterval = 30000, -- ms between autosaves
    autoSave     = true,
    saveOnStop   = true,  -- saves everything when the resource is stopped/restarted
}
```

## `Config.Capture`

```lua
Config.Capture = {
    enabled             = true,
    captureTime         = 300,     -- seconds for a full capture (1 attacker)
    requirePlayerInside = true,
    resumeProgress      = true,    -- resumes progress instead of restarting
    leaveBehavior       = 'pause', -- 'pause' | 'regenerate' | 'reset'
    regenerateDelay     = 5,
    regenerateRate      = 0.5,     -- % of progress lost per second (after regenerateDelay)
}
```

`leaveBehavior` defines what happens when nobody is inside the zone:

| Value        | Behavior                                                             |
| ------------ | -------------------------------------------------------------------- |
| `pause`      | Progress stays frozen wherever it was.                               |
| `regenerate` | Slowly reverts to the initial state (`regenerateRate`/s).            |
| `reset`      | Immediately snaps back to the current owner's progress (100% or 0%). |

## `Config.PlayerScaling`

```lua
Config.PlayerScaling = {
    enabled      = true,
    maxAttackers = 5,
    multipliers = {
        [1] = 1.0, [2] = 1.3, [3] = 1.5, [4] = 1.7, [5] = 1.9,
    },
}
```

Multiplies capture speed based on the number of simultaneous attackers (up to `maxAttackers`).

## `Config.Contested`

```lua
Config.Contested = {
    enabled = true,
    ui = {
        enabled              = true,
        style                = 'gradient',
        showFactions         = true,
        showProgress         = false,
        maxDisplayedFactions = 3,
    },
}
```

## `Config.Cooldown`

```lua
Config.Cooldown = {
    enabled      = true,
    duration     = 900, -- seconds
    blockCapture = true,
    showInUI     = true,
}
```

## `Config.Rewards`

```lua
Config.Rewards = {
    enabled  = true,
    interval = 60000, -- ms between periodic payouts
    provider = 'framework', -- 'framework' | 'custom'
    custom = {
        OnReward = nil, -- function(source, territoryId) ... end
    },
}
```

{% hint style="info" %}
Per-capture rewards (money/items/XP) defined per territory in `territories.lua` are delivered via `Capture.GiveRewards`. `Config.Rewards.interval` is intended for an additional periodic payout system (custom integration via `OnReward`).
{% endhint %}

## `Config.Notifications`

```lua
Config.Notifications = {
    system = 'ox', -- 'ox' | 'native' | 'custom'
    types = { info = 'info', success = 'success', error = 'error', warning = 'warning' },
}
```

## `Config.Blips`

```lua
Config.Blips = {
    enabled     = true,
    showRadius  = true,
    radiusAlpha = 60,
    global = { scale = 0.7, shortRange = true, route = false },
    sprites = { neutral = 84, contested = 227, cooldown = 84 },
    stateSprites = true,       -- false = always uses sprites.neutral
    gangColoredRadius = true,  -- colors the radius using the owning gang's color
    gangColors = {
        -- ballas = 27,
        -- vagos  = 5,
    },
    contestedColorCycle = { enabled = true, interval = 1000 },
    blacklist = { enabled = false, jobs = {}, gangs = {} },
}
```

Factions not listed in `gangColors` get a deterministic color (stable hash of the name), so every faction always has a consistent color without manual configuration.

## `Config.UI`

```lua
Config.UI = {
    enabled        = true,
    position       = 'top-right',
    updateInterval = 100,
    showWhenInside = true,
    fadeTimeout    = 5000,
    tabletCommand  = 'territories', -- chat/console command
    tabletKeybind  = 'F6',
}
```

## `Config.Alerts`

```lua
Config.Alerts = {
    enabled           = true,
    bannerDuration    = 7000, -- ms the "UNDER ATTACK" banner stays visible
    blipFlashDuration = 8000, -- ms the territory's blip flashes for
}
```

## `Config.Sounds`

```lua
Config.Sounds = {
    enabled = true,
    tabletOpen  = { name = 'Nav_Up_Down',    set = 'HUD_FRONTEND_DEFAULT_SOUNDSET' },
    tabletClose = { name = 'Nav_Left_Right', set = 'HUD_FRONTEND_DEFAULT_SOUNDSET' },
    tabSwitch   = { name = 'NAV_LEFT_RIGHT', set = 'HUD_FRONTEND_DEFAULT_SOUNDSET' },
    underAttack = { name = '5_SEC_WARNING',  set = 'HUD_MINI_GAME_SOUNDSET' },
    captureWon  = { name = 'MEDAL_UP',       set = 'HUD_AWARDS' },
    captureLost = { name = 'Lose_1st_Place', set = 'GTAO_FM_Events_Soundset' },
}
```

Native GTA V sounds only (`PlaySoundFrontend`) — no custom audio files required.

## `Config.Logging`

```lua
Config.Logging = {
    enabled = false,
    discord = {
        enabled = false,
        webhook = '', -- keep out of source control
        events = {
            captureStarted = true, captureCompleted = true, ownerChanged = true,
            contested = true, cooldownStarted = true,
        },
    },
    console = { enabled = true, level = 'info' },
}
```

## `Config.Security`

```lua
Config.Security = {
    minEventInterval    = 100,  -- minimum ms between events from the same player (anti-spam)
    maxSimultaneousCaps = 1,    -- max territories a player can capture at once
    validateInterval    = 1000, -- ms between server-side position/state validations
    antiExploit         = true,
}
```

## `Config.Performance`

```lua
Config.Performance = {
    checkInterval      = 500,  -- ms of the client proximity loop and the TerritoryManager tick
    adaptiveProcessing = true,
    maxNuiUpdates      = 30,   -- limit of NUI updates per minute
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.lostdev.store/territories/configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
