Allows anyone to go afk medic bot AND does not spawn bots to replace them. It also works with a afk_manager to force players to afk medic bot when they go afk instead of sending them to spec.
How does this work?
This plugin creates a "bot like effect" except that it
is not a bot or does not reuse any bot code from team fortress 2. This plugin is actually is a bit less smart than regular bots, as the move around code is crude.
It does not use any teleportation to move players around! It does not force teleport on the player, because players will complain about not being able to kill your a teleporting medic, so this plugin refrains from teleporting to move around. This plugin using velocity to move players around via OnPlayerRunCmd
https://sm.alliedmods.net/api/index....d=show&id=937& ... so it actually does not use any button commands, but instead it uses vel[] from the OnPlayerRunCmd to control where it goes. It uses TR_TraceRayFilter
https://sm.alliedmods.net/api/index....d=show&id=233& in order to help the plugin see if it needs to move left or right.
If a player yells "medic" via their voicemenu command, and they are close to a player whom is in afk player bot medic mode, then that medic will retarget to them and they will be the new owner of a afk player bot medic.
If a pyro pushes a afk player medic bot away from it's controller, it will clear it's memory of that controller and start searching for a new controller.
Dependencies:
I've included everything to make it run stand alone, but if you compile it using the web compiler, you will not gain all features in the plugin.
It requires
sdkhooks if you want the medic bot to respond to being hit by damage and triggering it's uber charge in response.
It requires
my verison of the afk_manager. Credits for creating it goes to
https://forums.alliedmods.net/showthread.php?p=708265 BUT, you'll still need my version of it, because I've created a special interface that allows this plugin to work with the afk_manager plugin so that when a player goes afk, it will put them into afk bot mode instead. (If more than 4 players go afk, the afk manager will act normally). We do recommend you set sm_afk_move_min_players to 1 in your server.cfg file. It will allow the afk medic bot functions to act whenever any player goes afk, instead of waiting for 4 players to be in game.
It will try to include colors or morecolors, but if they don't exists, its fine.
It will try to include smlib, but if you don't have it, its fine.
Commands:
Admin Commands:
afkon - requires ADMFLAG_KICK - puts admin into afk mode (admin still has to switch to medic on his/her own)
afkoff - requires ADMFLAG_KICK - removes afk mode from admin
forceclass - requires ADMFLAG_ROOT - forces a player into medic class. Usage: forceclass userid Don't use # sign in that. Example: forceclass 123
forceafkon - requires ADMFLAG_ROOT - forces a player into afk mode. Usage: forceafkon userid Don't use # sign in that. Example: forceafkon 123
forceafkoff - requires ADMFLAG_ROOT - removes a player from afk mode. Usage: forceafkoff userid Don't use # sign in that. Example: forceafkoff 123
kickafkplayers = requires ADMFLAG_KICK - kicks all players that are currently marked as afk medic bots. If a player is being protected via a convar, that player will not be kicked.
Regular Player Commands:
sm_back in console, or
!back or
/back in chat - removes afk from a player
sm_afkoff - same as sm_back
Convars:
afkbot_back_menu 0 - 1 - enable, 0 - disable (default 0)
Require players to use a menu to get out of afk medic bot. if a player types !back or /back in chat, this convar decides if the player will be required to answer a menu or not. Can help prevent players from preventing themselves from going afk medic bot.
afkbot_Allow_Non_Admins_AFK_Command 0 - disable, 1 - enable. (default 1)
If enabled, Non Admins will be allowed to type !afk to go afk player medic bot.
afkbot_allow_movement 0 - disable, 1 - enable. (default 1)
If enabled, player will be allowed to use movement buttons to control afkbot.
afkbot_maximum 2 -The maximum allowed
per team of afk bots.
afkbot_kick_Protection_Enable 1 - 1 - enable, 0 - disable
afk medic bot Kick protection.
afkbot_kick_Protection_Admin_Flag a - The admin flag a-z for kick protection.
afkbot_kick_afk_players_round_start 1 - 1 - enable, 0 - disable
Kick afk bots when round starts.
afkbot_kick_afk_players_round_end 1 - 1 - enable, 0 - disable
Kick afk bots when round ends.
afkbot_allow_respawn_dead_players 1 - 1 - enable, 0 - disable
If enabled, plugin will respawn marked afk medic bot dead players to be afk medic bot.
Notes:
requires at least SourceMod 1.7
afk_manager will not compile using normal web compiler as it requires afk_manager.inc
^^ you'll need to download afk_manager and use my version of it if you want to have your players be moved into afk medic bots when they go afk.
If you use the compiled version of the afk_bot_stand_alone.sp, you will still be able to go medic afk bot, but you will not have the feature of forcing players into afk bot when they go afk. I'm not sure if the web compiler supports sdkhooks, but if it does not support sdkhooks you will then not have medic afk bots responding to damage.
Known Issues:
- Navigational Problems - The AFK player bot can get stuck on corners easy, and is crude on its methods of trying to get around it. (I might add a cvar later for those of you that don't care if your player teleports around it.)
- When your bot loses a controller, you can move it around.
- The Player Bot will match the speed of other classes in order to "keep up with them".
Change Log
-------------
version 1.0 - initial release
version 1.1
- Fixes issues with Error Messages: Native "GetEntProp" reported: Property "m_iClass" not found (entity 0/worldspawn).
- Updated my version of AFK Manager to latest the latest version of the original AFK Manager to 3.5.3
version 1.2
- New "Wall Detection Code" added to help the bot "detect walls" and move around them more easily. This new code is a work in progress, as I still have to make the bot "see if something is blocking his or her feet".
- Added admin command to "kick afk players", Added admin flag protection to help protect VIP from being automatically AFK bot kicked.
- Now has some Convars
- fixed bug that allowed players to switch to different classes while being afk controlled, if a player switches to a different class while being controlled...that player will be killed and changed back to medic.
version 1.21
- Patched Memory leak
[SM] MEMORY LEAK DETECTED IN PLUGIN (file "afk_bot_stand_alone.smx")
[SM] Unloading plugin to free 30716 handles.
[SM] Contact the author(s) of this plugin to correct this error.
--------------------------------------------------------------------------
Type Timer | Count 2
Type TraceRay | Count 30714
-- Approximately 0 bytes of memory are in use by (30716) Handles.
Sourcemod Plugin Dev for Hire
http://war3evo.info/plugin-development-team/
version 1.0:
(afk_medic_bot.zip 65.1 KB, 16 views)
(afk_bot_stand_alone.sp - 10 views - 22.9 KB)
version 1.1:
(afk_medic_bot.zip 68.8 KB, 93 views)
(afk_bot_stand_alone.sp - 35 views - 23.2 KB)
version 1.2:
(afk_medic_bot.zip 78.4 KB, 5 views)
(afk_bot_stand_alone.sp - 9 views - 37.8 KB)
version 1.21: