Raised This Month: $51 Target: $400
 12% 

[TF2] AFK PLAYER MEDIC BOT (controls player's client) Updated 16 MAY 2015 (v1.21)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
El Diablo War3Evo
Veteran Member
Join Date: Jun 2013
Plugin ID:
4483
Plugin Version:
1.21
Plugin Category:
Fun Stuff
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allows your admins 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.
    Old 01-09-2015 , 15:16   [TF2] AFK PLAYER MEDIC BOT (controls player's client) Updated 16 MAY 2015 (v1.21)
    Reply With Quote #1

    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:
    Attached Files
    File Type: zip afk_medic_bot.zip (78.4 KB, 937 views)
    File Type: sp Get Plugin or Get Source (afk_bot_stand_alone.sp - 1860 views - 37.9 KB)
    __________________

    Last edited by El Diablo War3Evo; 05-16-2015 at 11:29. Reason: just forgot more text...
    El Diablo War3Evo is offline
    Sreaper
    髪を用心
    Join Date: Nov 2009
    Old 01-09-2015 , 15:30   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) 9 JAN 2015
    Reply With Quote #2

    I don't fully comprehend. Is this like Saigns.de's afk system where the game takes control of your player and plays for you with your own character?

    Last edited by Sreaper; 01-09-2015 at 15:31.
    Sreaper is offline
    El Diablo War3Evo
    Veteran Member
    Join Date: Jun 2013
    Old 01-09-2015 , 15:39   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) 9 JAN 2015
    Reply With Quote #3

    Quote:
    Originally Posted by Sreaper View Post
    I don't fully comprehend. Is this like Saigns.de's afk system where the game takes control of your player and plays for you with your own character?

    I've never seen Saigns.de's afk system.


    This plugin allows your server to take control over a player when they go AFK. When they come back, it will release control when they type !back or /back. This only works if you use my afk_manager plugin that is included in the zip file. Otherwise, it will only control a player the admin tells it to. Players can still release themselves anytime by typing !back, although they will not get any message saying so unless the afk_manager is included.

    The compiled plugin inside the zip package requires the afk_manager.smx in order to run. Otherwise, recompile it yourself and comment out the afk_manager includes.
    __________________

    Last edited by El Diablo War3Evo; 01-09-2015 at 15:39.
    El Diablo War3Evo is offline
    DrFallen
    AlliedModders Donor
    Join Date: Jul 2013
    Location: ./root
    Old 01-09-2015 , 17:37   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) 9 JAN 2015
    Reply With Quote #4

    Quote:
    Originally Posted by Sreaper View Post
    I don't fully comprehend. Is this like Saigns.de's afk system where the game takes control of your player and plays for you with your own character?
    Pretty much, back when it was an alpha by the looks of it. It "works" in terms it takes control of the character but that's about it. I think you would have to have a proper nav file to get it to work fully.
    DrFallen is offline
    SPYderman
    Senior Member
    Join Date: Aug 2013
    Old 01-09-2015 , 20:23   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) 9 JAN 2015
    Reply With Quote #5

    Getting these errors when a player goes AFK bot, and they crash from the server:
    Code:
    L 01/09/2015 - 17:18:42: [SM] Plugin "afk_manager.smx" encountered error 23: Native detected error
    L 01/09/2015 - 17:18:42: [SM] Invalid timer handle d7008f (error 1) during timer end, displayed function is timer callback, not the stack trace
    L 01/09/2015 - 17:18:42: [SM] Unable to call function "Timer_CheckPlayer" due to above error(s).
    
     // This part continuously floods my console until the player is disconnected.
    L 01/09/2015 - 17:18:42: [SM] Native "GetEntProp" reported: Property "m_iClass" not found (entity 0/worldspawn)
    L 01/09/2015 - 17:18:42: [SM] Displaying call stack trace for plugin "afk_bot_stand_alone.smx":
    L 01/09/2015 - 17:18:42: [SM]   [0]  Line 329, /home/diablo/SOURCEMOD_ALL_FILES/sourcemod/git_War3Evo_VenumX_19FEB2014/tf/addons/sourcemod/scripting/include/tf2_stocks.inc::TF2_GetPlayerClass()
    L 01/09/2015 - 17:18:42: [SM]   [1]  Line 568, /home/diablo/SOURCEMOD_ALL_FILES/sourcemod/git_War3Evo_VenumX_19FEB2014/tf/addons/sourcemod/scripting/afk_bot_stand_alone.sp::OnPlayerRunCmd()
    L 01/09/2015 - 17:18:42: [SM] Native "GetEntProp" reported: Property "m_iClass" not found (entity 0/worldspawn)

    Last edited by SPYderman; 01-09-2015 at 20:35.
    SPYderman is offline
    El Diablo War3Evo
    Veteran Member
    Join Date: Jun 2013
    Old 01-10-2015 , 04:51   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) 9 JAN 2015
    Reply With Quote #6

    Quote:
    Originally Posted by SPYderman View Post
    Getting these errors when a player goes AFK bot, and they crash from the server:
    Code:
    L 01/09/2015 - 17:18:42: [SM] Plugin "afk_manager.smx" encountered error 23: Native detected error
    L 01/09/2015 - 17:18:42: [SM] Invalid timer handle d7008f (error 1) during timer end, displayed function is timer callback, not the stack trace
    L 01/09/2015 - 17:18:42: [SM] Unable to call function "Timer_CheckPlayer" due to above error(s).
    
     // This part continuously floods my console until the player is disconnected.
    L 01/09/2015 - 17:18:42: [SM] Native "GetEntProp" reported: Property "m_iClass" not found (entity 0/worldspawn)
    L 01/09/2015 - 17:18:42: [SM] Displaying call stack trace for plugin "afk_bot_stand_alone.smx":
    L 01/09/2015 - 17:18:42: [SM]   [0]  Line 329, /home/diablo/SOURCEMOD_ALL_FILES/sourcemod/git_War3Evo_VenumX_19FEB2014/tf/addons/sourcemod/scripting/include/tf2_stocks.inc::TF2_GetPlayerClass()
    L 01/09/2015 - 17:18:42: [SM]   [1]  Line 568, /home/diablo/SOURCEMOD_ALL_FILES/sourcemod/git_War3Evo_VenumX_19FEB2014/tf/addons/sourcemod/scripting/afk_bot_stand_alone.sp::OnPlayerRunCmd()
    L 01/09/2015 - 17:18:42: [SM] Native "GetEntProp" reported: Property "m_iClass" not found (entity 0/worldspawn)

    I haven't had any players crash, or a server crash due to this... I'll look at it.


    See if this fixes your errors, as I added extra player validation checking code:

    The compiled version works with my version of the afk_manager.sp that is included in my zip file, if the web compiler compiles it, it will not use the afk_manager to put players into afk mode. Or you can compile it yourself, but you'll need files from my zip in my first post.
    Attached Files
    File Type: sp Get Plugin or Get Source (afk_bot_stand_alone.sp - 546 views - 22.9 KB)
    File Type: smx afk_bot_stand_alone.smx (25.3 KB, 612 views)
    __________________

    Last edited by El Diablo War3Evo; 01-10-2015 at 05:10.
    El Diablo War3Evo is offline
    SPYderman
    Senior Member
    Join Date: Aug 2013
    Old 01-10-2015 , 19:12   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) 9 JAN 2015
    Reply With Quote #7

    Works now, thanks & outstanding work.

    The only issues I see is:
    - Just general navigation issues (then again I tested this with bots so it wasn't hard to get it stuck)
    - When your bot is idling, I'm able to move.
    - The speed of the AFK bot changes to match other classes (so it would run as fast as a scout and such)
    - When you die it says you're AFK, but then the AFK warning messages start to pop up again.
    SPYderman is offline
    Chdata
    Veteran Member
    Join Date: Aug 2012
    Location: Computer Chair, Illinois
    Old 01-10-2015 , 21:11   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) 9 JAN 2015
    Reply With Quote #8

    Actually I think the bot moves at 520, which is max speed.

    According to cl_showpos
    __________________
    Chdata is offline
    SPYderman
    Senior Member
    Join Date: Aug 2013
    Old 01-10-2015 , 21:55   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) 9 JAN 2015
    Reply With Quote #9

    Quote:
    Originally Posted by Chdata View Post
    Actually I think the bot moves at 520, which is max speed.

    According to cl_showpos
    Ah, didn't think of that. I only realized it when it healed a heavy, it'd move as slow as the heavy, then when it healed a scout or when I moved the idle bot it would move pretty fast.
    SPYderman is offline
    Chdata
    Veteran Member
    Join Date: Aug 2012
    Location: Computer Chair, Illinois
    Old 01-10-2015 , 22:43   Re: [TF2] AFK PLAYER MEDIC BOT (controls player's client) Updated 10 JAN 2015 (v1.1)
    Reply With Quote #10

    Yeah, if you move yourself you can see that.
    __________________
    Chdata is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 21:12.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode