Raised This Month: $81 Target: $400
 20% 

[L4D & L4D2] Incapped Weapons Patch (1.34) [10-Jan-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
7026
Plugin Version:
1.34
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
Servers with this Plugin:
37 
Plugin Description:
Patches the game to allow using Weapons while Incapped, instead of changing weapons scripts.
Old 04-05-2020 , 22:43   [L4D & L4D2] Incapped Weapons Patch (1.34) [10-Jan-2024]
Reply With Quote #1

Related Plugins:

About:
  • Memory patch method to use weapons while incapped, instead of changing weapons scripts.
  • Press the keys 1, 2, 3, 4, 5 to switch Weapons. Mouse scroll does not work.
  • Grenades and Melee weapons can be used while incapped. Survivors appear to stand up to throw grenades, this can be prevented by having Left4DHooks installed.
  • Supports using Pills and Adrenaline to heal or revive a player, in version 1.16 and newer.


Weapon Fire Rate:
  • Recommended: WeaponHandling_API by Lux. Set wh_use_incap_cycle_cvar cvar to "0". This changes all weapon fire rates to their normal speed.
  • Alternatively set the games cvar survivor_incapacitated_cycle_time to "0.1" but this will modify it for all weapons and not return them to their correct speed.


Thanks:
  • xZk - For the original plugin and ideas.
  • Lux - For scripting advice and melee patch method.
  • MasterMind420 - For scripting advice.


Admin Commands: (requires "z" flag)

PHP Code:
sm_incap   // Incapacitated a player. Usage: [#userid|name] or no args to select self. 

Cvars:

Saved to l4d_incapped_weapons.cfg in your servers \cfg\sourcemod\ folder.

PHP Code:
// 0=Plugin off, 1=Plugin on.
l4d_incapped_weapons_allow "1"

// Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).
l4d_incapped_weapons_modes ""

// Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).
l4d_incapped_weapons_modes_off ""

// Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.
l4d_incapped_weapons_modes_tog "0"

// L4D2 only: 0.0=Off. How many seconds a player must wait after using Adrenaline to be revived.
l4d_incapped_weapons_delay_adren "5.0"

// 0.0=Off. How many seconds a player must wait after using Pills to be revived.
l4d_incapped_weapons_delay_pills "5.0"

// 0=Off. 1=Print to chat. 2=Print to hint box. Display to player how long until they are revived, when using a _delay cvar.
l4d_incapped_weapons_delay_text "2"

// 0.0=None. 1.0=Default damage. Scales an incapped Survivors friendly fire damage to other Survivors. Multiplied against the games survivor_friendly_fire* cvars.
l4d_incapped_weapons_friendly "1.0"

// L4D2 only: -1=Revive player. 0=Off. How much to heal a player when they use Adrenaline whilst incapped.
l4d_incapped_weapons_heal_adren "50"

// -1=Revive player. 0=Off. How much to heal a player when they use Pain Pills whilst incapped.
l4d_incapped_weapons_heal_pills "50"

// 0=Off. When reviving with healing items, should player enter black and white status. 1=Pills. 2=Adrenaline. 3=Both.
l4d_incapped_weapons_heal_revive "0"

// 0=Off. 1=Print to chat. 2=Print to hint box. Print a message when incapacitated that Pills/Adrenaline can be used to heal/revive.
l4d_incapped_weapons_heal_text "1"

// How much health to give a player when they revive themselves.
l4d_incapped_weapons_health "30"

// L4D2 only: 0=No friendly fire. 1=Allow friendly fire. When using Melee weapons should they hurt other Survivors.
l4d_incapped_weapons_melee "0"

// L4D2 only: 0=Don't give pistol (allows Melee weapons to be used). 1=Give pistol (game default).
l4d_incapped_weapons_pistol "0"

// Empty string to allow all. Prevent these weapon IDs from being used while incapped. See below for details.
// L4D2: default blocks all medkits/upgrade ammo. To block grenades add "13,14,25"
l4d_incapped_weapons_restrict "12,24,30,31"

// L4D1: default blocks medkits. To block grenades add "9,10" e.g: "8,12,9,10"
l4d_incapped_weapons_restrict "8"

// Play revive animation: 0=Off. 1=On and damage can stop reviving. 2=Damage will interrupt animation and restart reviving. 3=Damage does not interrupt reviving. 4=Give god mode when reviving
l4d_incapped_weapons_revive "3"

// 0=Block throwing grenade animation to prevent standing up during throw (requires Left4DHooks plugin). 1=Allow throwing animation.
l4d_incapped_weapons_throw "0"

// Incapped Weapons plugin version.
l4d_incapped_weapons_version 


Weapon Restriction Cvar:

The cvar l4d_incapped_weapons_restrict uses Weapon IDs to restrict their usage. String must be comma separated.

Complete list:

Spoiler



Changes:
Code:
1.34 (10-Jan-2024)
    - Changed the plugins on/off/mode cvars to use the "Left 4 DHooks" method instead of creating an entity.

1.33 (25-Oct-2023)
    - Now "l4d_incapped_weapons_revive" value "2" will interrupt reviving if the player tries to move left/right/forwards/backwards (forward cannot be not detected with Incapped Crawling).
    - Fixed command "sm_incap" not incapacitating someone if they had over 100 health.
    - Fixed being able to shoot while the revive animation was playing.

1.32 (25-Oct-2023)
    - Added cvar "l4d_incapped_weapons_revive" to put the player in 3rd person (L4D2 only) and play the revive animation. Thanks to "MasterMind420" for parts of the code and ideas.
    - Added command "sm_incap" to incapacitated yourself or targeted players.

1.31 (02-Oct-2023)
    - Fixed going AFK breaking self revive. Thanks to "Automage" for reporting.
    - Now the plugin will throw an error and prevent itself loading if any of the addresses are already patched.

1.30 (18-Aug-2023)
    - Added cvar "l4d_incapped_weapons_health" to set a players main health when they revive themselves. Requested by "Shao".
    - Now sets the players temporary health on revive to "survivor_revive_health" games cvar value.

1.29 (19-Jun-2023)
    - Fixed "CanDeploy" byte mis-match error. Thanks to "Mika Misori" for reporting.

1.28 (10-Mar-2023)
    - L4D2: Fixed grenade throwing animation not being blocked. Thanks to "BystanderZK" for reporting.

1.27 (20-Feb-2023)
    - L4D2: Fixed Survivors not taking damage from incapped players when reviving them. Thanks to "Lux" and "Psyk0tik" for help.
    - L4D2: GameData file updated.

1.26 (19-Feb-2023)
    - Various small fixes with late loading and unloading the plugin.
    - Fixed cvar "l4d_incapped_weapons_friendly" not correctly calculating damage applied to Survivors from weapons.
    - L4D2: Fixed Survivors not taking damage from incapped players. Thanks to "BystanderZK" for reporting and "Marttt" for testing on Linux.
    - L4D2: GameData file updated.

1.25 (10-Feb-2023)
    - Fixed error when "CanDeploy" is already patched, for whatever reason. Thanks to "knifeeeee" for reporting.

1.24 (24-Jan-2023)
    - Added cvar "l4d_incapped_weapons_friendly" to scale friendly fire damage from incapped Survivors. Requested by "choppledpickusfungus".

1.23 (08-Jan-2023)
    - Plugin now requires SourceMod 1.11 version of DHooks.
    - Plugin now requires "Left 4 DHooks Direct" plugin, used for Adrenaline and Reviving.
    - Fixed not always healing or reviving. Thanks to "BystanderZK" for reporting.
    - Fixed not always allowing pills and adrenaline while incapped, when health was above 100. Thanks to "apples1949" for reporting.
    - Added Simplified Chinese translations. Thanks to "apples1949" for providing.
    - Translations updated to use a better title instead of "[Revive]" when healing.
    - GameData file updated.

1.22 (24-Dec-2022)
    - Fixed printing the color codes instead of using them when translations are missing. Thanks to "HarryPotter" for reporting.
    - Fixed displaying hints about using Pills/Adrenaline when they are restricted. Thanks to "HarryPotter" for reporting.
    - Fixed infinite animation loop when holding mouse1 with Adrenaline. Thanks to "ForTheSakura" for reporting.
    - Fixed displaying the wrong hint for Adrenaline when revive option was set.

1.21 (21-Dec-2022)
    - Added cvars "l4d_incapped_weapons_delay_pills" and "l4d_incapped_weapons_delay_adren" to set a delay before reviving. Requested by "BystanderZK".
    - Added cvar "l4d_incapped_weapons_delay_text" to optionally display a hint when using a delayed revive.
    - Added cvar "l4d_incapped_weapons_heal_text" to display a hint about using pills or adrenaline when incapacitated.
    - Added optional translations support for delayed revive.

1.20 (12-Dec-2022)
    - Added cvar "l4d_incapped_weapons_heal_revive" to control if players should revive into black and white status. Requested by "BystanderZK".
    - Fixed cvar "l4d_incapped_weapons_throw" having inverted logic. Thanks to "BystanderZK" for reporting.
    - Fixed the PipeBomb effects not displaying. Thanks to "BystanderZK" for reporting.
    - Fixed taking pills in L4D1 not healing or reviving.
    - These changes are compatible with the "Heartbeat" plugin.

1.19 (09-Dec-2022)
    - Forgot to remove debug messages printing to chat. Thanks to "NoroHime" for reporting.

1.18 (06-Dec-2022)
    - Added extra checks when using Pills and Adrenaline.
    - Fixed equipping melee weapons reducing all damage given to other Survivors. Thanks to "gabuch2" for reporting.

1.17 (05-Dec-2022)
    - Fixed unhooking the wrong Think function, breaking the "pain_pills_health_threshold" cvar.
    - Changed cvars "l4d_incapped_weapons_heal_adren" and "l4d_incapped_weapons_heal_pills" to accept "-1" which will revive a player.

1.16 (05-Dec-2022)
    - Added feature to allow Pills and Adrenaline to be used while incapped. Requires the "Left 4 DHooks" plugin.
    - Added cvars "l4d_incapped_weapons_heal_adren" and "l4d_incapped_weapons_heal_pills" to control healing amount while incapped.

1.15 (22-Nov-2022)
    - Fixed cvar "l4d_incapped_weapons_throw" not preventing standing up animation when plugin is late loaded. Thanks to "TBK Duy" for reporting.

1.14 (12-Nov-2022)
    - Added cvar "l4d_incapped_weapons_throw" to optionally prevent the standing up animation when throwing grenades.
    - Now optionally uses "Left 4 DHooks" plugin to prevent standing up animation when throwing grenades.

1.13a (09-Jul-2021)
    - L4D2: Fixed GameData file from the "2.2.2.0" update.

1.13 (16-Jun-2021)
    - L4D2: Optimized plugin by resetting Melee damage hooks on map end and round start.
    - L4D2: Compatibility update for "2.2.1.3" update. Thanks to "Dragokas" for fixing.
    - GameData .txt file updated.

1.12 (08-Mar-2021)
    - Added cvar "l4d_incapped_weapons_melee" to control Melee weapon damage to Survivors. Thanks to "Mystik Spiral" for reporting.

1.11 (15-Jan-2021)
    - Fixed weapons being blocked when incapped and changing team. Thanks to "HarryPotter" for reporting.

1.10 (10-May-2020)
    - Added better error log message when gamedata file is missing.
    - Extra checks to prevent "IsAllowedGameMode" throwing errors.

1.9 (12-Apr-2020)
    - Now keeps the active weapon selected unless it's restricted.
    - Fixed not being able to switch to melee weapons.
    - Fixed pistols possibly disappearing sometimes.
    - Fixed potential of duped pistols when dropped after incap.
    - Extra checks to prevent "IsAllowedGameMode" throwing errors.

1.8 (09-Apr-2020)
    - Fixed again not always restricting weapons correctly on incap. Thanks to "MasterMind420" for reporting.

1.7 (08-Apr-2020)
    - Fixed not equipping melee weapons when allowed on incap.

1.6 (08-Apr-2020)
    - Fixed breaking pistols, due to the last update.

1.5 (08-Apr-2020)
    - Fixed ammo being wiped when incapped, due to 1.3 update. Thanks to "Dragokas" for reporting.
    - Fixed not always restricting weapons correctly on incap. Thanks to "MasterMind420" for reporting.

1.4 (07-Apr-2020)
    - Fixed throwing a pistol when dual wielding. Thanks to "MasterMind420" for reporting.

1.3 (07-Apr-2020)
    - Fixed not equipping a valid weapon when the last equipped weapon was restricted.
    - Removed the ability to block pistols.
    - Thanks to "MasterMind420" for reporting.

1.2 (07-Apr-2020)
    - Fixed L4D1 Linux crashing. Only the plugin updated. Thanks to "Dragokas" for testing.

1.1 (07-Apr-2020)
    - Fixed hooking the L4D2 pistol cvar in L4D1. Thanks to "Alliance" for reporting.

1.0 (06-Apr-2020)
    - Initial release.


Requirements:
  1. Left 4 DHooks Direct plugin.
  2. SourceMod version 1.11 or newer.


Installation:
DO NOT click 'Get Plugin' or it will fail to compile because this plugin requires Left 4 DHooks Direct!
  1. Download the .smx file and put into your servers \addons\sourcemod\plugins folder.
  2. Download the l4d_incapped_weapons.txt gamedata file and put into your servers \addons\sourcemod\gamedata\ folder.
  3. Download "translations_incapped_weapons.zip" and extract the "translations" folder to your servers \addons\sourcemod\ folder.


Updating from 1.23 or older:
  • New cvars have been added: use the Cvar Configs Updater, or delete the old cvars config or manually add them.

Updating from 1.29 or older:
  • GameData file must be updated.
Attached Files
File Type: zip translations_incapped_weapons.zip (1.1 KB, 1497 views)
File Type: txt l4d_incapped_weapons.txt (6.9 KB, 1250 views)
File Type: smx l4d_incapped_weapons.smx (25.7 KB, 184 views)
File Type: sp Get Plugin or Get Source (l4d_incapped_weapons.sp - 135 views - 66.3 KB)
__________________

Last edited by Silvers; 01-10-2024 at 13:12.
Silvers is offline
SkiPlix
Member
Join Date: Dec 2016
Location: Argentina
Old 04-06-2020 , 01:52   Re: [L4D & L4D2] Incapped Weapons Patch (1.0) [06-Apr-2020]
Reply With Quote #2

Finally
SkiPlix is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 04-06-2020 , 02:58   Re: [L4D & L4D2] Incapped Weapons Patch (1.0) [06-Apr-2020]
Reply With Quote #3

Nice, also while incapped, friendly fire seems to be deactivated, is it possible to add a toggle for this?
__________________
Marttt is offline
rekcah
Member
Join Date: Jun 2019
Old 04-06-2020 , 06:25   Re: [L4D & L4D2] Incapped Weapons Patch (1.0) [06-Apr-2020]
Reply With Quote #4

thankyou, works way better then the workshop addon I was using for incapped weapons, however I think the single shot shotguns may be bugged, I only tested briefly but it seemed like I couldn't freely swap back and forth between melee and shotgun.
rekcah is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-06-2020 , 20:34   Re: [L4D & L4D2] Incapped Weapons Patch (1.0) [06-Apr-2020]
Reply With Quote #5

Code:
1.1 (06-Apr-2020)
    - Fixed hooking the L4D2 pistol cvar in L4D1. Thanks to "Alliance" for reporting.

Quote:
Originally Posted by rekcah View Post
thankyou, works way better then the workshop addon I was using for incapped weapons, however I think the single shot shotguns may be bugged, I only tested briefly but it seemed like I couldn't freely swap back and forth between melee and shotgun.
Linux? I tested on Windows and could switch between all shotguns and melee etc. Can't see Linux being any different. Did you change the restriction cvar and block shotguns maybe?
__________________
Silvers is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-06-2020 , 23:06   Re: [L4D & L4D2] Incapped Weapons Patch (1.2) [07-Apr-2020]
Reply With Quote #6

Very useful. Thank you !!!
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
bullet28
Member
Join Date: Apr 2012
Old 04-07-2020 , 00:24   Re: [L4D & L4D2] Incapped Weapons Patch (1.2) [07-Apr-2020]
Reply With Quote #7

Great plugin, thank you! Have you tried to make weapon fire cycletime as normal? I wondering if changing nextAttack prop will be enough.. but if you haven't done this as variable maybe I shouldn't even try And I hope there will be some workaround in future updates for a throwing animation (mayble block anim at all), coz when character stand up for a throw it's looks a bit confusing. I've recorded a video in case you didn't know about this https://youtu.be/g-voYwWSrug

Last edited by bullet28; 04-07-2020 at 01:16.
bullet28 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-07-2020 , 02:00   Re: [L4D & L4D2] Incapped Weapons Patch (1.2) [07-Apr-2020]
Reply With Quote #8

Quote:
Originally Posted by bullet28 View Post
Great plugin, thank you! Have you tried to make weapon fire cycletime as normal? I wondering if changing nextAttack prop will be enough.. but if you haven't done this as variable maybe I shouldn't even try And I hope there will be some workaround in future updates for a throwing animation (mayble block anim at all), coz when character stand up for a throw it's looks a bit confusing. I've recorded a video in case you didn't know about this https://youtu.be/g-voYwWSrug
haha uhm not sure what can be done. Would have to require Left4DHooks to block/change the animation. I mean that could be optional requirement, so maybe I'll add. Thanks for notifying.

For weapon fire rates while incapped you can use: WeaponHandling_API by Lux. Or set survivor_incapacitated_cycle_time to "0.1".
__________________

Last edited by Silvers; 04-07-2020 at 16:19.
Silvers is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 04-07-2020 , 20:16   Re: [L4D & L4D2] Incapped Weapons Patch (1.4) [07-Apr-2020]
Reply With Quote #9

When you go incapped, number of reserve ammo become zero.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-08-2020 , 00:23   Re: [L4D & L4D2] Incapped Weapons Patch (1.5) [08-Apr-2020]
Reply With Quote #10

Thanks, fixed.

Code:
1.8 (09-Apr-2020)
    - Fixed again not always restricting weapons correctly on incap. Thanks to "MasterMind420" for reporting.

1.7 (08-Apr-2020)
    - Fixed not equipping melee weapons when allowed on incap.

1.6 (08-Apr-2020)
    - Fixed breaking pistols, due to the last update.

1.5 (08-Apr-2020)
    - Fixed ammo being wiped when incapped, due to 1.3 update. Thanks to "Dragokas" for reporting.
    - Fixed not always restricting weapons correctly on incap. Thanks to "MasterMind420" for reporting.
Now I think all these issues are finally fixes. Stupid index problems as usual, should it be != 0 or == 0. The simplest and most difficult side of programming sometimes.
__________________

Last edited by Silvers; 04-09-2020 at 07:12.
Silvers 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 06:53.


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