View Single Post
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 11-24-2017 , 21: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, 683 views)
__________________

Last edited by Psyk0tik; 11-25-2017 at 18:41.
Psyk0tik is offline