From b7f92907ae1295591d20866ccb05df5fe47ce9b2 Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Tue, 8 Nov 2022 22:20:13 -0500 Subject: [PATCH] Endgame voting Dont allow endgame attempts to block time votes --- Classic/scripts/autoexec/VoteMenu.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index 8ccafec..79a3a16 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -285,7 +285,14 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % switch$(%typeName) { case "VoteKickPlayer": - if(%client == %arg1) // client is trying to votekick himself + %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime(); + if(%curTimeLeftMS <= 120000) + { + messageClient(%client, "", "\c2Kick votes are restricted at this time."); + return; + } + + if(%client == %arg1) // client is trying to votekick himself return; // Use the leave button instead, pal. if(%isAdmin) // Admin is trying to kick @@ -370,7 +377,14 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % return; // stop the function in its tracks case "VoteChangeMission": - // Vote-spoof prevention right here + %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime(); + if(%curTimeLeftMS <= 120000) + { + messageClient(%client, "", "\c2Change mission votes are restricted at this time."); + return; + } + + // Vote-spoof prevention right here %arg1 = $HostMissionFile[%arg3]; %arg2 = $HostTypeName[%arg4]; if(!checkMapExist(%arg1, %arg2)) @@ -697,6 +711,13 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % return; case "VoteNextMission": + %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime(); + if(%curTimeLeftMS <= 120000) + { + messageClient(%client, "", "\c2Set next mission votes are restricted at this time."); + return; + } + if(!%client.isAdmin && $TotalTeamPlayerCount < 6) { messageClient( %client, '', "Need at least 6 players on teams to set the next map." );