Raised This Month: $32 Target: $400
 8% 

[L4D & L4D2] Medkit Preventer


Post New Thread Reply   
 
Thread Tools Display Modes
Author
xerox8521
Senior Member
Join Date: Sep 2011
Plugin ID:
7267
Plugin Version:
1.2.1
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    11 
    Plugin Description:
    Prevents the use of the medkit if certain conditions are not met
    Old 08-24-2020 , 14:44   [L4D & L4D2] Medkit Preventer
    Reply With Quote #1

    This plugin was based on the request made here.

    Plugin was compiled with SourceMod 1.10


    This will prevent players and bots from using Medkits on themselfs and others if:
    - They are not on the "third strike" aka Black / White Mode.
    - Their health + temphealth is above the value specified in mkp_minhealth. This is controllable by the mkp_usetemphealth CVar.
    - Their health is above the value specified in mkp_minhealth.

    Notes for L4D:
    Since L4D uses considerably different code for the FirstAidKit I've seperated the plugin into 2 versions.

    CVars:
    - mkp_version - Version of the Plugin
    - mkp_messagetime - Time between sending a warning message when attempting to use a medkit.
    - mkp_usetemphealth - Should Temporary Health be included in the health check.
    - mkp_minhealth - Minimum Health the player needs to have to be able to use medkit. This also affects healing other players.

    Required Extensions:
    This Plugin was compiled with DHooks (with Detour Support)

    For those wondering why I'm using dhooks version with detour support instead of the "normal" version it is simply the version I'm always using.

    Installation Left4Dead:
    Place the antimedkit_l4d.smx into your addons/sourcemod/plugins folder.
    Place the antimedkit.txt into your addons/sourcemod/gamedata folder.
    Place the antimedkit.phrases.txt into your addons/sourcemod/translations folder

    Installation Left4Dead2:
    Place the antimedkit.smx into your addons/sourcemod/plugins folder.
    Place the antimedkit.txt into your addons/sourcemod/gamedata folder.
    Place the antimedkit.phrases.txt into your addons/sourcemod/translations folder

    Changelog:
    Version 1.2.1 - L4D Only
    - Redone the code which properly prevents using the medkit which now works like the L4D2 Version.

    Version 1.2.1
    - Fixed Plugin not working after last update. Only affected L4D2 Version.

    Version 1.2
    - Fixed showing wrong message when attemping to heal someone else.
    - Added Support for L4D.


    Credits:
    - Sunyata - For the request
    - honorcode23 - GetClientRealHealth Code
    - Marttt - For the Suggestions

    Possible Bugs:
    - Bots may get stuck infinitely trying to use medkit's if the cvar mkp_minhealth is lower than their health and internal heal check.
    Attached Files
    File Type: txt antimedkit.phrases.txt (244 Bytes, 447 views)
    File Type: sp Get Plugin or Get Source (antimedkit.sp - 413 views - 6.2 KB)
    File Type: smx antimedkit.smx (5.6 KB, 408 views)
    File Type: smx antimedkit_l4d.smx (5.4 KB, 234 views)
    File Type: sp Get Plugin or Get Source (antimedkit_l4d.sp - 244 views - 6.3 KB)
    File Type: txt antimedkit.txt (1.1 KB, 407 views)

    Last edited by xerox8521; 09-25-2020 at 06:07. Reason: Update to 1.2.1 - Also Title Update
    xerox8521 is offline
    Marttt
    Veteran Member
    Join Date: Jan 2019
    Location: Brazil
    Old 08-24-2020 , 15:10   Re: Medkit Preventer
    Reply With Quote #2

    Nice, I was making one similar without gamedata since I don't have knowledge on finding offsets,

    You probably could add an option to include the temp health check, some chat warning messages and maybe L4D1 support in a future release.

    Thanks for sharing.
    __________________

    Last edited by Marttt; 08-25-2020 at 20:34.
    Marttt is offline
    Sunyata
    Senior Member
    Join Date: Nov 2017
    Location: Wherever I am
    Old 08-25-2020 , 03:27   Re: Medkit Preventer
    Reply With Quote #3

    Any chance of a plugin version of this for L4D1 as well, as I don't play L4D2, so this plugin won't be of any use for me personally. But thanks for making it based upon my suggestion anyway.
    Sunyata is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: Chocolate Factory
    Old 08-25-2020 , 09:49   Re: Medkit Preventer
    Reply With Quote #4

    Here's a suggestion: Instead of creating an minimum hp check in the plugin, why not rely on "sb_toughness_buffer" registered in the game? That way, it would lessen the chances of the bug occurring since the value of that cvar is what bots will use to determine whether it's the right time to heal or not.

    Last edited by cravenge; 08-25-2020 at 10:41.
    cravenge is offline
    xerox8521
    Senior Member
    Join Date: Sep 2011
    Old 08-25-2020 , 10:59   Re: Medkit Preventer
    Reply With Quote #5

    @TBK Duy:
    Did you unload the plugin or changed the map? Deleting the file won't magically unload it.

    @cravenge:
    The sb_toughness_buffer convar doesn't seem to do anything regardless of its value in l4d.

    @Sunyata:
    L4D Version is almost done.

    Last edited by xerox8521; 08-25-2020 at 11:00.
    xerox8521 is offline
    Sunyata
    Senior Member
    Join Date: Nov 2017
    Location: Wherever I am
    Old 08-25-2020 , 11:23   Re: Medkit Preventer
    Reply With Quote #6

    @xerox8521,

    Nice to hear there's a l4d1 version in the works. btw, I'm using Sourcemod build 1.8x on my Linux and Windows servers. Will your plugin work with this older version of SM? I hope it will.
    Sunyata is offline
    xerox8521
    Senior Member
    Join Date: Sep 2011
    Old 08-25-2020 , 14:27   Re: Medkit Preventer
    Reply With Quote #7

    Version 1.2
    Added L4D Support although not as elegant as the L4D2 version due to code differences between both games.

    Fixed showing wrong message when trying to heal someone else.

    While it should work for 1.8 I strongly recommend upgrading to Sourcemod 1.10.

    I've attached a Version for 1.8 and L4D. Gamedata and translation file can be used from the main post.

    @TBK Duy:
    I can't seem to replicate this weird bot behaviour. Maybe check if other plugins interfere with the bots behaviour ?!
    Attached Files
    File Type: smx antimedkit_l4d_18.smx (7.3 KB, 147 views)
    File Type: sp Get Plugin or Get Source (antimedkit_l4d_18.sp - 178 views - 7.3 KB)

    Last edited by xerox8521; 08-25-2020 at 14:39. Reason: Wrong Files uploaded - Oops
    xerox8521 is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Cat
    Old 08-25-2020 , 16:03   Re: [L4D & L4D2] Medkit Preventer
    Reply With Quote #8

    Hey here is l4d1 function and detour method it should work i'v not tested it.

    PHP Code:
    "Games"
    {
        
    "left4dead"
        
    {
            
    "Functions"
            
    {
                
    "CFirstAidKit::StartHealing"
                
    {
                    
    "signature"        "CFirstAidKit::StartHealing"
                    "callconv"        "thiscall"
                    "return"        "bool"
                    "this"            "entity" 
    //can get the owner of the kit.
                    
    "arguments"
                    
    {
                        
    "someint"
                        
    {
                            
    "type"    "int" //1 looks to be healing someone else 2 looks to be healing self
                        
    }
                    }
                }
            }
            
    "Signatures"
            
    {
                
    "CFirstAidKit::StartHealing"
                
    {
                    
    "library"    "server"
                    "windows"    "\x51\x80\xB9\x58\x08\x00\x00\x00"
                    "linux"        "@_ZN12CFirstAidKit12StartHealingENS_14HealTargetTypeE_part_43"
                    
    //"linux"        "@_ZN12CFirstAidKit12StartHealingENS_14HealTargetTypeE.part.43" //not sure if dots in magled names or not.
                
    }
            }
        }

    This should function the same as the l4d2 hook you use i hope, set return to false before you superced it.

    It may outright crash i dunno enjoy.
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D
    Lux is offline
    Maur0
    Senior Member
    Join Date: Aug 2020
    Old 08-25-2020 , 16:54   Re: [L4D & L4D2] Medkit Preventer
    Reply With Quote #9

    Hey man, excellent plugin. It helps a lot with this to prevent healing in the wrong health. But there is a small problem, is that with the new update that you put, I can heal myself having more than 40HP and with my partner it continues to give this effect.

    I don't know if it's a bug or something went wrong. Or I don't know if it's just for the Admin that he can heal himself, but I had noticed that and I didn't want people to heal themselves when they are over 40HP.

    Sorry for bad writing.
    Maur0 is offline
    xerox8521
    Senior Member
    Join Date: Sep 2011
    Old 08-26-2020 , 08:51   Re: [L4D & L4D2] Medkit Preventer
    Reply With Quote #10

    Update 1.2.1 - Accidently broke the plugin when checking for the use type. This only affected the L4D2 Version. Which is now fixed. Thanks for the report.

    @Lux I'll look into that function thanks!

    Last edited by xerox8521; 08-26-2020 at 09:38.
    xerox8521 is offline
    Reply


    Thread Tools
    Display Modes

    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 22:04.


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