. Reverse Friendly-Fire (l4d_reverse_ff) by Mystik Spiral
Left4Dead(2) SourceMod plugin that reverses friendly-fire weapon damage.
Attacker takes damage, victim does not.
Do not allow griefers to cause friendly-fire damage to other players.
Incentivize all players to improve their shooting tactics and aim.
Description and options:
Reverses friendly-fire weapon damage for survivors and claw attacks for infected.
Does not reverse burn/blast damage, except for grenade launcher (see Suggestion section below).
Supports client language translation, currently English, French, Spanish, and Russian.
Please note the following for the true/false options below:
Regardless of the setting, the victim never takes damage from the attacker.
True means friendly-fire is reversed for that option and the attacker takes all of the damage.
False means friendy-fire is disabled for that option and the attacker does not take any damage.
Option to ReverseFF when attacker is an admin. [reverseff_admin (default: 0/false)]
Option to ReverseFF when victim is a bot. [reverseff_bot (default: 0/false)]
Option to ReverseFF when victim is incapacitated. [reverseff_incapped (default: 0/false)]
Option to ReverseFF when attacker is incapacitated. [reverseff_attackerincapped (default: 0/false)]
Option to ReverseFF when damage from mounted gun. [reverseff_mountedgun (default: 1/true)]
Option to ReverseFF when damage from melee weapon. [reverseff_melee (default: 1/true)]
Option to ReverseFF when damage from chainsaw. [reverseff_chainsaw (default: 1/true)]
Option to ReverseFF during Smoker pull or Charger carry. [reverseff_pullcarry (default: 0/false)]
Option to specify extra damage if attacker used explosive/incendiary ammo. [reverseff_multiplier (default: 1.125 = 12.5%)]
Option to specify percentage of damage reversed for survivor (0=min, 2=max). [reverseff_dmgmodifier (default: 1.0=damage unmodified)]
Option to specify percentage of damage reversed for infected (0=min, 2=max). [reverseff_dmgmodinfected (default: 1.0=damage unmodified)]
Option to specify maximum survivor damage allowed per chapter before kick/ban (0=disable). [reverseff_survivormaxdmg (default: 200)]
Option to specify maximum infected damage allowed per chapter before kick/ban (0=disable). [reverseff_infectedmaxdmg (default: 50)]
Option to specify maximum tank damage allowed per chapter before kick/ban (0=disable). [reverseff_tankmaxdmg (default: 300)]
Option to specify kick/ban duration in minutes. (0=permanent ban, -1=kick instead of ban). [reverseff_banduration (default: 10)]
Option to enable/disable plugin by game mode. [reverseff_modes_on, reverseff_modes_off, reverseff_modes_tog]
Without this plugin, if you shoot another player while they are being pulled by the Smoker (before they are choked) or while being carried by the Charger (before they are pummeled), it would trigger friendly-fire. Setting reverseff_pullcarry=0 allows you to turn this off, and is the default. If you shoot another player while they are pinned by the Hunter or Jockey, friendly-fire is blocked, regardless of the reverseff_pullcarry setting.
If you set reverseff_dmgmodifier=0, it effectively disables all friendly-fire. The default setting is 1, which does not modify the damage amount, just reverses it. Setting it lower than 1 reduces the damage reversed to the attacker, and setting it higher than 1 increases the damage reversed to the attacker.
To minimize griefer impact, use the Reverse Friendly-Fire plugin along with...
Smart reverse of burn damage from throwables, specifically molotovs.
Option to reverse blast damage, like pipe bombs.
When these three plugins are combined, griefers will usually get frustrated and leave since they cannot damage anyone other than themselves.
Although griefers will take significant damage, other players may not notice any difference in game play (except laughing at stupid griefer fails).
Chainsaw damage fix by pan0s
Game modes on/off/tog by Silvers
- Add damage modifier for infected (reverseff_dmgmodinfected) ConVar to decrease/increase reversed damage by a percentage.
-- Allows damage modifier to be set separately for infected and survivors.
- Ensure reverseff_dmgmod* ConVars have minimum value of 0 (no damage reverse) and maximum value of 2 (double damage reverse).
- When reverseff_dmgmod* is not 0 (no damage reverse) or 1 (unmodified damage reverse), ensure minimum inflicted damage is 1.
- Add Spanish (es) and Russian (ru) to existing English (en) and French (fr) translations.
Update history for older versions:
- Add damage modifier (reverseff_dmgmodifier) ConVar to decrease/increase reversed damage by a percentage.
-- 1=damage unmodified (default), <1 damage reduced, >1 damage increased, 0=no damage
-- 0.01=1% of actual dmg, 0.1=10% of actual dmg, 0.5=50% of actual dmg
-- 1.01=1% more dmg, 1.1=10% more dmg, 1.5=50% more dmg
- Fix regression when bot is attacker to remove hit/hurt sound/visual, even though no damage was actually done.
- Fix when attacker continually causes friendly-fire using translated language and would occasionally display some of the messages in English (not translated).
- In conjunction with the translation fix above, reduce the frequency of reverse friendly-fire messages.
-- The translated message fixes require you download the new l4d_reverse_ff_phrases.txt file and copy it to the left4dead/addons/sourcemod/translations directory.
- Fix by pan0s for server crash when chainsaw reverse damage causes incap or death.
-- Fixed regression caused by chainsaw fix (GetEdictClassname used with weapon values < 1).
-- Added a few optimizations to the chainsaw fix.
- Fix friendly-fire triggered during hunter pounce/jockey ride if attacker shoots victim instead of hunter/jockey.
- Fix reverse friendly-fire vocalizations and messages even though the damage is reversed...
-- The victim will vocalize an accusation against the attacker.
-- The attack message displayed will show correct victim and attacker.
-- If the attacker is using explosive/incendiary ammo, the victim will not stumble/burn, but the attacker will.
-- Due to this fix, the "reverseff_self" ConVar is no longer used and needs to be removed from the cfg file.
-- Remove "reverseff_self" entry from l4d_reverse_ff.cfg or just delete the file and let the plugin recreate it.
- Allow kick/ban feature to be disabled by setting reverseff_*maxdmg to 0.
- Add new ConVar option to ReverseFF during Smoker pull or Charger carry.
- Fixed ReverseFF when victim freed from Smoker tongue after pull started but before being choked.
- Shorten grace period (God Frames) from 2.5 seconds to 2.0 seconds.
- Add support for late load.
- Add new ConVar options for melee and chainsaw.
- Fix minor bug if player quit while pinned by special infected (hunter/smoker/jockey/charger).
- Check for two ReverseBurn plugins, and if found, only do a single combined announcement for all of them.
- Added colors to Announcement message and to messages displayed to attacker when friendly-fire is reversed.
- Changes above require new phrases download.
- Option to ReverseFF if attacker incapped (generally not needed except with "Incapped Weapons Patch" or similar).
[reverseff_attackerincapped (default: false)]
- Option to ReverseFF if damage from mounted gun.
[reverseff_mountedgun (default: true)]
- New L4D2 check before hooking L4D2-only events.
- New method to verify/load required translation file.
- New ConVar (reverseff_tankmaxdmg) since tanks do much more "friendly-fire" damage than other special infected.
- Modified cfg file default max damage values: reverseff_survivormaxdmg=200, reverseff_infectedmaxdmg=50, reverseff_tankmaxdmg=300
- Changed phrases file name to match standard naming conventions.
- Fixed issue where it sometimes tried to kick/ban a bot (thanks to Shadowart for reporting).
- Support for language translations, using new file "l4d_reverse_ff_phrases.txt".
· The translation file must be copied to the <left4dead(2)>\addons\sourcemod\translations directory.
· Includes translations for English and French, but "Mon Français est vraiment mauvais, désolé".
· If you have a better French translation, or any other language, please create a GitHub pull request.
- Annouce ReverseFF when player joins.
- Display ReverseFF chat message to attacker on friendly-fire.
- Ensure brief immunity from ReverseFF after victim freed from SI (hunter pounce, jockey ride, charger pummel, smoker choke).
- Cleaned-up cfg file descriptions for more clarity.
- Changed "reverseff_immunity" ConVar to "reverseff_admin" and flipped its meaning (to match other similar options).
- Enable/disable plugin by game mode with new ConVars: reverseff_modes_on, reverseff_modes_off, reverseff_modes_tog
· By default, all game modes are enabled.
· Examples of just a few of the many possible entries for game modes (includes default and custom mutations):
· For custom mutations, ensure your server already has the mutation installed and working correctly.
· Thank you to Silvers (SilverShot) for the game mode change detection code.
- Now reverses "friendly-fire" for infected team too.
- New ConVar for infected maximum damage per chapter before kick/ban. [reverseff_infectedmaxdmg (default: 110)]
- Renamed ConVar "reverseff_maxdamage" to indicate it is for survivors. [reverseff_survivormaxdmg (default: 180)]
- Increase max possible value for "reverseff_maxdamage" from "999" to "999999".
- Add option to kick instead of ban using "reverseff_banduration".
· "0" = permanent ban
· "-1" = kick instead of ban
- Option to treat friendly-fire as self-damage (or vocalize accusations). [reverseff_self (default: false)]
· false (0) = the attacker will vocally accuse the victim
· true (1) = will only vocalize pain sounds without accusations
- Option to reverse friendly-fire when victim is incapacitated. [reverseff_incapped (default: false)]
· false (0) = do not reverse friendly-fire if victim is shot while incapped
· true (1) = reverse friendly-fire if victim is shot while incapped
- Now reverses friendly-fire for mounted guns (mini-guns) too.
- Minor change to "reverseff_version" ConVar flag. (added FCVAR_NOTIFY for server queries)
- Option to specify maximum damage allowed per chapter before ban. [reverseff_maxdamage (default: 180)]
· Reset if player is kicked/banned
· Reset when player spawns into map (OnClientPutInServer)
- Option to specify ban duration in minutes when "reverseff_maxdamage" is exceeded [reverseff_banduration (default: 10)]
· 0 = permanent ban
- Added dynamically changeable ConVar. [reverseff_bot (default: 0)]
· false (0) = attacker does not have friendly-fire reversed when victim is a bot
· true (1) = reverse friendly-fire against all victims, human and bot
· Note that the victim (bot) does not take damage with either setting.
- Added detection for grenade launcher special ammo.
- Added dynamically changeable ConVars:
[reverseff_enabled (default: 1)]
· true (1) = enable plugin
· false (0) = disable plugin
[reverseff_immunity (default: 1)]
- Determine whether admins are immune to reverse friendly-fire.
· true (1) = admins are immune to reverse friendly-fire damage
· false (0) = admins are not immune to reverse friendly-fire damage
· Note that the victim does not take damage with either setting.
[reverseff_multiplier (default: 1.125)]
- Increase damage by this multiplier if explosive/incendiary ammo was used.
· "1.0" = normal, no extra damage
· "1.5" = 50% extra damage
· "2.0" = 100% extra damage (double damage)
· The default value of 1.125 results in 12.5% extra damage.
- Also added a standard ConVar [reverseff_version] that displays the plugin version.
- If attacker used incendiary/explosive ammo, increase damage to attacker by 12.5%.
- Initial release.
If you are upgrading from release 2.5 or lower, please note that you will need to manually remove the "reverseff_self" entry from the l4d_reverse_ff.cfg file, or just delete the l4d_reverse_ff.cfg file and let the plugin create a new one.
The phrases file changed in the 2.7 release, is REQUIRED, and must be downloaded/copied to the "addons\sourcemod\translations" directory.
I know there are many friendly-fire plugins out there already, but it has been my experience that most of them do not work at all or have too many bugs to be useful. I had been using one of those other plugins for a while, and fixed several bugs with it, but some things just could not be fixed (hooking player_hurt), so I created this new plugin using the new (SM 1.7+) syntax. This plugin hooks SDKHook_OnTakeDamage to intercept damage, and uses SDKHooks_TakeDamage to reverse the damage. Note that if you shoot a teammate with explosive ammo, you (the attacker) will be stumbled, not the victim. Similarly, if you shoot a teammate with incendiary ammo, you (the attacker) will be lit on fire for a few seconds, not the victim.
Last edited by Mystik Spiral; 12-21-2020 at 13:36.
If attacker weapon has incendiary/explosive ammo, increase damage to attacker by 12.5%.
I haven't yet figured out how to tell if the grenade launcher (projectile) has incendiary/explosive ammo, so there is no extra damage for that weapon yet. All other primary weapons should be working fine with higher damage when using special ammo. The special ammo extra damage is not a true reversal, but is a good compromise until/if I figure out how to directly reverse it.
this plugin is perfect for me
It would be possible to add a .cfg to activate or deactivate the immunity to the administrator or to control the weapon damage
It might be a while, but I would like to add some ConVars for that, and also to enable/disable the plugin. And as I mentioned in the last post, I also want to reverse damage for grenade launcher projectiles.
I was able to get to this sooner than expected and released version 1.2...
Added dynamically changeable ConVars:
reverseff_enabled: set to 1 to enable plugin, 0 to disable
reverseff_immunity: set to 1 to make admins immune to reverse FF damage, set to 0 to reverse FF damage for everyone
reverseff_multiplier: if attacker is using explosive or incendiary ammo, increase damage by this multiplier
default is 1.125 (12.5% extra damage), 1.0=no extra damage, 2.0=double damage
Also added a standard ConVar:
reverseff_version: shows the plugin version
If you are a server admin, and you have the admin system active on your client, you can change these ConVars during the middle of a game. For example, bring up a chat window and type...
!cvar reverseff_immunity 0
...to instantly make everyone, including admins, take reverse friendly-fire damage. Another example...
!cvar reverseff_multiplier 1.25
...to instantly make explosive/incendiary ammo do 25% more damage to the attacker than regular ammo.
Of course, the changes are not permanent. To make your changes permanent, edit the values in the cfg/sourcemod/l4d_reverse_ff.cfg file.
Last edited by Mystik Spiral; 12-09-2020 at 08:52.
Reason: add examples
New version 1.3 released, see original post for download.
Added new ConVar "reverseff_bot" to determine if friendly-fire against bots should have damage reversed. Default is no. I created this option because bots often move in unpredictable and stupid ways, including walking into your line of fire even when you are crouched and not moving. With the default value, only attacks against human victims will reverse damage.
The plugin now also detects when the grenade launcher has incendiary ammo and deals the appropriate (reverseff_multiplier) extra damage for it. Explosive ammo for the grenade launcher is not checked, because in my tests, there was no difference in the amount of damage between regular explosive ammo and explosive explosive ammo. I think that explosive explosive ammo for the grenade launcher may just expand the kill/stumble zone, but I'm not sure about that.
If you have an older version of the plugin installed, you will need to add an entry to the "l4d_reverse_ff.cfg file to use the new ConVar, but I recommend you just delete the cfg file and let the plugin create a new one for you.
Last edited by Mystik Spiral; 12-13-2020 at 18:14.