PDA

View Full Version : Damage through Teammate/Enemy



serthy
10th June 2020, 18:04
Hey,

we just had a discussion about a possible cheater, he shot THROUGH a TEAMMATE and killed a guy behind.
As far as I can remember, you can shoot through an ENEMY and damage/kill two or more player.
You can also shoot through a teammate and damage/kill your teammate and an enemy at the same time,
however, only if friendly fire is set to not 0.

So I looked through the vanilla game files and couldn't find where it actually determines when friendly fire is on, that the bullet stops at your teammate and does not go any further.

Here is a snippet from tdm.gsc:


Callback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime)
{
if(self.sessionteam == "spectator")
return;

// Don't do knockback if the damage direction was not specified
if(!isdefined(vDir))
iDFlags |= level.iDFLAGS_NO_KNOCKBACK;

friendly = undefined;

// check for completely getting out of the damage
if(!(iDFlags & level.iDFLAGS_NO_PROTECTION))
{
if(isPlayer(eAttacker) && (self != eAttacker) && (self.pers["team"] == eAttacker.pers["team"]))
{
if(level.friendlyfire == "0")
{
return;
}
else if(level.friendlyfire == "1")
{
// Make sure at least one point of damage is done
if(iDamage < 1)
iDamage = 1;

self finishPlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime);

// Shellshock/Rumble
self thread maps\mp\gametypes\_shellshock::shellshockOnDamage( sMeansOfDeath, iDamage);
self playrumble("damage_heavy");
}

Maybe I dont see it.. can it be, that friendlyfire is somehow special?

So I looked how it got set and found this in _serversettings.gsc:


level.friendlyfire = getCvar("scr_friendlyfire");
if(level.friendlyfire == "")
level.friendlyfire = "0";
setCvar("scr_friendlyfire", level.friendlyfire, true);
Why has setCvar 3 parameters?

maxdamage99
11th June 2020, 07:02
If you are sure and checked everything, then most likely the case "finishPlayerDamage".

I looked at the code in the decompile version, it is very similar if I do not confuse something with the effect of a bullet shot, but if i true remember of it is created without the participation of the function: codecallback_playerdamage->finishDamage (example: spawnprotection break this callback -> bullet effect exist)

1.0


sub_80F8A04

1.2


sub_80FB02C

1.3


sub_80FB170