From f212b1c0e177e2db4002796993affcad16da3243 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Sat, 1 Aug 2020 17:33:28 -0400 Subject: [PATCH] Update TKwarn.cs Exception for Mac_FlagArena Better kick function Changed warning to a more traditional "Classic" warning --- Classic/scripts/autoexec/TKwarn.cs | 80 ++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 5 deletions(-) diff --git a/Classic/scripts/autoexec/TKwarn.cs b/Classic/scripts/autoexec/TKwarn.cs index 17257ec..7cd4d6b 100644 --- a/Classic/scripts/autoexec/TKwarn.cs +++ b/Classic/scripts/autoexec/TKwarn.cs @@ -1,3 +1,5 @@ +//exec("scripts/autoexec/TKwarn.cs"); + package TKwarn { @@ -12,18 +14,22 @@ function DefaultGame::testTeamKill(%game, %victimID, %killerID) if($Host::TournamentMode || %killerID.isAdmin || %killerID.isAIcontrolled() || %victimID.isAIcontrolled()) return true; + // Ignore this map + if($CurrentMission $= "Mac_FlagArena") + return true; + // warn the player if((%killerID.teamkills == $Host::TKWarn1 - 1) && $Host::TKWarn1 != 0) - centerprint(%killerID, "You have teamkilled " @ %killerID.teamkills + 1 @ " players.\nCut it out!", 5, 3); + centerprint(%killerID, "You are recieving this warning for inappropriate teamkilling.\nBehave or you will be kicked.", 10, 2); // warn the player of his imminent kick else if((%killerID.teamkills == $Host::TKWarn2 - 1) && $Host::TKWarn2 != 0) - centerprint(%killerID, "You have teamkilled " @ %killerID.teamkills + 1 @ " players.\nWith " @ $Host::TKMax @ " teamkills, you will be kicked.", 5, 3); + centerprint(%killerID, "You are recieving this second warning for inappropriate teamkilling.\nBehave or you will be kicked.", 10, 2); // kick the player else if((%killerID.teamkills >= $Host::TKMax - 1) && $Host::TKMax != 0) { Game.kickClientName = %killerID.name; - kick(%killerID, false, %killerID.guid); - adminLog( %killerID, " was autokicked for too many teamkills." ); + TKkick(%killerID, true, %killerID.guid); + adminLog( %killerID, " was autokicked for teamkilling." ); } return true; } @@ -32,4 +38,68 @@ function DefaultGame::testTeamKill(%game, %victimID, %killerID) // Prevent package from being activated if it is already if (!isActivePackage(TKwarn)) - activatePackage(TKwarn); \ No newline at end of file + activatePackage(TKwarn); + +// we pass the guid as well, in case this guy leaves the server. +function TKkick( %client, %admin, %guid ) +{ + messageAll( 'MsgAdminForce', '\c2%1 has been autokicked for teamkilling.', %client.name ); // z0dd - ZOD, 7/13/03. Tell who kicked + + messageClient(%client, 'onClientKicked', ""); + messageAllExcept( %client, -1, 'MsgClientDrop', "", Game.kickClientName, %client ); + + if( %client.isAIControlled() ) + { + if($Host::ClassicCanKickBots || %admin.isAdmin) + { + if(!$Host::ClassicBalancedBots) + { + $HostGameBotCount--; + %client.drop(); + } + } + } + else + { + if( $playingOnline ) // won games + { + %count = ClientGroup.getCount(); + %found = false; + for( %i = 0; %i < %count; %i++ ) // see if this guy is still here... + { + %cl = ClientGroup.getObject( %i ); + if( %cl.guid == %guid ) + { + %found = true; + + // kill and delete this client, their done in this server. + if( isObject( %cl.player ) ) + %cl.player.scriptKill(0); + + if ( isObject( %cl ) ) + { + %client.setDisconnectReason( "You have been kicked out of the game." ); // z0dd - ZOD, 7/13/03. Tell who kicked + %cl.schedule(700, "delete"); + } + // ban by IP as well + BanList::add( %guid, %client.getAddress(), $Host::KickBanTime ); + } + } + if( !%found ) + BanList::add( %guid, "0", $Host::KickBanTime ); // keep this guy out for a while since he left. + } + else // lan games + { + // kill and delete this client + if( isObject( %client.player ) ) + %client.player.scriptKill(0); + + if ( isObject( %client ) ) + { + %client.setDisconnectReason( "You have been kicked out of the game." ); + %client.schedule(700, "delete"); + } + BanList::add( 0, %client.getAddress(), $Host::KickBanTime ); + } + } +} \ No newline at end of file