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

[L4D & L4D2] Reverse Friendly-Fire [v2.8.5 (07-Oct-2023)]


Post New Thread Reply   
 
Thread Tools Display Modes
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-19-2021 , 16:11   Re: [L4D2] Reverse Friendly-Fire [v1.6 (11-Jan-2021)]
Reply With Quote #21

Quote:
Originally Posted by Mystik Spiral View Post
I don't have an L4D1 server to do testing, but if someone can confirm it works properly, I'm certainly fine with adding it to the engine checks. Here is a draft version for someone to test and provide feedback.
You need to change this:
PHP Code:
if ( test != Engine_Left4Dead2 || test != Engine_Left4Dead 
to this:
PHP Code:
if ( test != Engine_Left4Dead2 && test != Engine_Left4Dead 
The way you currently have it will always fail in both games because the logic is that if the engine is NOT l4d1 OR l4d2, it will fail. So if I run it on l4d1, it will fail because the game is not l4d2. And if I run it on l4d2, it will fail because the game is not l4d1.

Left 4 Dead 1:
Code:
L 01/19/2021 - 13:08:04: SourceMod error session started
L 01/19/2021 - 13:08:04: Info (map "l4d_hospital01_apartment") (file "C:\l4d1ds\left4dead\addons\sourcemod\logs\errors_20210119.log")
L 01/19/2021 - 13:08:04: [SM] Failed to load plugin "l4d_reverse_ff.smx": Plugin only supports Left 4 Dead 1 & 2..
Left 4 Dead 2:
Code:
L 01/19/2021 - 13:09:42: SourceMod error session started
L 01/19/2021 - 13:09:42: Info (map "c8m1_apartment") (file "C:\l4d2ds\left4dead2\addons\sourcemod\logs\errors_20210119.log")
L 01/19/2021 - 13:09:42: [SM] Failed to load plugin "l4d_reverse_ff.smx": Plugin only supports Left 4 Dead 1 & 2..
__________________
Psyk0tik is offline
Maku
Member
Join Date: Dec 2020
Location: United Kingdom
Old 01-19-2021 , 19:27   Re: [L4D2] Reverse Friendly-Fire [v1.6 (11-Jan-2021)]
Reply With Quote #22

I ran into a slightly bug issue with a friend getting banned after shooting me accidentally once. Not sure if it is repeatable or it just bugged out.

Is there an option to prevent the kick or ban of a player?

Though, I did set the friendly fire limit to 999 which is more than enough for a single match not to get banned but somehow my friend got banned and I had to unban my friend.

Here's my settings:
Quote:
// This file was auto-generated by SourceMod (v1.10.0.6502)
// ConVars for plugin "l4d_reverse_ff.smx"


// Ban duration in minutes (0=permanent)
// -
// Default: "10"
// Minimum: "0.000000"
reverseff_banduration "1" // I have set this to 0.1 before my friend got banned which became permanent. So I had to unban my friend through the server itself.

// Reverse FF if victim is bot
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
reverseff_bot "0"

// Enable this plugin
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
reverseff_enabled "1"

// Admin immune to reversing FF
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
reverseff_immunity "1"

// Reverse FF if victim is incapped
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
reverseff_incapped "0"

// Maximum damage allowed before kicking
// -
// Default: "180"
// Minimum: "0.000000"
// Maximum: "999.000000"
reverseff_maxdamage "999"

// Special ammo damage multiplier
// -
// Default: "1.125"
// Minimum: "0.1"
// Maximum: "2.0"
reverseff_multiplier "1"
Maku is offline
kooper990
Member
Join Date: Jan 2021
Old 01-20-2021 , 00:34   Re: [L4D2] Reverse Friendly-Fire [v1.6 (11-Jan-2021)]
Reply With Quote #23

Can you re-enable the function where survivor can technically be affected by FF? By that, I mean with them still accusing the shooter and pop up message saying who shot who.
kooper990 is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 01-20-2021 , 09:25   Re: [L4D2] Reverse Friendly-Fire [v1.6 (11-Jan-2021)]
Reply With Quote #24

Quote:
Originally Posted by Crasher_3637 View Post
You need to change this:
PHP Code:
if ( test != Engine_Left4Dead2 || test != Engine_Left4Dead 
to this:
PHP Code:
if ( test != Engine_Left4Dead2 && test != Engine_Left4Dead 
The way you currently have it will always fail in both games because the logic is that if the engine is NOT l4d1 OR l4d2, it will fail. So if I run it on l4d1, it will fail because the game is not l4d2. And if I run it on l4d2, it will fail because the game is not l4d1.

Left 4 Dead 1:
Code:
L 01/19/2021 - 13:08:04: SourceMod error session started
L 01/19/2021 - 13:08:04: Info (map "l4d_hospital01_apartment") (file "C:\l4d1ds\left4dead\addons\sourcemod\logs\errors_20210119.log")
L 01/19/2021 - 13:08:04: [SM] Failed to load plugin "l4d_reverse_ff.smx": Plugin only supports Left 4 Dead 1 & 2..
Left 4 Dead 2:
Code:
L 01/19/2021 - 13:09:42: SourceMod error session started
L 01/19/2021 - 13:09:42: Info (map "c8m1_apartment") (file "C:\l4d2ds\left4dead2\addons\sourcemod\logs\errors_20210119.log")
 L 01/19/2021 - 13:09:42: [SM] Failed to load plugin "l4d_reverse_ff.smx": Plugin only supports Left 4 Dead 1 & 2..

Uh oh!

Instead of ANDing a double negative test as a failure, I decided to OR a double positive test as a success...

Code:
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
    EngineVersion test = GetEngineVersion();
    if ( test == Engine_Left4Dead2 || test == Engine_Left4Dead )
    {
        return APLRes_Success;
    }
    strcopy(error, err_max, "Plugin only supports Left 4 Dead 1 & 2.");
    return APLRes_SilentFailure;
 }
I confirmed this does load properly in L4D2...

Code:
sm plugins info 19
  Filename: l4d_reverse_ff.smx
  Title: [L4D & L4D2] Reverse Friendly-Fire (Team attacker takes friendly-fire damage, victim takes no damage.)
  Author: Mystic Spiral
  Version: 1.6.test2
  URL: https://forums.alliedmods.net/showthread.php?p=2727641#post2727641
  Status: running
  Timestamp: 01/20/2021 09:15:28
   Hash: fb3c097301a662c098db4de9c36ae43a
Thanks for pointing out that issue...it should be fixed now in the "1.6.test2" source attached to this post.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_reverse_ff.sp - 200 views - 9.0 KB)
__________________
Mystik Spiral is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 01-20-2021 , 09:55   Re: [L4D2] Reverse Friendly-Fire [v1.6 (11-Jan-2021)]
Reply With Quote #25

Quote:
Originally Posted by Maku View Post
I ran into a slightly bug issue with a friend getting banned after shooting me accidentally once. Not sure if it is repeatable or it just bugged out.

Is there an option to prevent the kick or ban of a player?

Though, I did set the friendly fire limit to 999 which is more than enough for a single match not to get banned but somehow my friend got banned and I had to unban my friend.

Here's my settings:

Do you have any other plugins that change weapon/damage values? Especially a plugin that increases weapon damage.


What do you have the friendly-fire damage values set to? From the server console, type in...


sm_cvar survivor_friendly_fire_factor_expert
sm_cvar survivor_friendly_fire_factor_hard
sm_cvar survivor_friendly_fire_factor_normal
sm_cvar survivor_friendly_fire_factor_easy



If you would like to pursue this issue further, I have attached a debug version of the plugin that will print to the server console every time there is friendly-fire. It will show the attacker's name (Atk), current damage (Dmg), the accumulated damage for that player (AcmDmg), and the maximum allowed damage value (MaxDmg). Please keep in mind that some weapons will show multiple entries... like the shotgun which will display a separate damage value for each pellet that hits.
Attached Files
File Type: sp Get Plugin or Get Source (l4d_reverse_ff.sp - 166 views - 9.0 KB)
__________________
Mystik Spiral is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 01-20-2021 , 10:10   Re: [L4D2] Reverse Friendly-Fire [v1.6 (11-Jan-2021)]
Reply With Quote #26

Quote:
Originally Posted by kooper990 View Post
Can you re-enable the function where survivor can technically be affected by FF? By that, I mean with them still accusing the shooter and pop up message saying who shot who.

I can do that, yes. However, because damage is reversed, please be aware that the accusations will be backwards (which is why I removed it). That is, the attacker will complain about being shot by the victim. I'll create a new cvar to control whether the friendly-fire is treated as self-damage or reversed accusations.


How does that sound?
__________________
Mystik Spiral is offline
kooper990
Member
Join Date: Jan 2021
Old 01-20-2021 , 11:42   Re: [L4D2] Reverse Friendly-Fire [v1.6 (11-Jan-2021)]
Reply With Quote #27

Quote:
Originally Posted by Mystik Spiral View Post
I can do that, yes. However, because damage is reversed, please be aware that the accusations will be backwards (which is why I removed it). That is, the attacker will complain about being shot by the victim. I'll create a new cvar to control whether the friendly-fire is treated as self-damage or reversed accusations.


How does that sound?
Yeah, that sounds fine to me.
kooper990 is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 01-20-2021 , 12:18   Re: [L4D2] Reverse Friendly-Fire [v1.7 (20-Jan-2021)]
Reply With Quote #28

New version 1.7 released, see original post for download.


20-Jan-2021 v1.7
- Option to treat friendly-fire as self-damage. [reverseff_self (default: false)]


If reverseff_self is set to 1 (true) then the damage to the attacker will be treated as self-damage (no vocal accusations). If reverseff_self is set to 0 (false) then the damage to the attacker will be vocalized reversed, that is, the attacker will accuse the victim.


- Also added support for L4D1.
__________________
Mystik Spiral is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-20-2021 , 12:42   Re: [L4D2] Reverse Friendly-Fire [v1.7 (20-Jan-2021)]
Reply With Quote #29

Quote:
Originally Posted by Mystik Spiral View Post
New version 1.7 released, see original post for download.


20-Jan-2021 v1.7
- Option to treat friendly-fire as self-damage. [reverseff_self (default: false)]


If reverseff_self is set to 1 (true) then the damage to the attacker will be treated as self-damage (no vocal accusations). If reverseff_self is set to 0 (false) then the damage to the attacker will be vocalized reversed, that is, the attacker will accuse the victim.


- Also added support for L4D1.
I tested 1.6.test2 and 1.7 and can confirm that both of them loaded fine on both games. I haven't tested the plugin's features on L4D1 though.
__________________
Psyk0tik is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 01-20-2021 , 12:57   Re: [L4D2] Reverse Friendly-Fire [v1.7 (20-Jan-2021)]
Reply With Quote #30

Quote:
Originally Posted by Crasher_3637 View Post
I tested 1.6.test2 and 1.7 and can confirm that both of them loaded fine on both games. I haven't tested the plugin's features on L4D1 though.

Thank you for testing on L4D1.
__________________
Mystik Spiral 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 00:42.


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