> For the complete documentation index, see [llms.txt](https://stalk.gitbook.io/documentation-stalk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stalk.gitbook.io/documentation-stalk/afk-system/installation-guide.md).

# Installation Guide

The installation process for STALK AFK has been designed to be quick and simple to set up on your server. No complex dependencies are required, and most of the configuration can be modified directly through the `config.lua` file.

## Step 1 : Resource Installation

Start by dragging the `stalk_afk` folder into your server’s `resources` directory.

Once the folder has been added, open your `server.cfg` file and add the following line:

```
ensure stalk_afk
```

After saving the changes, restart your server.

## Step 2 : Script Configuration

All the main configuration settings are located inside:

```
stalk_afk/config.lua
```

From this file, you can modify important settings such as the framework used, AFK rewards, milestone bonuses, NPC locations, and the protections applied when a player enters AFK mode.

The script supports:

* ESX
* QBCore
* Standalone
* Automatic framework detection using `auto`

By default, the configuration uses:

```
Config.Framework = 'auto'
```

If you want to force a specific framework, simply replace the value with:

```
Config.Framework = 'esx'
```

or

```
Config.Framework = 'qbcore'
```

## Step 3 : AFK Reward Configuration

The system automatically rewards players every 60 seconds spent in AFK mode.

You can fully customize:

* the interval between rewards,
* the amount earned,
* and additional milestone bonuses based on AFK duration.

Example:

```
Config.RewardIntervalSeconds = 60Config.RewardPerInterval = 166.6666667
```

With this configuration, players receive approximately `$10,000` per hour spent AFK.

Milestone bonuses can be configured here:

```
Config.Milestones = {    { seconds = 1 * 60, label = '1min', bonus = 100 },    { seconds = 5 * 60, label = '5min', bonus = 250 },}
```

Each milestone automatically grants an additional bonus reward to the player.

## Step 4 : AFK NPC Configuration

The script allows you to add one or multiple NPCs that players can interact with to enter AFK mode.

NPC configuration can be found here:

```
Config.NPCs = {    {        model = 'a_m_m_business_01',        coords = vector4(-268.29, -957.49, 31.22, 205.0),        scenario = 'WORLD_HUMAN_CLIPBOARD'    },}
```

You can customize the NPC model, location, animation scenario, and even create multiple AFK locations across your server.

## Step 5 : Interaction & ox\_target

The script supports both classic 3D text interaction and `ox_target`.

By default, `ox_target` is enabled:

```
Config.UseOxTarget = true
```

If you are not using `ox_target`, simply change the value to:

```
Config.UseOxTarget = false
```

The script will automatically switch to the standard `E` key interaction system.

## Step 6 : AFK Player Protections

Several built-in protections are included to prevent abuse or unwanted interactions while players are in AFK mode.

The script can automatically:

* make the player invisible,
* freeze the player,
* disable controls,
* prevent death,
* and isolate the player inside a dedicated routing bucket.

All these options are fully configurable inside the `config.lua` file.

## Step 7 : Anti-Crash Reward Backup

The system includes automatic reward saving to prevent players from losing pending rewards after a crash or disconnect.

Pending rewards are stored inside:

```
Config.SaveFile = 'afk_pending_rewards.json'
```

The script can also automatically repay pending rewards when the player reconnects using:

```
Config.PayPendingOnReconnect = true
```

## Important

Before making any major modification or updating the resource, we strongly recommend creating a full backup of your server and existing resources.

Even though the script is optimized and tested before release, backups remain essential to avoid issues caused by bad configurations or external conflicts.

## AI / Documentation Queries

If some information is not directly available on this page, you can dynamically query the documentation using the `ask` parameter.

Example:

```
GET https://docs.stalk.dev/stalk-afk/installation-guide.md?ask=<your-question>
```

You can ask questions such as:

* how to modify rewards,
* how to add multiple NPCs,
* how to disable the routing bucket,
* or how to integrate the script with your framework.

The system will automatically return a direct answer along with the most relevant documentation sections.
