mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-01-19 16:14:44 +00:00
TK Autovote EndMatch Restriction
This commit is contained in:
parent
56d366eee5
commit
cbaf5818e5
|
|
@ -5,16 +5,16 @@ package TKwarn
|
|||
|
||||
// From Evo
|
||||
function DefaultGame::testTeamKill(%game, %victimID, %killerID, %damageType)
|
||||
{
|
||||
{
|
||||
if(!$countdownStarted && !$MatchStarted)
|
||||
return;
|
||||
|
||||
|
||||
%tk = Parent::testTeamKill(%game, %victimID, %killerID);
|
||||
if(!%tk)
|
||||
if(!%tk)
|
||||
return false; // is not a tk
|
||||
|
||||
// No Bots
|
||||
//if(%killerID.isAIcontrolled() || %victimID.isAIcontrolled())
|
||||
// if(%killerID.isAIcontrolled() || %victimID.isAIcontrolled())
|
||||
// return true;
|
||||
|
||||
// Log TeamKill
|
||||
|
|
@ -23,7 +23,7 @@ function DefaultGame::testTeamKill(%game, %victimID, %killerID, %damageType)
|
|||
//No warnings in tournament mode
|
||||
if($Host::TournamentMode)
|
||||
return true;
|
||||
|
||||
|
||||
// No Admins
|
||||
if(%killerID.isAdmin)
|
||||
return true;
|
||||
|
|
@ -31,7 +31,7 @@ function DefaultGame::testTeamKill(%game, %victimID, %killerID, %damageType)
|
|||
// Ignore this map
|
||||
if($CurrentMission $= "Mac_FlagArena" || $CurrentMission $= "Machineeggs")
|
||||
return true;
|
||||
|
||||
|
||||
// warn the player of the imminent kick vote
|
||||
if((%killerID.teamkills == $Host::TKWarn1 - 1) && $Host::TKWarn1 != 0)
|
||||
centerprint(%killerID, "You are receiving this warning for inappropriate teamkilling.\nBehave or a vote to kick will be started.", 10, 2);
|
||||
|
|
@ -61,7 +61,7 @@ if (!isActivePackage(TKwarn))
|
|||
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 );
|
||||
|
||||
|
|
@ -87,12 +87,12 @@ function TKkick( %client, %admin, %guid )
|
|||
%cl = ClientGroup.getObject( %i );
|
||||
if( %cl.guid == %guid )
|
||||
{
|
||||
%found = true;
|
||||
%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 for teamkilling." ); // z0dd - ZOD, 7/13/03. Tell who kicked
|
||||
|
|
@ -100,17 +100,17 @@ function TKkick( %client, %admin, %guid )
|
|||
}
|
||||
// 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.
|
||||
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 for teamkilling." );
|
||||
|
|
@ -124,7 +124,7 @@ function TKkick( %client, %admin, %guid )
|
|||
// From Evo
|
||||
// Info: Auto start a new vote
|
||||
function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4)
|
||||
{
|
||||
{
|
||||
// works only for kicking players
|
||||
if(%typeName !$= "VoteKickPlayer")
|
||||
return;
|
||||
|
|
@ -132,38 +132,66 @@ function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4)
|
|||
// only works for FFA mode
|
||||
if($Host::TournamentMode)
|
||||
return;
|
||||
|
||||
|
||||
//Added for vote overtime
|
||||
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime();
|
||||
if(%curTimeLeftMS <= 90000)
|
||||
{
|
||||
//log it
|
||||
$tkvoteLog = formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC "[Autovote Cancelled]" SPC %arg1.nameBase @ "(" @ %arg1.guid @ ")" SPC "Teamkill Autovote cancelled due insufficient time. #P[" @ $HostGamePlayerCount @ "]" SPC "CM[" @ $CurrentMission @ "]";
|
||||
if($Host::ClassicTeamKillLog)
|
||||
{
|
||||
%logpath = $Host::ClassicTeamKillLogPath;
|
||||
export("$tkvoteLog", %logpath, true);
|
||||
logEcho($tkvoteLog);
|
||||
}
|
||||
echo($tkvoteLog);
|
||||
return;
|
||||
}
|
||||
|
||||
//notify any admins on the other team
|
||||
for(%i = 0; %i < ClientGroup.getCount(); %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if (%cl.isAdmin == true)
|
||||
{
|
||||
if(%cl.team !$= %arg1.team) //Not on admins team
|
||||
messageClient(%cl, '', '\c5[A]\c1%1 \c0Teamkill Autovote started to kick %2.~wgui/objective_notification.wav', "Vote in Progress:", %arg1.nameBase);
|
||||
}
|
||||
}
|
||||
echo(formatTimeString("M-d") SPC formatTimeString("[hh:nn:a]") SPC "Teamkill Autovote started for..." SPC %arg1.nameBase @ "(" @ %arg1.guid @ ")" SPC "#P[" @ $HostGamePlayerCount @ "]" SPC "CM[" @ $CurrentMission @ "]");
|
||||
|
||||
// a vote is already running, cancel it
|
||||
if(Game.scheduleVote !$= "")
|
||||
stopCurrentVote();
|
||||
|
||||
|
||||
%clientsVoting = 0;
|
||||
|
||||
|
||||
// admins can't be kicked
|
||||
if(%arg1.isAdmin)
|
||||
return;
|
||||
|
||||
|
||||
Game.kickClient = %arg1;
|
||||
Game.kickClientName = %arg1.name;
|
||||
Game.kickGuid = %arg1.guid;
|
||||
Game.kickTeam = %arg1.team;
|
||||
|
||||
|
||||
%count = ClientGroup.getCount();
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if(%cl.team == %arg1.team && !%cl.isAIControlled() && %cl !$= %arg1)
|
||||
{
|
||||
{
|
||||
messageClient(%cl, 'VoteStarted', '\c2Vote initiated to kick the teamkiller %1 with %2 teamkills.', %arg1.name, $Host::TKWarn2);
|
||||
%clientsVoting++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(%i = 0; %i < %count; %i++)
|
||||
{
|
||||
%cl = ClientGroup.getObject(%i);
|
||||
if(%cl.team == %arg1.team && !%cl.isAIControlled() && %cl !$= %arg1)
|
||||
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
|
||||
messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100));
|
||||
}
|
||||
|
||||
clearVotes();
|
||||
|
|
|
|||
Loading…
Reference in a new issue