From e6af4d968bf38c90743d4fd0b4c9702eb7ec46b3 Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Mon, 13 Sep 2021 17:33:21 -0400 Subject: [PATCH] TeamKill Logging --- Classic/prefs/serverPrefs.cs | 2 ++ Classic/scripts/autoexec/EnableLogs.cs | 18 ++++++++++++++++++ Classic/scripts/autoexec/TKwarn.cs | 13 ++++++++++--- Classic/scripts/serverDefaults.cs | 2 ++ 4 files changed, 32 insertions(+), 3 deletions(-) mode change 100644 => 100755 Classic/scripts/autoexec/EnableLogs.cs mode change 100644 => 100755 Classic/scripts/autoexec/TKwarn.cs diff --git a/Classic/prefs/serverPrefs.cs b/Classic/prefs/serverPrefs.cs index 22d2ccc..975d180 100644 --- a/Classic/prefs/serverPrefs.cs +++ b/Classic/prefs/serverPrefs.cs @@ -69,6 +69,8 @@ $Host::ClassicRotationFile = "prefs/mapRotation.cs"; $Host::ClassicStatsType = 2; $Host::ClassicSuperAdminPassword = "changeme"; $Host::ClassicSuppressTraversalRootError = 1; +$Host::ClassicTeamKillLog = 1; +$Host::ClassicTeamKillLogPath = "logs/TeamKills/teamkills.log"; $Host::ClassicTelnet = 1; $Host::ClassicTelnetListenPass = "changeme"; $Host::ClassicTelnetPassword = "changeme"; diff --git a/Classic/scripts/autoexec/EnableLogs.cs b/Classic/scripts/autoexec/EnableLogs.cs old mode 100644 new mode 100755 index 7853a6d..917c0b4 --- a/Classic/scripts/autoexec/EnableLogs.cs +++ b/Classic/scripts/autoexec/EnableLogs.cs @@ -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); } \ No newline at end of file diff --git a/Classic/scripts/autoexec/TKwarn.cs b/Classic/scripts/autoexec/TKwarn.cs old mode 100644 new mode 100755 index 5d46db9..6e2bb2d --- a/Classic/scripts/autoexec/TKwarn.cs +++ b/Classic/scripts/autoexec/TKwarn.cs @@ -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 diff --git a/Classic/scripts/serverDefaults.cs b/Classic/scripts/serverDefaults.cs index a616891..1885902 100755 --- a/Classic/scripts/serverDefaults.cs +++ b/Classic/scripts/serverDefaults.cs @@ -203,6 +203,8 @@ $Host::KickObserverTimeout = 1200; //How long player can stay in obs $Host::dtBanlist = "prefs/dtBanlist.cs"; //Alternate Ban System $Host::VoteCooldown = 120; //Time cooldown that dosnt allow a player to vote again after theyve initiated a vote (120 is 2 mins) $Host::VoteDelayTime = 120; //Delay the ability to vote (For everyone) at the beginning of the match (120 is 2 minutes) +$Host::ClassicTeamKillLog = 1; //Enable/Disable Teamkill Logging +$Host::ClassicTeamKillLogPath = "logs/TeamKills/teamkills.log"; //TeamKill Log Path //LakRabbit $Host::LakRabbitUnlimitedDJ = 1; //Unlimited disc-jumps if enabled