Team Killer Kick Mutator. Mutator Autokick for killing players
The only variable is output to the TeamKillerKickMut.ini file
MaxAllowedToKill
If more than MaxAllowedToKill players are killed during the map, the session is kicked
class TeamKillerKickMut extends Mutator config(TeamKillerKickMut);
struct killerStruct
{
var PlayerController PC;
var int killed;
};
var array<killerStruct> killers;
var config int MaxAllowedToKill;
function PostBeginPlay()
{
local TKKickGameRules RulesMod;
SaveConfig();
if( RulesMod==None )
RulesMod = Spawn(Class'TKKickGameRules');
RulesMod.mut=self;
if(KFGameType(Level.Game)==None) Destroyed();
SetTimer(1.0,true);
Super.PostBeginPlay();
}
function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
local killerStruct ks;
if( PlayerController(Other)!=None )
{
ks.PC=PlayerController(Other);
killers[killers.Length]=ks;
}
return true;
}
function Timer()
{
local int i;
for(i=0;i<killers.Length;i++)
{
if(killers[i].killed>MaxAllowedToKill)
{
killers[i].killed=0;
SessionKick(killers[i].PC);
}
}
}
function IncreaseKills(PlayerController PC)
{
local int i;
for(i=0;i<killers.Length;i++)
if(killers[i].PC==PC)
killers[i].killed++;
}
function SessionKick(PlayerController PC)
{
local AccessControl Manager;
if (Level.Game.AccessControl != None)
Manager = Level.Game.AccessControl;
Manager.BanPlayer(PC, true);
}
defaultproperties
{
MaxAllowedToKill=5
bAddToServerPackages=True
GroupName="KF-TeamKillerKickMut"
FriendlyName="TeamKillerKickMut"
Description="TeamKillerKickMut"
}
Update 04/03/2014 Added exception array Add array elements to the ini file, like
ExceptionList=7656119805137844
class TeamKillerKickMut extends Mutator config(TeamKillerKickMut);
struct killerStruct
{
var PlayerController PC;
var int killed;
};
var array<killerStruct> killers;
var config array<string> ExceptionList;
var config int MaxAllowedToKill;
function PostBeginPlay()
{
local TKKickGameRules RulesMod;
SaveConfig();
if( RulesMod==None )
RulesMod = Spawn(Class'TKKickGameRules');
RulesMod.mut=self;
if(KFGameType(Level.Game)==None) Destroyed();
SetTimer(1.0,true);
Super.PostBeginPlay();
}
function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
local killerStruct ks;
if( PlayerController(Other)!=None )
{
ks.PC=PlayerController(Other);
killers[killers.Length]=ks;
}
return true;
}
function Timer()
{
local int i;
for(i=0;i<killers.Length;i++)
{
if(killers[i].killed>MaxAllowedToKill)
{
killers[i].killed=0;
SessionKick(killers[i].PC);
}
}
}
function IncreaseKills(PlayerController PC)
{
local int i;
for(i=0;i<killers.Length;i++)
if(killers[i].PC==PC)
killers[i].killed++;
}
function SessionKick(PlayerController PC)
{
local AccessControl Manager;
if (Level.Game.AccessControl != None)
Manager = Level.Game.AccessControl;
if(!InList(PC.GetPlayerIDHash()))
Manager.BanPlayer(PC, true);
}
function bool InList(string Hash)
{
local int i;
for(i=0;i<ExceptionList.Length;i++)
{
if(Hash~=ExceptionList[i])
return true;
}
return false;
}
defaultproperties
{
ExceptionList(0)=121
MaxAllowedToKill=5
bAddToServerPackages=True
GroupName="KF-TeamKillerKickMut"
FriendlyName="TeamKillerKickMut"
Description="TeamKillerKickMut"
}
Add to the list of mutators: TeamKillerKickMut.TeamKillerKickMut