Endgame voting

Dont allow endgame attempts to block time votes
This commit is contained in:
ChocoTaco1 2022-11-08 22:20:13 -05:00
parent 6ff80403bc
commit b7f92907ae

View file

@ -285,6 +285,13 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
switch$(%typeName)
{
case "VoteKickPlayer":
%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.
@ -370,6 +377,13 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %
return; // stop the function in its tracks
case "VoteChangeMission":
%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];
@ -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." );