TeamKill Logging

This commit is contained in:
ChocoTaco 2021-09-13 17:33:21 -04:00
parent aea38be3b5
commit e6af4d968b
4 changed files with 32 additions and 3 deletions

18
Classic/scripts/autoexec/EnableLogs.cs Normal file → Executable file
View file

@ -153,4 +153,22 @@ function ClassicChatLog(%client, %id, %team, %msg)
$ClassicChatLog = stripChars($ClassicChatLog, "\c0\c1\c2\c3\c4\c5\c6\c7\c8\c9\x10\x11\co\cp");
%path = $Host::ClassicChatLogPath @ formatTimeString("/yy/mm-MM/dd.log");
export("$ClassicChatLog", %path, true);
}
// Log Teamkills
function teamkillLog(%victimID, %killerID)
{
if(!$Host::ClassicTeamKillLog)
return;
//echo("TK Log");
//Note: %killerID.teamkills + 1 as this is added later
$teamkillLog = "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC %killerID.nameBase @ " (" @ getField(%authInfo, 0) @ "," SPC %killerID.guid @ ") teamkilled" SPC %victimID.nameBase SPC "and has" SPC (%killerID.teamkills + 1) SPC "tks. CM[" @ $CurrentMission @ "]";
$teamkillLog = stripChars($teamkillLog, "\c0\c1\c2\c3\c4\c5\c6\c7\c8\c9\x10\x11\co\cp");
%logpath = $Host::ClassicTeamKillLogPath;
export("$teamkillLog", %logpath, true);
logEcho($teamkillLog);
echo($teamkillLog);
}

13
Classic/scripts/autoexec/TKwarn.cs Normal file → Executable file
View file

@ -3,15 +3,22 @@
package TKwarn
{
// From Evo
function DefaultGame::testTeamKill(%game, %victimID, %killerID)
{
{
%tk = Parent::testTeamKill(%game, %victimID, %killerID);
if(!%tk)
return false; // is not a tk
// No Bots
if(%killerID.isAIcontrolled() || %victimID.isAIcontrolled())
return true;
// Log TeamKill
teamkillLog(%victimID, %killerID);
if($Host::TournamentMode || %killerID.isAdmin || %killerID.isAIcontrolled() || %victimID.isAIcontrolled())
// No Admins
if(%killerID.isAdmin)
return true;
// Ignore this map