> For the complete documentation index, see [llms.txt](https://docs.tworst.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tworst.com/getting-started-installation/admin-menu/admin-menu/installation.md).

# Installation

Step-by-step guide to install the **Tworst Admin Menu** in-game resource on your FiveM server.

{% hint style="info" %}
This page covers the **in-game script** only. To use the cloud panel, see [Web Panel (Tworst Cloud)](/getting-started-installation/admin-menu/admin-menu/web-panel.md). To set up the Discord bot, see [Discord Bot](/getting-started-installation/admin-menu/admin-menu/discord-bot.md).
{% endhint %}

***

## Prerequisites

Before installing, make sure you have:

| Requirement      | Description                                 |
| ---------------- | ------------------------------------------- |
| **Framework**    | QBCore or ESX                               |
| **oxmysql**      | Required — must start before `tw-adminmenu` |
| **FiveM Server** | Recent artifact build recommended           |

***

## Step 1: Download the Script

### From Cfx.re Portal (Recommended)

1. Go to [portal.cfx.re](https://portal.cfx.re)
2. Navigate to **Granted Assets**
3. Find **tw-adminmenu** in your purchased assets
4. Click **Download** to get the latest version

***

## Step 2: Extract Files

1. Extract the downloaded archive
2. Place the **`tw-adminmenu`** folder in your server's `resources` directory

***

## Step 3: Database Setup

{% hint style="success" %}
**Automatic Setup:** With `TW.AutoSql = true` (default), the script automatically creates and migrates all required database tables on first start. No manual SQL import needed.
{% endhint %}

If you prefer a manual import (or disabled auto-migration), run the included `sql/install.sql` against your database.

***

## Step 4: Configure the Framework

Open `shared/config.lua` and set your framework and language:

```lua
TW.Framework = "QBCore"   -- "QBCore" or "ESX"
TW.Locale = "en"          -- en, tr, de, fr, es, pt, ru, pl, nl, it, ro, ar
TW.AutoSql = true         -- Auto-create/migrate database tables
```

{% hint style="info" %}
**QBox users:** set `TW.Framework = "QBCore"` — QBox is QBCore-compatible.
{% endhint %}

{% hint style="info" %}
Most other integrations (inventory, garage, fuel, vehicle keys, clothing, jail, etc.) are left on `"auto"` and detected automatically. See [Configuration](/getting-started-installation/admin-menu/admin-menu/configuration.md) for all options.
{% endhint %}

***

## Step 5: Grant First (God) Access

Before anyone can use the menu, give yourself **God** access so you can manage staff and roles in-game.

In `shared/config.lua`:

```lua
TW.GodRole = "owner"            -- The top-tier role name
TW.GodIdentifiers = {
    "fivem:1234567",            -- your fivem: id
    "discord:123456789012345",  -- and/or your discord: id
}
```

{% hint style="warning" %}
Add **your own** identifier here first. Anyone listed in `TW.GodIdentifiers` is automatically provisioned with the God role and full access on join.
{% endhint %}

***

## Step 6: Discord Token & Webhooks

For full functionality, configure your Discord integrations in `shared/server_config.lua` and `shared/webhooks.lua`.

### Discord Bot Token

Set your Discord bot token so the panel can resolve Discord avatars and member/role info:

```lua
-- shared/server_config.lua
TW_Server.DiscordBotToken = "YOUR_DISCORD_BOT_TOKEN"
```

{% hint style="warning" %}
Without a valid `DiscordBotToken`, Discord avatars and role/member lookups won't work. The token must belong to a bot that is **in your Discord server**.
{% endhint %}

### Logging Webhooks

Open `shared/webhooks.lua` and fill in a webhook URL for **every** log category you want recorded. Anything left blank falls back to `default` — and if `default` is also empty, those logs are **not sent anywhere**.

```lua
-- shared/webhooks.lua
TW_Webhooks.enabled = true
TW_Webhooks.urls = {
    punishments = "https://discord.com/api/webhooks/...",
    player      = "https://discord.com/api/webhooks/...",
    inventory   = "https://discord.com/api/webhooks/...",
    economy     = "https://discord.com/api/webhooks/...",
    vehicles    = "https://discord.com/api/webhooks/...",
    staff       = "https://discord.com/api/webhooks/...",
    server      = "https://discord.com/api/webhooks/...",
    world       = "https://discord.com/api/webhooks/...",
    tickets     = "https://discord.com/api/webhooks/...",
    spectate    = "https://discord.com/api/webhooks/...",
    notes       = "https://discord.com/api/webhooks/...",
    troll       = "https://discord.com/api/webhooks/...",
    security    = "https://discord.com/api/webhooks/...",
    default     = "https://discord.com/api/webhooks/...",  -- catch-all fallback
}
```

{% hint style="danger" %}
**Don't skip this.** If you leave webhooks empty, admin actions in those categories won't be logged to Discord and you'll have gaps in your audit trail. At minimum, set the `default` webhook so nothing is lost.
{% endhint %}

{% hint style="info" %}
A quick way to cover everything: set `default` first, then add dedicated channels for the categories you care most about (e.g. `punishments`, `economy`, `security`). See the full reference in [Configuration → webhooks](/getting-started-installation/admin-menu/admin-menu/configuration.md#shared-webhooks-lua).
{% endhint %}

***

## Step 7: Add to server.cfg

Add the following to your `server.cfg`:

```cfg
# Dependencies (must start before tw-adminmenu)
ensure oxmysql
ensure qb-core          # or es_extended (your framework)

# Tworst Admin Menu
ensure tw-adminmenu

# Required ACE permissions (for server commands & profiler)
add_ace resource.tw-adminmenu command allow
add_ace resource.tw-adminmenu command.profiler allow
```

{% hint style="warning" %}
**Load Order:** `oxmysql` and your framework must start **before** `tw-adminmenu`.
{% endhint %}

{% hint style="info" %}
The `add_ace` lines let the Admin Menu run server commands and the profiler (used by the dashboard/console features). Add them or those tools won't work.
{% endhint %}

***

## Step 8: Restart & Open the Menu

1. Save all configuration changes
2. Restart your server completely
3. Join the server with an account listed in `TW.GodIdentifiers`
4. Open the admin menu (use your configured keybind/command — you can also bind a key in the FiveM **Settings → Key Bindings → FiveM** menu)

{% hint style="success" %}
On first open, the built-in **onboarding tour** (`TW.Onboarding`) walks you through the panel and initial setup.
{% endhint %}

***

## Verification

After starting the server, verify the installation:

### Check Console

* Database tables created successfully (first run only)
* No error messages related to `tw-adminmenu`

### In-Game Test

1. Open the admin menu as a God user
2. Confirm the dashboard loads with live server stats
3. Open the **Online Players** page and confirm players are listed
4. Open **Admin → Staff/Roles** and add your first staff member

***

## Troubleshooting

### Menu won't open / "No access"

* Confirm your `fivem:` or `discord:` identifier is in `TW.GodIdentifiers`
* Make sure you restarted the server after editing the config

### Database errors

* Verify oxmysql is started **before** `tw-adminmenu`
* Confirm your database connection string in `server.cfg` is correct

### Framework not detected

* Make sure `TW.Framework` matches your framework (`"QBCore"` or `"ESX"`)
* Verify the framework resource starts before `tw-adminmenu`

***

## Need Help?

{% hint style="info" %}
Having installation issues? Join our [Discord server](https://discord.gg/tworst) and open a support ticket with:

* Server console errors
* Your `TW.Framework` setting
* Screenshots of any issues
  {% endhint %}
