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

[L4D & L4D2] No Friendly-fire (v9.0, 10-10-2021)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Psyk0tik
AlliedModders Donor
Join Date: May 2012
Location: Homeless
Plugin ID:
5909
Plugin Version:
9.0
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    74 
    Plugin Description:
    Disables friendly fire.
    Old 11-12-2017 , 05:32   [L4D & L4D2] No Friendly-fire (v9.0, 10-10-2021)
    Reply With Quote #1



    Rate this plugin

    Donate to Motivate

    Introduction

    Disables friendly fire.

    Requirements

    1. SourceMod 1.9 or higher
    2. Recommended: [L4D & L4D2] Explosive Chains Credit

    Installation

    1. Delete files from old versions of the plugin.
    2. Extract the folder inside the .zip file.
    3. Place all the contents into their respective folders.
    4. If prompted to replace or merge anything, click yes.
    5. Load up "No Friendly-Fire" by doing one of the following:
    - Type "sm_rcon sm plugins unload no_friendly-fire" in console.
    - Restart the server.
    6. Customize "No Friendly-Fire" (Config file generated on first load).

    Uninstalling/Upgrading to Newer Versions

    1. Delete "no_friendly-fire.smx" from "addons/sourcemod/plugins" folder.
    2. Delete "no_friendly-fire.sp" from "addons/sourcemod/scripting" folder.
    3. Delete "no_friendly-fire.cfg" from "cfg/sourcemod" folder.
    4. Follow the Installation guide above. (Only for upgrading to newer versions.)

    Disabling

    1. Move "no_friendly-fire.smx" to "plugins/disabled" folder.
    2. Unload "No Friendly-Fire" by doing one of the following:
    - Type "sm_rcon sm plugins unload no_friendly-fire" in console.
    - Restart the server.

    Resources

    The README on GitHub contains all the information you need to know about No Friendly-Fire. If there's something that hasn't been addressed that you're concerned about, feel free to ask on this thread.

    View the CHANGELOG.

    Source | Latest Version | All Official Releases
    Attached Files
    File Type: sp Get Plugin or Get Source (no_friendly-fire.sp - 116 views - 14.3 KB)
    __________________
    AFK like JFK
    --
    Donate to Motivate
    --
    Get latest L4D/L4D2 gamedata signatures here.
    --
    PM me if you need help with finding signatures and/or offsets in the following games: L4D1&2/CSGO/TF2/NMRIH/INS/DODS/CSS/HL2DM

    Last edited by Psyk0tik; 10-11-2021 at 02:28. Reason: Updated to v9.0
    Psyk0tik is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Brexit
    Old 11-12-2017 , 05:53   Re: [L4D & L4D2] No Friendly Fire
    Reply With Quote #2

    I see an issue from reading the code.
    Mastermind did the same thing as you forget about people throwing a molotov and changing team or leaving the server will cause damage to people.

    You should consider saving an entity reference of the fire and check it to stop that from happening
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D
    Lux is offline
    Psyk0tik
    AlliedModders Donor
    Join Date: May 2012
    Location: Homeless
    Old 11-12-2017 , 15:02   Re: [L4D & L4D2] No Friendly Fire
    Reply With Quote #3

    Quote:
    Originally Posted by Lux View Post
    I see an issue from reading the code.
    Mastermind did the same thing as you forget about people throwing a molotov and changing team or leaving the server will cause damage to people.

    You should consider saving an entity reference of the fire and check it to stop that from happening
    How would I go about doing that? I read the wiki but I'm not exactly sure how to integrate it into the plugin.

    Also thanks for the information!
    __________________
    AFK like JFK
    --
    Donate to Motivate
    --
    Get latest L4D/L4D2 gamedata signatures here.
    --
    PM me if you need help with finding signatures and/or offsets in the following games: L4D1&2/CSGO/TF2/NMRIH/INS/DODS/CSS/HL2DM
    Psyk0tik is offline
    Psyk0tik
    AlliedModders Donor
    Join Date: May 2012
    Location: Homeless
    Old 11-24-2017 , 22:45   Re: [L4D & L4D2] No Friendly Fire
    Reply With Quote #4

    Quote:
    Originally Posted by cravenge View Post
    Here, Crasher. I added a check for explosive barrels and for players who disconnect or changes team but I'm not sure if it's accurate. Just post feedback/bugs as I can't test it right now.
    When it comes to damaging other survivors, everything works. When it comes to damaging infected, they seem to be invincible and I get the errors in the attached log file.

    The errors have to do with line 40:
    PHP Code:
            if ((IsSurvivor(victim) && IsSurvivor(attacker)) || (attacker != && (!IsClientInGame(attacker) || GetClientTeam(attacker) != GetClientTeam(victim)))) 


    EDIT: I was able to figure out how I was getting those errors as well as how to fix them.

    I changed line 40 to:
    PHP Code:
            if((IsSurvivor(victim) && IsSurvivor(attacker)) || (attacker != && (!IsClientInGame(attacker) || (IsInfected(attacker) || IsSpectator(attacker))))) 
    I also changed line 51 from:
    PHP Code:
            if (!pFFBarrel.BoolValue && StrContains(sInflictorClass"prop_fuel_barrel"false) != -&& (IsSurvivor(attacker) || (attacker != && (!IsClientInGame(attacker) || GetClientTeam(attacker) != GetClientTeam(victim))))) 
    to this:
    PHP Code:
            if(!pFFBarrel.BoolValue && StrContains(sInflictorClass"prop_fuel_barrel"false) > && (IsSurvivor(attacker) || (attacker != && (!IsClientInGame(attacker) || (IsInfected(attacker) || IsSpectator(attacker)))))) 
    However, this still generated errors when I turned on 1 of the cvars. I found out that turning on the explosive barrels cvar would not work or would give errors if the other 2 cvars were off. The same thing happened when setting l4d_friendlyfire_fire to 1 while l4d_friendlyfire was 0.

    To solve this issue, I simply hooked all 3 checks to just 1 cvar since it seems that all 3 need each other to function properly. This now gives the whole "disable firendly fire completely" feeling.

    TL;DR:
    Your version:
    1. SI are invincible.
    2. Errors in the logs.
    3. Explosive barrels do not recognize bots and the check does not work properly.

    Your version with my revisions:
    1. SI are killable.
    2. No errors in the logs.
    3. Explosive barrels now detect bots and the check works properly.


    You can see exactly what I did once I update the source code in the main post.
    Attached Files
    File Type: log errors_20171124.log (52.6 KB, 424 views)
    __________________
    AFK like JFK
    --
    Donate to Motivate
    --
    Get latest L4D/L4D2 gamedata signatures here.
    --
    PM me if you need help with finding signatures and/or offsets in the following games: L4D1&2/CSGO/TF2/NMRIH/INS/DODS/CSS/HL2DM

    Last edited by Psyk0tik; 11-25-2017 at 19:41.
    Psyk0tik is offline
    Psyk0tik
    AlliedModders Donor
    Join Date: May 2012
    Location: Homeless
    Old 11-25-2017 , 06:54   Re: [L4D & L4D2] No Friendly Fire (v2.0, 11-25-2017)
    Reply With Quote #5

    Version 2.0 is out!

    Changes

    1. Implemented cravenge's entity reference check and explosive barrel check.
    2. Removed cvar l4d_friendlyfire_fire.
    3. Hid cvar l4d_friendlyfire_version and renamed it to l4d_nff_version.
    4. Renamed cvar l4d_friendlyfire to l4d_nff.
    5. Fire from explosive barrels no longer damage players (but the explosion still does).
    6. Molotovs thrown by players that then switch teams or disconnect no longer do damage.

    Please redownload the plugin from the first post and delete your l4d_nofriendlyfire.cfg file!
    __________________
    AFK like JFK
    --
    Donate to Motivate
    --
    Get latest L4D/L4D2 gamedata signatures here.
    --
    PM me if you need help with finding signatures and/or offsets in the following games: L4D1&2/CSGO/TF2/NMRIH/INS/DODS/CSS/HL2DM

    Last edited by Psyk0tik; 11-25-2017 at 06:55.
    Psyk0tik is offline
    Psyk0tik
    AlliedModders Donor
    Join Date: May 2012
    Location: Homeless
    Old 11-25-2017 , 17:01   Re: [L4D & L4D2] No Friendly Fire (v2.0, 11-25-2017)
    Reply With Quote #6

    Quote:
    Originally Posted by cravenge View Post
    Okay, Crasher. Seen your changes and d(^_^)b. Here I played with some stuff for the explosive barrel explosion, optimized your code changes, and a check for the convar in case it changes so players won't notice something strange like enabling it and finding out the plugin doesn't work unless they vote for a campaign restart.

    Please test it.
    The plugin cannot compile because "HookSingleEntityOutput" and "UnhookSingleEntityOutput" are not defined.
    __________________
    AFK like JFK
    --
    Donate to Motivate
    --
    Get latest L4D/L4D2 gamedata signatures here.
    --
    PM me if you need help with finding signatures and/or offsets in the following games: L4D1&2/CSGO/TF2/NMRIH/INS/DODS/CSS/HL2DM
    Psyk0tik is offline
    cravenge
    Veteran Member
    Join Date: Nov 2015
    Location: Middle of Nowhere
    Old 11-25-2017 , 22:41   Re: [L4D & L4D2] No Friendly Fire (v2.0, 11-25-2017)
    Reply With Quote #7

    Whoops, my bad! Here you go, I forgot including SDKTools before posting.
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d_nofriendlyfire.sp - 1448 views - 4.0 KB)

    Last edited by cravenge; 11-25-2017 at 22:42.
    cravenge is offline
    Psyk0tik
    AlliedModders Donor
    Join Date: May 2012
    Location: Homeless
    Old 11-25-2017 , 22:43   Re: [L4D & L4D2] No Friendly Fire (v2.0, 11-25-2017)
    Reply With Quote #8

    Quote:
    Originally Posted by cravenge View Post
    Whoops, my bad! Here you go, I forgot including SDKTools before posting.
    Okay it compiled. I'll test it out tonight. Thanks man!
    __________________
    AFK like JFK
    --
    Donate to Motivate
    --
    Get latest L4D/L4D2 gamedata signatures here.
    --
    PM me if you need help with finding signatures and/or offsets in the following games: L4D1&2/CSGO/TF2/NMRIH/INS/DODS/CSS/HL2DM
    Psyk0tik is offline
    Psyk0tik
    AlliedModders Donor
    Join Date: May 2012
    Location: Homeless
    Old 11-25-2017 , 23:15   Re: [L4D & L4D2] No Friendly Fire (v2.0, 11-25-2017)
    Reply With Quote #9

    Quote:
    Originally Posted by cravenge View Post
    Whoops, my bad! Here you go, I forgot including SDKTools before posting.
    Here's what I've observed (keep in mind that I tested this on a local server with bots).

    1. When the difficulty is set to Normal and l4d_nff is set to 0.
    - Bots still take damage.
    - My character doesn't take damage.
    - Logs are filled with errors about invalid client indices.

    2. When the difficulty is set to Advanced or Expert and l4d_nff is set to 0.
    - Bots still take damage.
    - My character takes damage.
    - Logs are filled with errors about invalid client indices.

    3. When the difficulty is set to Normal and l4d_nff is set to 1.
    - Bots take damage.
    - My character doesn't take damage.
    - No log errors.

    4. When the difficulty is set to Advanced or Expert and l4d_nff is set to 1.
    - Bots take damage.
    - My character takes damage.
    - No log errors.
    __________________
    AFK like JFK
    --
    Donate to Motivate
    --
    Get latest L4D/L4D2 gamedata signatures here.
    --
    PM me if you need help with finding signatures and/or offsets in the following games: L4D1&2/CSGO/TF2/NMRIH/INS/DODS/CSS/HL2DM

    Last edited by Psyk0tik; 11-25-2017 at 23:47.
    Psyk0tik is offline
    Lux
    Veteran Member
    Join Date: Jan 2015
    Location: Brexit
    Old 11-26-2017 , 00:59   Re: [L4D & L4D2] No Friendly Fire (v2.0, 11-25-2017)
    Reply With Quote #10

    I use these cvars on my server to disable friendly fire, it's a simple way for all survivors not to kill each other.

    Thought i would share

    PHP Code:
    #include <sourcemod>
    #include <sdktools>

    public Plugin:myinfo =
    {
        
    name "RemoveFF",
        
    author "Lux",
        
    description "",
        
    version "",
        
    url ""
    };

    public 
    OnPluginStart()
    {
        
    HookEvent("round_start"RoundStart);
        
    HookEvent("round_end"RoundStart);
    }

    public 
    Action:RoundStart(Handle:event, const String:name[], bool:dontBroadcast
    {
        
    SetConVarString(FindConVar("survivor_friendly_fire_factor_easy"), "0");
        
    SetConVarString(FindConVar("survivor_friendly_fire_factor_expert"), "0");
        
    SetConVarString(FindConVar("survivor_friendly_fire_factor_hard"), "0");
        
    SetConVarString(FindConVar("survivor_friendly_fire_factor_normal"), "0");
        
    SetConVarString(FindConVar("grenadelauncher_ff_scale"), "0");
        
    SetConVarString(FindConVar("survivor_burn_factor_easy"), "0");
        
    SetConVarString(FindConVar("survivor_burn_factor_normal"), "0");
        
    SetConVarString(FindConVar("survivor_burn_factor_hard"), "0");
        
    SetConVarString(FindConVar("survivor_burn_factor_expert"), "0");

    Note the cvars stop self damage from explosive ammo too
    Attached Files
    File Type: sp Get Plugin or Get Source (removeFF.sp - 1316 views - 988 Bytes)
    __________________
    Connect
    My Plugins: KlickME
    [My GitHub]

    Commission me for L4D

    Last edited by Lux; 11-26-2017 at 01:04.
    Lux 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 18:59.


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