// Show up a FriendlyFire or type killing message -=Musc@t=-
Class FriendlyFireGameRules extends GameRules;
var bool bTeamkillerDie, //Kill TeamKiller
bKickTeamKiller, //Kick TeamKiller
bTraitorSwitch, //Traitor switchteam
bInjuredSeeMessages; //Injured players see Team Kill messages
var int LowerScoreLimit, // lower negative score before the Kick
MaxTeammateFrag, // Max Teammate frag before the Kick
MaxTraitorFrag; // Max Teammate frag before the switchteam
var float FriendlyFireScale;
var bool bFixTeamDamage;
function PostBeginPlay()
{
super.PostBeginPlay();
FriendlyFireScale = XMPGame(Level.game).TeamDamage;
if (Level.game.Version <= 6497)
bFixTeamDamage = True;
else
bFixTeamDamage = False;
}
function String RemColorCode(string name)
{
local int i;
local string tag;
tag = "^#";
i = InStr(name, tag);
while (i != -1)
{
name = Left(name, i)$Right(name, Len(name)-i-3);
i = InStr(name, tag);
}
Return name;
}
function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
{
local bool bTypeKilling, bTeamKilling;
local playercontroller P;
bTeamKilling=False;
bTypeKilling=False;
if (instigatedBy != None && Damagetype != None && instigatedBy != injured && instigatedBy.playerReplicationInfo != None )
{
if ( instigatedBy.SameTeam(injured) )
{
if (bFixTeamDamage)
{
Momentum *= 0.3;
Damage *= FriendlyFireScale;
}
if (PlayerController(instigatedBy.controller) != None )
{
if (FriendlyFireScale > 0)
{
if (injured.health > Damage && Damagetype != class'Crushed' && Damagetype != class'DamageTypeBiologicalGas' && Damagetype != class'DamageTypeImpact')
{
Playercontroller(instigatedBy.controller).ReceiveLocalizedMessage(class'TkMutatorMessage',6, instigatedBy.controller.PlayerReplicationInfo);
}
else if (injured.Health - Damage <= 0)
{
Playercontroller(instigatedBy.controller).ReceiveLocalizedMessage(class'TkMutatorMessage',8, instigatedBy.controller.PlayerReplicationInfo);
bTeamKilling = true;
}
}
else if (Damagetype != class'Crushed' && Damagetype != class'DamageTypeBiologicalGas' && Damagetype != class'DamageTypeImpact' )
Playercontroller(instigatedBy.controller).ReceiveLocalizedMessage(class'TkMutatorMessage',6, instigatedBy.controller.PlayerReplicationInfo);
if (Damagetype == class'Crushed')
Playercontroller(instigatedBy.controller).ReceiveLocalizedMessage(class'TkMutatorMessage',12, instigatedBy.controller.PlayerReplicationInfo);
}
if (bInjuredSeeMessages && PlayerController(injured.controller) != None)
{
if (FriendlyFireScale > 0)
{
if (injured.health > Damage && Damagetype != class'Crushed' && Damagetype != class'DamageTypeBiologicalGas' && Damagetype != class'DamageTypeImpact')
{
Playercontroller(injured.controller).ReceiveLocalizedMessage(class'TkMutatorMessage',7, injured.controller.PlayerReplicationInfo);
}
else if (injured.Health - Damage <= 0)
{
Playercontroller(injured.controller).ReceiveLocalizedMessage(class'TkMutatorMessage',9, injured.controller.PlayerReplicationInfo);
bTeamKilling = true;
}
}
else if (Damagetype != class'Crushed' && Damagetype != class'DamageTypeBiologicalGas' && Damagetype != class'DamageTypeImpact')
Playercontroller(injured.controller).ReceiveLocalizedMessage(class'TkMutatorMessage',7, injured.controller.PlayerReplicationInfo);
if (Damagetype == class'Crushed')
Playercontroller(injured.controller).ReceiveLocalizedMessage(class'TkMutatorMessage',13, injured.controller.PlayerReplicationInfo);
}
if (bTeamKilling && instigatedBy.playerReplicationInfo != None && instigatedBy.controller != None)
{
bTeamKilling = False;
/*if (Playercontroller(instigatedBy.controller) != None && Playercontroller(injured.controller) != None)
Log("--------------------------------->Killer:"$RemColorCode(instigatedBy.GetPlayerName())$" Killed:"$RemColorCode(injured.GetPlayerName()),'TEAM KILLING');
else if (Playercontroller(instigatedBy.controller) == None && Playercontroller(injured.controller) != None)
Log("-------------(Bot)--------------->Killer: It's a bot Killed:"$RemColorCode(injured.GetPlayerName()),'TEAM KILLING');
else if (Playercontroller(instigatedBy.controller) != None && Playercontroller(injured.controller) == None)
Log("-------------(Bot)--------------->Killer:"$RemColorCode(instigatedBy.GetPlayerName())$" Killed: It's a bot",'TEAM KILLING');
else
Log("-------------(Bot)--------------->Killer: It's a bot Killed: It's a bot",'TEAM KILLING');*/
P = playercontroller(instigatedBy.controller);
// StatPlrScore[37] is the teammate killing score
if (bKickTeamKiller && (P.PlayerReplicationInfo.score <= LowerScoreLimit || P.PlayerReplicationInfo.StatPlrScore[37] >= MaxTeammateFrag))
{
/*Log("--------------------------------->Kicked: "$RemColorCode(instigatedBy.GetPlayerName())$" Score: "$P.PlayerReplicationInfo.score$" IP: "$P.GetPlayerNetworkAddress(),'TEAM KILLING');*/
Level.Game.BroadcastDeathMessage(injured.Controller, instigatedBy.Controller, class'DamTypeKicked');
Level.Game.Kick(P.PlayerReplicationInfo);
}
else if (bTraitorSwitch && P.PlayerReplicationInfo.StatPlrScore[37] == MaxTraitorFrag)
{
P.ReceiveLocalizedMessage(class'TkMutatorMessage',11, instigatedBy.controller.PlayerReplicationInfo);
Level.Game.BroadcastDeathMessage(injured.Controller, instigatedBy.Controller, class'DamTypeTraitor');
if ( (P.PlayerReplicationInfo.Team == None) || (P.PlayerReplicationInfo.Team.TeamIndex == 1) )
P.ChangeTeam(0);
else
P.ChangeTeam(1);
P.PlayerReplicationInfo.StatPlrScore[37] = MaxTraitorFrag+1;
}
else if (bKickTeamKiller && P.PlayerReplicationInfo.StatPlrScore[37] == MaxTeammateFrag-1)
P.ReceiveLocalizedMessage(class'TkMutatorMessage',10, instigatedBy.controller.PlayerReplicationInfo);
Level.Game.BroadcastDeathMessage(injured.Controller, instigatedBy.Controller, class'DamTypeTeamKilling');
if (bTeamKillerDie)
{
P.suicide();
}
}
}
}
if ( NextGameRules != None )
return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType );
return Damage;
}
defaultproperties
{
bKickTeamKiller=True
bInjuredSeeMessages=True
LowerScoreLimit=-2000
MaxTeammateFrag=5
MaxTraitorFrag=3
}