🎮NOXEN AFK SYSTEM

📋 Overview

NOXEN AFK System is a comprehensive FiveM script that allows players to enter AFK (Away From Keyboard) mode with an automatic reward system. The script provides an immersive experience with interactive NPCs, modern UI, and advanced security features.

🔌 Plug & Play: Compatible with ESX and QB-Core without additional modifications.

✨ Key Features

🎯 AFK System

  • Multiple Entry Points: 6 strategically placed AFK points across the map with interactive NPCs

  • Secure AFK Zone: Private teleportation zone with custom IPL interior

  • Teleportation Delay: Configurable 1-minute delay before teleportation

  • Position Management: Automatic position saving and restoration

  • Modern Interface: Visual timer and animated reward notifications

🎁 Reward System

  • Automatic Rewards: Configurable interval (default: 10 minutes)

  • Randomized Rewards:

    • 💰 Money: $100-300 (85% chance)

    • 🪙 Items: water 1-2x (15% chance)

  • Anti-Cheat Protection: Server-side validation with automatic kick system

  • Smart Validation: Items are checked for existence before being given

  • Framework Notifications: Uses native ESX/QBCore notification systems

🛡️ Security Features

  • Control Disabling: Weapons and combat actions blocked during AFK

  • Death Monitoring: Automatic AFK exit on player death

  • Anti-Spam Protection: Configurable cooldown based on Config.RewardInterval

  • Automatic Cleanup: Disconnected player data removal

  • Item Validation: Prevents crashes by checking item existence before giving rewards

  • Framework Compatibility: Enhanced ESX/QBCore player object handling

🔌 Framework Integration

  • ESX Legacy: Full compatibility with ESX framework

  • QB-Core: Full compatibility with QB-Core framework

  • PMA Voice: Automatic voice mute during AFK

  • ESX Status: Configurable needs management (hunger/thirst)

  • Web Interface: Smooth fade transitions and visual feedback

📍 AFK Locations

Location
Coordinates
Description

Route 68

vector3(1095.1377, 2633.0056, 38.0120)

Highway rest stop

Bennys

vector3(694.3072, 73.7141, 83.8567)

Auto shop area

Hospital

vector3(-1821.2596, -405.3518, 46.6492)

Medical center

Beach

vector3(-1253.8062, -1535.2080, 4.2962)

Coastal area

Paleto

vector3(136.5773, 6643.2241, 31.7411)

Northern town

Roxwood

vector3(-306.8768, 7073.5747, 12.1890)

Rural area

VIP AFK Zone: vector3(-1266.0729, -3013.6370, -46.8537) (Private interior)

🎛️ Commands

Command
Description

/afk

Create GPS waypoint to nearest AFK point

/stopafk

Force exit from AFK mode

⚙️ Configuration

Reward Settings

Timing Configuration

Message Customization

UI Position Configuration

🔧 Installation

Prerequisites

  • ESX Legacy or QB-Core (Required - Choose one)

  • PMA Voice (Optional - for voice mute feature)

  • ESX Status (Optional - for needs management)

Setup Steps

  1. Download & Extract

  2. Server Configuration

  3. Customize Functions (See customization section below)

  4. Restart Server

📁 File Structure

🛠️ Customization Required

⚠️ Important: Before Use

You MUST customize these functions in client/functions.lua according to your server setup:

🔧 Position Saving Function

🔧 Status Management Function

🎨 User Interface

Interface Components

  • 🔄 Circular Timer: Visual countdown to next reward with persistent display

  • 🎁 Framework Notifications: Uses native ESX/QBCore notification systems

  • 🌊 Smooth Transitions: Fade in/out effects during teleportation

  • 📱 Configurable Position: Customizable timer position via config

  • 🎯 Persistent Messages: Timer messages remain visible throughout cycles

UI Features

  • Real-time reward countdown

  • Configurable UI positioning

  • Smooth fade transitions

  • Framework-integrated notifications

  • Modern visual design with persistent text display

🔒 Security System

Anti-Cheat Measures

  • Server-Side Validation: All rewards validated on server

  • Dynamic Cooldown Protection: Configurable intervals based on Config.RewardInterval

  • Automatic Kicking: Instant kick for exploitation attempts with detailed logging

  • Data Cleanup: Automatic removal of disconnected player data

Monitoring Features

  • Player death detection with automatic AFK exit

  • Connection status monitoring

  • Reward timing validation

  • Position verification

🐛 Troubleshooting

Common Issues

Issue
Solution

NPCs not spawning

Check model loading, restart script

Rewards not working

Verify ESX/QB-Core configuration, check server logs

UI not visible

Ensure HTML files present, restart client

Position not saving

Customize EnablePositionSaving() function

Players dying in AFK

Customize PauseAllStatus() function

Debug Information

  • All logs prefixed with [NOXEN AFK]

  • Check both client and server console

  • Verify configuration syntax

  • Test with single player first

📊 Performance

Optimizations

  • Efficient Threading: Minimal performance impact

  • Smart Cleanup: Automatic data management

  • Optimized Loops: Reduced server load

  • Memory Management: Proper resource cleanup

Resource Usage

  • Client: ~0.0ms without use

  • Client: ~0.1ms

  • Server: ~0.005ms average

🔄 Updates & Maintenance

Version Information

  • Current Version: 1.1.0

  • Compatibility: ESX Legacy & QB-Core

  • Recent Updates: Enhanced stability, UI positioning, QBCore fixes

Maintenance Tips

  • Regular log monitoring

  • Periodic configuration review

  • Player feedback integration

  • Performance monitoring

📞 Support

Getting Help

  1. Check Documentation: Review this README thoroughly

  2. Check Logs: Examine server/client console output

  3. Verify Configuration: Ensure proper setup

  4. Test Functions: Verify custom function implementation

Support Channels

  • Check server logs for error messages

  • Verify ESX/QB-Core framework compatibility

📄 License

This script is provided as-is under standard usage terms. You are free to modify and adapt it according to your server's needs.


🔄 Recent Updates (v1.1.0)

🛠️ Bug Fixes

  • Fixed QBCore Compatibility: Resolved xPlayer.source being nil in QBCore

  • Enhanced Timer System: Replaced os.time() with GetGameTimer() for better reliability

  • JavaScript Error Resolution: Fixed DOM element selection issues

  • Persistent UI Messages: Timer text no longer disappears after cycles

  • Item Validation: Added checks to prevent crashes from invalid items

✨ New Features

  • Configurable UI Position: Timer position can now be set via Config.UI

  • Dynamic Cooldown System: Anti-spam protection now uses Config.RewardInterval

  • Enhanced Debug System: Better logging and error reporting

  • Framework Notifications: Integrated with native ESX/QBCore notification systems

🔧 Improvements

  • Better Error Handling: More robust error checking throughout the script

  • Performance Optimization: Reduced resource usage and improved efficiency

  • Code Cleanup: Removed redundant notification systems

  • Enhanced Security: Better validation and anti-cheat measures


🚀 Developed by HARPIK Version 1.1.0 - Professional AFK Management Solution

Last updated