> 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/installation.md).

# Installation

## Prerequisites

* [`ox_lib`](https://github.com/overextended/ox_lib) (required)
* [`oxmysql`](https://github.com/overextended/oxmysql) (required)
* `qbx_core`, `qb-core`, or `es_extended` — optional; the resource also works in standalone mode.

## Resource placement

Place the `ld_territories` folder into your server's `resources` directory.

## Server configuration

Add these lines to your `server.cfg`:

```cfg
ensure ox_lib
ensure oxmysql
# ensure qbx_core   -- or qb-core / es_extended, depending on your framework
ensure ld_territories
```

{% hint style="warning" %}
Startup order matters — `ld_territories` must start **after** `ox_lib`, `oxmysql`, and your framework.
{% endhint %}

## Database setup

Tables are created automatically on first start — no manual SQL required. An `install.sql` file is included if you prefer to run the schema yourself ahead of time.

## Framework configuration

In `config/config.lua`:

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

Leaving `type = nil` auto-detects the framework currently running on your server.

## Territory configuration

Edit `config/territories.lua` to define your zones, coordinates, allowed gangs, and rewards. The file ships with 4 example territories, ready to customize or delete.

## Admin access

Set up who can use the tablet's ADMIN tab — see [Admin Panel](/territories/admin-panel.md) for the full guide.

## Testing

{% stepper %}
{% step %}

### Start your server

Confirm initialization in the console.
{% endstep %}

{% step %}

### Enter a configured zone

The territory HUD should appear.
{% endstep %}

{% step %}

### Open the tablet

Use `/territories` or **F6**.
{% endstep %}
{% endstepper %}


---

# 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/installation.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.
