A lightweight and configurable AFK (Away From Keyboard) detection system for FiveM servers.
This script automatically detects when players are inactive and marks them as AFK. It monitors player movement, rotation, and input actions to determine activity status.
- Automatic AFK detection based on player movement and input
- Configurable AFK timeout duration
- Warning notification before being marked as AFK
- Periodic AFK status notifications
- Visual indicators for other players to see who is AFK
- Debug mode for testing and troubleshooting
- FiveM server
- ox_lib for notifications
- Download or clone this repository
- Place the
ardenhub_afkfolder in your server's resources directory - Add
ensure ardenhub_afkto your server.cfg - Ensure you have ox_lib installed and running on your server
The script includes several configuration options that can be adjusted in the client.lua file
| Option | Description |
|---|---|
| afkTime | Time in seconds before a player is considered AFK |
| notificationInterval | How often (in seconds) to show AFK notifications |
| warningNotification | Whether to show a warning before being marked as AFK |
| warningTime | How many seconds before AFK status to show the warning |
| inputControl | Whether to monitor player input actions (not just movement) |
| debugMode | Enable debug messages in console |
-
The script continuously monitors player activity by checking:
- Player position changes
- Player heading (rotation) changes
- Player input actions (if enabled)
-
When no activity is detected for the configured time period:
- A warning notification is displayed (if enabled)
- After the full AFK time, the player is marked as AFK
- An "AFK" indicator is shown above the player using the
/mecommand - Periodic notifications remind the player they are in AFK mode
-
When activity is detected again:
- The AFK status is automatically removed
This script is released under the MIT License.
Developed by ArduinoDenis.it
For support, contact ArDenHub in the discord or open an issue on GitHub.