> ## Documentation Index
> Fetch the complete documentation index at: https://docs.leaderos.net/llms.txt
> Use this file to discover all available pages before exploring further.

# LeaderOS Connect

> Connect your Garry's Mod server to LeaderOS, enabling you to execute commands on your server directly from the website.

## Download

[https://www.leaderos.net/plugin/gmod](https://www.leaderos.net/plugin/gmod)

## Source Code

[https://github.com/leaderos-net/gmod-leaderos-connect](https://github.com/leaderos-net/gmod-leaderos-connect)

## Installation

### 1. Download the addon

Download the latest release as a ZIP file from the link below and extract it:

[https://www.leaderos.net/plugin/gmod](https://www.leaderos.net/plugin/gmod)

### 2. Upload the addon

Copy the `leaderos_connect` folder from the extracted ZIP into your server's addons directory:

```
garrysmod/addons/leaderos_connect/
```

### 3. First restart

Restart your server. This will generate the config file at:

```
garrysmod/addons/leaderos_connect/lua/leaderos/config.lua
```

### 4. Configure the addon

Open `config.lua` and fill in your credentials:

```lua theme={null}
LeaderOS.Config = {
   WebsiteURL   = "https://yourwebsite.com",
   APIKey       = "YOUR_API_KEY_HERE",
   ConnectToken = "YOUR_SERVER_TOKEN_HERE",
   DebugMode    = false,
   CheckOnline  = true,
   FreqMinutes  = 2,
}
```

### 5. Configure server.cfg

Add the following line to `garrysmod/cfg/server.cfg`:

```
sv_hibernate_think 1
```

> **Important:** This is required. Without it, Lua timers do not run when no players are on the server, and the addon will not poll the queue.

### 6. Final restart

Restart your server. The addon is now active. Run `leaderos_status` in the server console to confirm everything is working.

## Configuration

| Option         | Description                                                                                          |
| -------------- | ---------------------------------------------------------------------------------------------------- |
| `WebsiteURL`   | The URL of your LeaderOS website (e.g., `https://yourwebsite.com`).                                  |
| `APIKey`       | Your LeaderOS API key. Find it on `Dashboard > Settings > API`                                       |
| `ConnectToken` | Your server token. Find it on `Dashboard > Store > Servers > Your Server > Server Token`             |
| `DebugMode`    | Set to `true` to enable debug logging, or `false` to disable it.                                     |
| `CheckOnline`  | Set to `true` to check if players are online before sending commands, or `false` to skip this check. |
| `FreqMinutes`  | How often (in minutes) the addon polls the command queue.                                            |

## Console Commands

| Command           | Description                                                                  |
| ----------------- | ---------------------------------------------------------------------------- |
| `leaderos_status` | Displays the current configuration and timer status.                         |
| `leaderos_reload` | Reloads the config file, restarts the timer, and triggers an immediate poll. |
| `leaderos_poll`   | Triggers an immediate queue poll without restarting the timer.               |
| `leaderos_debug`  | Toggles debug mode on or off.                                                |
