alex Posted November 9, 2025 Report Posted November 9, 2025 AFK Bomb Transfer - Complete Documentation π General Information Plugin: AFK Bomb Transfer (Optimized) Version: 0.5 Author: steams.ro Platform: AMX Mod X Required Module: fakemeta π― Description The plugin automatically transfers the bomb from inactive (AFK) terrorist players to the closest active teammate. This prevents situations where the bomb remains stuck with an AFK player, affecting the gaming experience. β¨ Features Main Functionality β Automatic detection of AFK players carrying the bomb β Automatic transfer to the closest active teammate β Complete movement verification (X, Y, Z - including jumps) β Informative HUD messages for team and new carrier β Optimized task system (runs only when needed) β C4 entity caching (improved performance) v0.5 Optimizations π Task runs only when someone has the bomb π Position checking on all 3 axes (X, Y, Z) π Eliminated duplicate get_players() calls π Cached C4 entity for fast lookup π Checks moved outside loops for efficiency π Restructured and detailed commented code Limitations The plugin does NOT work in the following situations: β During freezetime (at round start) β When bomb is being planted β On maps without bomb sites (optional, see configuration) βοΈ Installation Requirements AMX Mod X installed on server fakemeta module enabled in modules.ini Installation Steps Compile afkbombtransfer.sma with AMX Mod X compiler Copy afkbombtransfer.amxx to addons/amxmodx/plugins/ folder Add afkbombtransfer.amxx to addons/amxmodx/configs/plugins.ini Restart server or change map ποΈ CVAR Configuration afk_bombtransfer_spawn afk_bombtransfer_spawn "7" Description: Maximum allowed AFK time (in seconds) for a player who received the bomb at spawn and never moved. Values: 0 or less = Plugin disabled for this check 1-60 = Recommended seconds Default: 7 seconds Example: If a player receives the bomb at spawn and remains AFK for 7 seconds without moving at all, the bomb will be transferred. afk_bombtransfer_time afk_bombtransfer_time "15" Description: Maximum allowed AFK time (in seconds) for any bomb carrier who moved at least once. Values: 0 or less = Plugin disabled for this check 1-120 = Recommended seconds Default: 15 seconds Example: If a player carrying the bomb stops and remains AFK for 15 seconds, the bomb will be transferred. π¬ HUD Messages For Terrorist Team (Green) Bomb transferred to "NewPlayerName" since "AFKPlayerName" is AFK Color: Green (RGB: 0, 255, 0) Position: Center-left (x: 0.35, y: 0.8) Duration: 7 seconds For New Carrier (Yellow) You got the bomb! Color: Yellow (RGB: 255, 255, 0) Position: Center-top (x: 0.42, y: 0.3) Duration: 7 seconds Channel: 3 π§ Advanced Configuration Disabling Map Check If you want the plugin to run on ALL maps (including those without bomb sites): In source code, comment out the line: #define BOMB_MAP_CHECK Becomes: //#define BOMB_MAP_CHECK Then recompile the plugin. Changing Message Display Time In source code, modify the value: #define MSG_TIME 7.0 Example for 5 seconds: #define MSG_TIME 5.0 π How It Works 1. AFK Detection The plugin checks every second the position (X, Y, Z) of each terrorist: If position changed β timer reset to 0 If position is the same β timer incremented Note: Also checks Z-axis, so jumps and falls reset the timer. 2. Carrier Verification When a player has the bomb: Plugin starts the check task Monitors specific AFK time (spawn vs normal) Checks if player is planting the bomb 3. Bomb Transfer When timer exceeds the set limit: Finds all active (non-AFK) terrorists Calculates distance from AFK carrier Selects the closest active player Forces bomb drop from AFK player Transfers backpack to new carrier Displays HUD messages 4. Active Optimizations Task stops automatically when: No bomb carrier exists Less than 2 terrorists It's freezetime Plugin disabled via CVAR π Usage Examples Example 1: Competitive Server // Tight timings for fast action afk_bombtransfer_spawn "5" afk_bombtransfer_time "10" Example 2: Public/Casual Server // More relaxed timings afk_bombtransfer_spawn "10" afk_bombtransfer_time "20" Example 3: Fun/Zombie Server // Plugin disabled afk_bombtransfer_spawn "0" afk_bombtransfer_time "0" π Troubleshooting Plugin Not Working Check: β fakemeta module is enabled in modules.ini β Plugin is in plugins.ini β CVARs are not set to 0 or negative values β Map has bomb sites (if BOMB_MAP_CHECK is active) Bomb Not Transferring Possible causes: All terrorists are AFK It's freezetime Bomb is being planted Less than 2 terrorists on server Messages Not Appearing Check: hud_centerid in game (must not be 0) HUD settings in game π Changelog v0.5 (2025) - steams.ro β¨ Added Z-axis checking (jumps/falls) π Optimized task (runs only when needed) π Eliminated duplicate get_players() calls π C4 entity caching π Checks moved outside loops π Extended documentation and improved comments π§ Separate function for transfer π― Separate event for bomb planting v0.4 Improved backpack transfer method Support for pcvar natives Code optimizations v0.3 Fakemeta instead of engine Option to disable map checking Improved backpack finding method v0.2 Format fixes Code optimizations Improved description v0.1 First release π Support For issues, bugs, or suggestions: Website: steams.ro Forum: AMX Mod X section π License This plugin is provided "as is" without warranties. π Credits Original Author: Wr0n (www.mortall.ro) v0.5 Optimizations: steams.ro Documentation generated for version 0.5 afkbombtransfer.sma afkbombtransfer.amxx
Recommended Posts