mirror of
https://github.com/ChocoTaco1/TacoServer.git
synced 2026-04-29 15:35:24 +00:00
Refactored
This commit is contained in:
parent
cbaf5818e5
commit
8ef58d73d3
1 changed files with 36 additions and 24 deletions
|
|
@ -14,8 +14,8 @@ function DefaultGame::testTeamKill(%game, %victimID, %killerID, %damageType)
|
||||||
return false; // is not a tk
|
return false; // is not a tk
|
||||||
|
|
||||||
// No Bots
|
// No Bots
|
||||||
// if(%killerID.isAIcontrolled() || %victimID.isAIcontrolled())
|
//if(%killerID.isAIcontrolled() || %victimID.isAIcontrolled())
|
||||||
// return true;
|
//return true;
|
||||||
|
|
||||||
// Log TeamKill
|
// Log TeamKill
|
||||||
teamkillLog(%victimID, %killerID, %damageType);
|
teamkillLog(%victimID, %killerID, %damageType);
|
||||||
|
|
@ -133,20 +133,40 @@ function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4)
|
||||||
if($Host::TournamentMode)
|
if($Host::TournamentMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Added for vote overtime
|
// admins can't be kicked
|
||||||
%curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime();
|
if(%arg1.isAdmin)
|
||||||
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;
|
return;
|
||||||
|
|
||||||
|
//Stop current votes
|
||||||
|
if(Game.scheduleVote !$= "")
|
||||||
|
{
|
||||||
|
//Added for vote overtime
|
||||||
|
//Dont stop if under 90 secs left
|
||||||
|
%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;
|
||||||
|
}
|
||||||
|
else //Stop any current votes
|
||||||
|
{
|
||||||
|
//Notify clients the vote is being cancelled
|
||||||
|
for(%i = 0; %i < %count; %i++)
|
||||||
|
{
|
||||||
|
%cl = ClientGroup.getObject(%i);
|
||||||
|
if(%cl !$= %arg1) //dont notify the team killer
|
||||||
|
messageClient(%cl, 'VoteStarted', '\c2Vote has been cancelled due to teamkill autovote.');
|
||||||
|
}
|
||||||
|
stopCurrentVote();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//notify any admins on the other team
|
//notify any admins on the other team
|
||||||
|
|
@ -156,21 +176,13 @@ function TKvote(%typeName, %arg1, %arg2, %arg3, %arg4)
|
||||||
if (%cl.isAdmin == true)
|
if (%cl.isAdmin == true)
|
||||||
{
|
{
|
||||||
if(%cl.team !$= %arg1.team) //Not on admins team
|
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);
|
messageClient(%cl, '', '\c5[A]\c1%1 \c0Teamkill Autovote started to kick %2 on the other team.~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 @ "]");
|
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;
|
%clientsVoting = 0;
|
||||||
|
|
||||||
// admins can't be kicked
|
|
||||||
if(%arg1.isAdmin)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Game.kickClient = %arg1;
|
Game.kickClient = %arg1;
|
||||||
Game.kickClientName = %arg1.name;
|
Game.kickClientName = %arg1.name;
|
||||||
Game.kickGuid = %arg1.guid;
|
Game.kickGuid = %arg1.guid;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue