From 6e9a4d4475206f3a2b9c081fc253906ec33654da Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Fri, 3 Apr 2020 10:47:27 -0400 Subject: [PATCH] VoteSystem Redo (Goon Style) A lot less code Not a mess anymore VoteHud support Remove SetNextMission Elements --- Classic/prefs/serverPrefs.cs | 1 + Classic/scripts/DMGame.cs | 19 +- Classic/scripts/LakRabbitGame.cs | 4 +- Classic/scripts/SCtFGame.cs | 23 +- Classic/scripts/autoexec/VoteMenu.cs | 2064 +++++++++++-------------- Classic/scripts/autoexec/VoteSound.cs | 12 +- Classic/scripts/serverDefaults.cs | 1 + 7 files changed, 925 insertions(+), 1199 deletions(-) diff --git a/Classic/prefs/serverPrefs.cs b/Classic/prefs/serverPrefs.cs index b329889..e43140d 100644 --- a/Classic/prefs/serverPrefs.cs +++ b/Classic/prefs/serverPrefs.cs @@ -48,6 +48,7 @@ $Host::ClassicLoadSniperChanges = 0; $Host::ClassicLoadTR2Gametype = 0; $Host::ClassicLoadVRamChanges = 0; $Host::ClassicLogEchoEnabled = 0; +$Host::ClassicMaxVotes = 5; $Host::ClassicMaxTelepads = 3; $Host::ClassicMOTD = "Discord PUB\nServer Hosted/Provided by Branzone/Ravin\nGet Mappacks at https://playt2.com/"; $Host::ClassicMOTDLines = 3; diff --git a/Classic/scripts/DMGame.cs b/Classic/scripts/DMGame.cs index 2fb82ee..af1d30d 100644 --- a/Classic/scripts/DMGame.cs +++ b/Classic/scripts/DMGame.cs @@ -868,28 +868,31 @@ function DMGame::sendGameVoteMenu(%game, %client, %key) %isAdmin = ( %client.isAdmin || %client.isSuperAdmin ); + if(!%client.canVote && !%isAdmin) + return; + if ( %game.scheduleVote $= "" ) { if(!%client.isAdmin) { if(!$Host::DMSLOnlyMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'vote to enable Shocklance Only Mode', 'Vote to enable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Enable SL Only Mode', 'Vote to enable Shocklance Only Mode' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'vote to disable Shocklance Only Mode', 'Vote to disable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Disable SL Only Mode', 'Vote to disable Shocklance Only Mode' ); } - else if (%client.ForceVote > 0 && %client.NextMission !$= 1 ) //Added for SetNextMission + else if (%client.ForceVote > 0) { if(!$Host::DMSLOnlyMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'vote to enable Shocklance Only Mode', 'Vote to enable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Enable SL Only Mode', 'Vote to enable Shocklance Only Mode' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'vote to disable Shocklance Only Mode', 'Vote to disable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Disable SL Only Mode', 'Vote to disable Shocklance Only Mode' ); } - else if ( %client.NextMission !$= 1 ) //Added for SetNextMission + else { if(!$Host::DMSLOnlyMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'change to enable Shocklance Only Mode', 'Enable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Enable SL Only Mode', 'Enable Shocklance Only Mode' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'change to disable Shocklance Only Mode', 'Disable Shocklance Only Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'DMSLOnlyMode', 'Disable SL Only Mode', 'Disable Shocklance Only Mode' ); } } } diff --git a/Classic/scripts/LakRabbitGame.cs b/Classic/scripts/LakRabbitGame.cs index a9a00e5..f68c69d 100644 --- a/Classic/scripts/LakRabbitGame.cs +++ b/Classic/scripts/LakRabbitGame.cs @@ -1088,7 +1088,7 @@ function LakRabbitGame::sendGameVoteMenu( %game, %client, %key ) //Added so lak vote items are properly displayed in evo adminvotemenu //A lot of changes were added to admin.ovl in evo //see footnotes below - else if (%client.ForceVote > 0 && %client.NextMission !$= 1 ) //Added for SetNextMission + else if (%client.ForceVote > 0) { if(!Game.duelMode) messageClient( %client, 'MsgVoteItem', "", %key, 'VoteDuelMode', 'Enable Duel Mode', 'Vote to enable Duel Mode' ); @@ -1105,7 +1105,7 @@ function LakRabbitGame::sendGameVoteMenu( %game, %client, %key ) else messageClient( %client, 'MsgVoteItem', "", %key, 'VotePro', 'Disable Pro Mode', 'Vote to disable Pro Mode' ); } - else if ( %client.NextMission !$= 1 ) //Added for SetNextMission + else { if(!Game.duelMode) messageClient( %client, 'MsgVoteItem', "", %key, 'VoteDuelMode', 'Enable Duel Mode', 'Enable Duel Mode' ); diff --git a/Classic/scripts/SCtFGame.cs b/Classic/scripts/SCtFGame.cs index 2993353..1354790 100644 --- a/Classic/scripts/SCtFGame.cs +++ b/Classic/scripts/SCtFGame.cs @@ -2260,9 +2260,12 @@ function SCtFGame::startFlagCollisionSearch(%game, %flag) function SCtFGame::sendGameVoteMenu(%game, %client, %key) { - parent::sendGameVoteMenu( %game, %client, %key ); + parent::sendGameVoteMenu( %game, %client, %key ); - %isAdmin = ( %client.isAdmin || %client.isSuperAdmin ); + %isAdmin = ( %client.isAdmin || %client.isSuperAdmin ); + + if(!%client.canVote && !%isAdmin) + return; if ( %game.scheduleVote $= "" ) { @@ -2271,23 +2274,23 @@ function SCtFGame::sendGameVoteMenu(%game, %client, %key) //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorClass', 'change the armor class to', 'Vote to change the Armor class' ); //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Vote Anti-Turtle time' ); if(!$Host::SCtFProMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'vote to enable Pro Mode', 'Vote to enable Pro Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Enable Pro Mode', 'Vote to enable Pro Mode' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'vote to disable Pro Mode', 'Vote to disable Pro Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Disable Pro Mode', 'Vote to disable Pro Mode' ); } - else if (%client.ForceVote > 0 && %client.NextMission !$= 1 ) //Added for SetNextMission + else if (%client.ForceVote > 0) { if(!$Host::SCtFProMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'vote to enable Pro Mode', 'Vote to enable Pro Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Enable Pro Mode', 'Vote to enable Pro Mode' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'vote to disable Pro Mode', 'Vote to disable Pro Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Disable Pro Mode', 'Vote to disable Pro Mode' ); } - else if ( %client.NextMission !$= 1 ) //Added for SetNextMission + else { if(!$Host::SCtFProMode) - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'change to enable Pro Mode', 'Enable Pro Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Enable Pro Mode', 'Enable Pro Mode' ); else - messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'change to disable Pro Mode', 'Disable Pro Mode' ); + messageClient( %client, 'MsgVoteItem', "", %key, 'SCtFProMode', 'Disable Pro Mode', 'Disable Pro Mode' ); } //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorClass', 'change the armor class to', 'Change the Armor class' ); //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteAntiTurtleTime', 'change the anti turtle time to', 'Change Anti-Turtle time' ); diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index be0516f..ca7a9d9 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -9,102 +9,13 @@ //$Host::AllowPlayerVoteTimeLimit = 1; //$Host::AllowPlayerVoteTournamentMode = 1; -// These have been secured against all those wanna-be-hackers. -$VoteMessage["VoteAdminPlayer"] = "1"; -$VoteMessage["VoteKickPlayer"] = "1"; -$VoteMessage["BanPlayer"] = "1"; -$VoteMessage["VoteChangeMission"] = "1"; -$VoteMessage["VoteTeamDamage", 0] = "1"; -$VoteMessage["VoteTeamDamage", 1] = "1"; -$VoteMessage["VoteTournamentMode"] = "1"; -$VoteMessage["VoteFFAMode"] = "1"; -$VoteMessage["VoteChangeTimeLimit"] = "1"; -$VoteMessage["VoteMatchStart"] = "1"; -$VoteMessage["VoteGreedMode", 0] = "1"; -$VoteMessage["VoteGreedMode", 1] = "1"; -$VoteMessage["VoteHoardMode", 0] = "1"; -$VoteMessage["VoteHoardMode", 1] = "1"; -// z0dd - ZOD, 5/13/03. Added vote Random, Fair teams and armor limiting -$VoteMessage["VoteRandomTeams", 0] = "1"; -$VoteMessage["VoteRandomTeams", 1] = "1"; -$VoteMessage["VoteFairTeams", 0] = "1"; -$VoteMessage["VoteFairTeams", 1] = "1"; -$VoteMessage["VoteArmorLimits", 0] = "1"; -$VoteMessage["VoteArmorLimits", 1] = "1"; -$VoteMessage["VoteAntiTurtleTime"] = "1"; -$VoteMessage["VoteArmorClass"] = "1"; -$VoteMessage["VoteClearServer"] = "1"; -$VoteMessage["VoteSkipMission"] = "1"; -$VoteMessage["ForceVote"] = "1"; -$VoteMessage["CancelMatchStart"] = "1"; -$VoteMessage["passRunningVote"] = "1"; -$VoteMessage["stopRunningVote"] = "1"; -$VoteMessage["ToggleTourneyNetClient"] = "1"; -$VoteMessage["TogglePUGpassword"] = "1"; -$VoteMessage["showServerRules"] = "1"; -$VoteMessage["DMSLOnlyMode"] = "1"; -$VoteMessage["SCtFProMode"] = "1"; -$VoteMessage["VoteDuelMode"] = "1"; -$VoteMessage["VoteSplashDamage"] = "1"; -$VoteMessage["VotePro"] = "1"; - - package ExtraVoteMenu { function DefaultGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %arg4) { - switch$(%typeName) - { - case "voteChangeMission": - %game.voteChangeMission(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteTeamDamage": - %game.voteTeamDamage(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteTournamentMode": - %game.voteTournamentMode(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteMatchStart": - %game.voteMatchStart(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteFFAMode": - %game.voteFFAMode(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteChangeTimeLimit": - %game.voteChangeTimeLimit(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteResetServer": - %game.voteResetServer(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteKickPlayer": - %game.voteKickPlayer(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteAdminPlayer": - %game.voteAdminPlayer(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteGreedMode": - %game.voteGreedMode(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteHoardMode": - %game.voteHoardMode(%admin, %arg1, %arg2, %arg3, %arg4); - - // z0dd - ZOD, 5/23/03. Added vote for Random, Fair teams and armor limiting - case "voteRandomTeams": - %game.voteRandomTeams(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteFairTeams": - %game.voteFairTeams(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteArmorLimits": - %game.voteArmorLimits(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteClearServer": - %game.voteClearServer(%admin, %arg1, %arg2, %arg3, %arg4); - - case "voteSkipMission": - %game.voteSkipMission(%admin, %arg1, %arg2, %arg3, %arg4); - + switch$ (%typeName) + { case "cancelMatchStart": %game.cancelMatchStart(%admin, %arg1, %arg2, %arg3, %arg4); @@ -119,38 +30,580 @@ function DefaultGame::evalVote(%game, %typeName, %admin, %arg1, %arg2, %arg3, %a } } -function playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting, %teamSpecific) +function DefaultGame::sendGameVoteMenu(%game, %client, %key) { - if(!%teamSpecific) // isn't a team specific vote (kick) - { - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); - } - } - else // is a team specific vote (kick) - { - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(%cl.team == %client.team && !%cl.isAIControlled()) - messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); - } - } - clearVotes(); - Game.voteType = %typeName; - Game.scheduleVote = schedule(($Host::VoteTime * 1000), 0, "calcVotes", %typeName, %arg1, %arg2, %arg3, %arg4); - Game.scheduleVoteArgs[typename] = %typename; - Game.scheduleVoteArgs[arg1] = %arg1; - Game.scheduleVoteArgs[arg2] = %arg2; - Game.scheduleVoteArgs[arg3] = %arg3; - Game.scheduleVoteArgs[arg4] = %arg4; - %client.vote = true; - messageAll('addYesVote', ""); - if(%client.team != 0) - clearBottomPrint(%client); + %isAdmin = (%client.isAdmin || %client.isSuperAdmin); + %multipleTeams = %game.numTeams > 1; + + // ******************************************** + // Admin Vote For ... Submenu + // ******************************************** + if (!$Host::TournamentMode) + { + if (%client.ForceVote > 0) + %client.ForceVote = %client.ForceVote - 1; + + if (%client.ForceVote > 0) + { + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'change server to Tournament.', 'Vote Tournament Mode'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); + messageClient(%client, 'MsgVoteItem',"", %key, 'ForceVote', 'Cancel Force Vote', "Cancel 'Vote To...'"); + return; // Display no further vote options + } + } + // TEAM OPTIONS + if(!$Host::TournamentMode) + { + if(%client.team != 0) // he isn't an observer + { + if(%multipleTeams) + messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); + + if($MatchStarted) + messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); + } + } + else if(%client.isAdmin) // only admins can change team during tournament mode + { + if(%client.team != 0) // he isn't an observer + { + if(%multipleTeams) + messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); + + messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); + } + } + if(!%client.canVote && !%isAdmin) + return; + + if(%game.scheduleVote $= "") + { + if(!%client.isAdmin) + { + if(!$Host::TournamentMode) + { + if($Host::AllowPlayerVoteChangeMission) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); + if($Host::AllowPlayerVoteTournamentMode) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Vote Tournament Mode'); + if($Host::AllowPlayerVoteTimeLimit) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); + if($Host::AllowPlayerVoteSkipMission) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); + } + else + { + if(!$MatchStarted && !$CountdownStarted) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Vote to Start the Match'); + + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Vote Free For All Mode'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); + + if(%multipleTeams) + { + if($teamDamage) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); + } + } + } + else + { + if(!$Host::TournamentMode) + { + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Tournament Mode'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Skip the Mission' ); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); + + if( $Host::AllowAdminVotes ) + messageClient(%client, 'MsgVoteItem', "", %key, 'ForceVote', 'Vote to ...', 'Vote to ...'); + } + else + { + if(!$MatchStarted && !$CountdownStarted) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Start Match'); + if(!$MatchStarted && $CountdownStarted) + messageClient(%client, 'MsgVoteItem', "", %key, 'cancelMatchStart', 'Cancel Match Start', 'Cancel Match Start'); + + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Free For All Mode'); + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); + + if($Host::Password !$= "") + messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Disable PUG Password', 'Disable PUG Password'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Enable PUG Password', 'Enable PUG Password'); + } + if(%multipleTeams) + { + if($teamDamage) + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Disable Team Damage'); + else + messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Enable Team Damage'); + } + + //Toggle Tournament Net Client + if(%client.isAdmin && $Host::EnableNetTourneyClient) + messageClient( %client, 'MsgVoteItem', "", %key, 'ToggleTourneyNetClient', 'Disable Tournament Net Client', "Disable Tournament Net Client" ); + else if(%client.isAdmin) + messageClient( %client, 'MsgVoteItem', "", %key, 'ToggleTourneyNetClient', 'Enable Tournament Net Client', "Enable Tournament Net Client" ); + + } + + if ($Host::ServerRules[1] !$= "" ) + messageClient( %client, 'MsgVoteItem', "", %key, 'showServerRules', 'show server rules', "Show Server Rules" ); + } + else + { + if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) // allow admins to stop votes + messageClient( %client, 'MsgVoteItem', "", %key, 'stopRunningVote', 'stop current vote', 'Stop the Vote'); + + if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminPassVote)) // allow admins to pass votes + messageClient( %client, 'MsgVoteItem', "", %key, 'passRunningVote', 'pass current vote', 'Pass the Vote'); + } +} + +// Eolk - completely re-wrote this. +function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %playerVote) +{ + %isAdmin = ( %client.isAdmin || %client.isSuperAdmin ); + if(!%client.canVote && !%isAdmin) + return; + + if(Game.scheduleVote !$= "" && (!%isAdmin || (%isAdmin && %client.adminVoteSet))) + { + messageClient(%client, 'voteAlreadyRunning', "\c2A vote is already in progress."); + %client.adminVoteSet = 0; + return; + } + + %teamSpecific = 0; + switch$(%typeName) + { + case "VoteKickPlayer": + if(%client == %arg1) // client is trying to votekick himself + return; // Use the leave button instead, pal. + + if(%isAdmin) // Admin is trying to kick + { + if((%arg1.isAdmin && !%client.isSuperAdmin) || %arg1.isSuperAdmin) // target is an admin and kicker is just an admin, or if target is a super admin + { + messageClient(%client, "MsgClient", "\c2You cannot kick "@%arg1.nameBase@"."); + return; + } + } + else // Player is voting to kick + { + if(%arg1.isAdmin) // target is an admin + { + messageClient(%client, "MsgClient", "\c2You cannot vote to kick "@%arg1.nameBase@", "@(%arg1.sex $= "Male" ? "he" : "she")@" is an admin!"); + return; + } + + if(%arg1.team != %client.team) + { + messageClient(%client, "MsgClient", "\c2Kick votes must be team based."); + return; + } + + if($CMHasVoted[%client.guid] >= $Host::ClassicMaxVotes && !%isAdmin) // they've voted too many times + { + messageClient(%client, "", "\c2You have exhausted your voting rights for this mission."); + return; + } + + %msg = %client.nameBase @ " initiated a vote to kick player " @ %arg1.nameBase @ "."; + messageAdmins("", "\c5[A]\c1"@ %msg @"~wgui/objective_notification.wav"); + $CMHasVoted[%client.guid]++; + } + + if(%arg1.team != 0) + %teamSpecific = 1; + + Game.kickClient = %arg1; + Game.kickClientName = %arg1.name; + Game.kickClientNameBase = %arg1.nameBase; + Game.kickGuid = %arg1.guid; + Game.kickTeam = %arg1.team; + + case "VoteAdminPlayer": + if(%arg1.isAdmin) // target is already an admin + return; // can't vote to admin an admin! + + if(%client.isAdmin) // our pal is an admin + { + if(!%client.isSuperAdmin) // ... but not a super admin + return; // insufficient privileges + } + else // not an admin + { + if(!$host::allowadminplayervotes) // admin player votes are NOT enabled + return; // can't do that pal + + %msg = %client.nameBase @ " initiated a vote to admin player " @ %arg1.nameBase @ "."; + } + + case "BanPlayer": + if(%client.isSuperAdmin && !%arg1.isSuperAdmin) // we're a super admin, and our target isn't a super admin + ban(%arg1, %client); // ban 'em + return; // stop the function in its tracks + + case "VoteChangeMission": + // Vote-spoof prevention right here + %arg1 = $HostMissionFile[%arg3]; + %arg2 = $HostTypeName[%arg4]; + if(!checkMapExist(%arg1, %arg2)) + return; + + // We passed the spoof check, give it the fancy label + %arg1 = $HostMissionName[%arg3]; + %arg2 = $HostTypeDisplayName[%arg4]; + if((!%isAdmin && $Host::AllowPlayerVoteChangeMission) || (%isAdmin && %client.ForceVote)) // not admin + { + if($CMHasVoted[%client.guid] >= $Host::ClassicMaxVotes && !%isAdmin) // they've voted too many times + { + messageClient(%client, "", "\c2You have exhausted your voting rights for this mission."); + return; + } + + %msg = %client.nameBase @ " initiated a vote to change the mission to " @ %arg1 @ " (" @ %arg2 @ ")."; + $CMHasVoted[%client.guid]++; + } + + case "VoteTeamDamage": + if(!%isAdmin) + { + %msg = %client.nameBase @ " initiated a vote to " @ ($TeamDamage == 0 ? "enable" : "disable") @ " team damage."; + } + + case "VoteTournamentMode": + if((!%isAdmin && $Host::AllowPlayerVoteTournamentMode) || (%isAdmin && %client.ForceVote)) + { + if(getAdmin() == 0) + { + messageClient(%client, 'clientMsg', "There must be a server admin to play in Tournament Mode."); + return; + } + + %msg = %client.nameBase @ " initiated a vote to switch the server to Tournament Mode (" @ %arg1 @ ")."; + } + + case "VoteFFAMode": + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + { + %msg = %client.nameBase @ " initiated a vote to switch the server to Free For All mode."; + } + + case "VoteChangeTimeLimit": + if($CurrentMissionType $= "Siege") // Can't change time in this one + { + messageClient(%client, "", "\c2Cannot change the time limit in this gametype."); + return; + } + + // Eolk - don't let votes/admins end the map immediately by switching the time limit below the elapsed time + if((%arg1 * 60 * 1000) < (getSimTime() - $missionStartTime)) + { + messageClient(%client, "", "\c2Switching to this time would cause the game to end immediately."); + return; + } + + if(%arg1 == $Host::TimeLimit) + { + messageClient(%client, "", "\c2Switching to this time wouldn't affect the time limit at all."); + return; + } + + if((!%isAdmin && $Host::AllowPlayerVoteTimeLimit) || (%isAdmin && %client.ForceVote)) + { + if(%arg1 $= "999") %time = "unlimited"; else %time = %arg1; + %msg = %client.nameBase @ " initiated a vote to change the time limit to " @ %time @ "."; + } + + case "VoteMatchStart": + if(!%isAdmin) + { + if($MatchStarted || $CountdownStarted) + return; + + %msg = %client.nameBase @ " initiated a vote to start the match."; + } + + case "CancelMatchStart": + if(%isAdmin) // only admins can cancel match start + { + adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); + adminLog(%client, " canceled match start."); + } + + case "VoteGreedMode": + if($CurrentMissionType !$= "Hunters" || $CurrentMissionType !$= "TeamHunters") + return; + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + %msg = %client.nameBase @ " initiated a vote to " @ (Game.greedMode == 0 ? "enable" : "disable") @ " greed mode."; + + case "VoteHoardMode": + if($CurrentMissionType !$= "Hunters" || $CurrentMissionType !$= "TeamHunters") + return; + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + %msg = %client.nameBase @ " initiated a vote to " @ (Game.hoardMode == 0 ? "enable" : "disable") @ " hoard mode."; + + case "VoteRandomTeams": + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + { + %msg = %client.nameBase @ " initiated a vote to " @ ($RandomTeams == 0 ? "enable" : "disable") @ " random teams."; + } + + case "VoteFairTeams": + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + { + %msg = %client.nameBase @ " initiated a vote to " @ ($FairTeams == 0 ? "enable" : "disable") @ " fair teams."; + } + + case "VoteSkipMission": + if((!%isAdmin && $Host::AllowPlayerVoteSkipMission) || (%isAdmin && %client.ForceVote)) + { + if($CMHasVoted[%client.guid] >= $Host::ClassicMaxVotes && !%isAdmin) + { + messageClient(%client, "", "\c2You have exhausted your voting rights for this mission."); + return; + } + + %msg = %client.nameBase @ " initiated a vote to skip the current mission."; + %blank = "next mission."; + $CMHasVoted[%client.guid]++; + } + + case "passRunningVote": + if (%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminPassVote)) + { + adminStartNewVote( %client, %typename, %arg1, %arg2, %arg3, %arg4); + adminLog(%client, " passed the vote in progress."); + } + + case "stopRunningVote": + if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) + { + adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); + adminLog(%client, " stopped the vote in progress."); + } + + // LakRabbit Stuff + case "VoteDuelMode": + if(!$CurrentMissionType $= "LakRabbit") + return; + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + %msg = %client.nameBase @ " initiated a vote to " @ (Game.duelMode == 0 ? "enable" : "disable") @ " duel mode."; + + case "VoteSplashDamage": + if(!$CurrentMissionType $= "LakRabbit") + return; + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + %msg = %client.nameBase @ " initiated a vote to " @ (Game.noSplashDamage == 0 ? "enable" : "disable") @ " splash damage."; + + case "VotePro": + if(!$CurrentMissionType $= "LakRabbit") + return; + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + %msg = %client.nameBase @ " initiated a vote to " @ (Game.pubPro == 0 ? "enable" : "disable") @ " pro mode."; + + case "DMSLOnlyMode": + if(!$CurrentMissionType $= "DM") + return; + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + %msg = %client.nameBase @ " initiated a vote to " @ (Game.DMSLOnlyMode == 0 ? "enable" : "disable") @ " shocklance only mode."; + + case "SCtFProMode": + if(!$CurrentMissionType $= "sctf") + return; + + if(!%isAdmin || (%isAdmin && %client.ForceVote)) + %msg = %client.nameBase @ " initiated a vote to " @ (Game.SCtFProMode == 0 ? "enable" : "disable") @ " pro mode."; + + case "showServerRules": + if (($Host::ServerRules[1] !$= "") && (!%client.CantView)) + { + for ( %i = 1; $Host::ServerRules[%i] !$= ""; %i++ ) + { + messageClient(%client, 'ServerRule', '\c2%1', $Host::ServerRules[%i] ); + } + %client.cantView = true; + %client.schedViewRules = schedule( 10000, %client, "resetViewSchedule", %client ); + } + return; + case "TogglePUGpassword": + if (%client.isAdmin) + { + if($Host::Password !$= "") + { + $Host::Password = ""; + messageClient( %client, '', "PUG password been disabled.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has disabled pug password." ); + } + else + { + $Host::Password = $Host::PUGPassword; + messageClient( %client, '', "PUG password been enabled.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has enabled pug password." ); + } + } + return; + case "ToggleTourneyNetClient": + if (%client.isAdmin) + { + if($Host::EnableNetTourneyClient) + { + $Host::EnableNetTourneyClient = 0; + + if(isActivePackage(checkver)) + deactivatePackage(checkver); + + messageClient( %client, '', "Tournament Net Client checking has been disabled.~wfx/powered/vehicle_screen_on.wav" ); + adminLog(%client, " has disabled Net Tourney Client checking."); + } + else + { + $Host::EnableNetTourneyClient = 1; + + if(!isActivePackage(checkver)) + activatePackage(checkver); + + //Boot Offenders into Obs + CheckVerObserver(%client); + + messageClient( %client, '', "Tournament Net Client checking has been enabled.~wfx/powered/vehicle_screen_on.wav" ); + ResetGetCountsStatus(); + adminLog(%client, " has enabled Net Tourney Client checking."); + } + } + return; + case "ForceVote": + if (%client.isAdmin && $Host::AllowAdminVotes) + { + if (%client.ForceVote) + { + %client.ForceVote = 0; + messageClient( %client, '', 'Vote to ... cancelled.' ); + } + else + { + %client.ForceVote = 2; + messageClient( %client, '', "Now select what to vote on, please." ); + } + } + return; + + default: + return; + } + + if(%isAdmin && !%client.adminVoteSet && !%client.ForceVote) + adminStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4); + else + playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %teamSpecific, %msg, %blank); +} + +//exec("scripts/autoexec/VoteMenu.cs"); + +function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %teamSpecific, %msg, %blank) +{ + echo(%client SPC %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4); + + %clientsVoting = 0; + %count = ClientGroup.getCount(); + if(%teamSpecific) + { + for(%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if(%cl.team == %client.team && !%cl.isAIControlled()) + { + //Specifically for votehud compatibility + switch$(%typeName) + { + case "VoteKickPlayer": + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "kick player", %arg1.name); + default: + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, %arg1); + } + %clientsVoting++; + } + } + + for(%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if(%cl.team == %client.team && !%cl.isAIControlled()) + messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); + } + } + else + { + %count = ClientGroup.getCount(); + for(%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if(!%cl.isAIControlled()) + { + //Specifically for votehud compatibility + switch$(%typeName) + { + case "VoteChangeMission": + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "change the mission to", %arg1, %arg2); + case "VoteSkipMission": + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "skip the mission"); + case "VoteChangeTimeLimit": + if(%arg1 $= "999") %time = "Unlimited"; else %time = %arg1; + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "change the time limit to", %time); + case "VoteKickPlayer": + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "kick player", %arg1.name); + case "VoteTournamentMode": + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "Tournament Mode", %arg1); + case "VoteMatchStart": + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "Start Match"); + case "VoteFFAMode": + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, "Free For All Mode"); + default: + messageClient( %cl, 'VoteStarted', "\c2" @ %msg, %client.name, %arg1); + } + %clientsVoting++; + } + } + + for(%i = 0; %i < %count; %i++) + { + %cl = ClientGroup.getObject(%i); + if(!%cl.isAIControlled()) + messageClient(%cl, 'openVoteHud', "", %clientsVoting, ($Host::VotePassPercent / 100)); + } + } + + clearVotes(); + Game.voteType = %typeName; + Game.scheduleVote = schedule(($Host::VoteTime * 1000), 0, "calcVotes", %typeName, %arg1, %arg2, %arg3, %arg4); + + // Eolk - Voting control variables + Game.votingArgs[typeName] = %typeName; + Game.votingArgs[arg1] = %arg1; + Game.votingArgs[arg2] = %arg2; + Game.votingArgs[arg3] = %arg3; + Game.votingArgs[arg4] = %arg4; + + %client.vote = true; + messageAll('addYesVote', ""); + if(%client.team != 0) + clearBottomPrint(%client); %client.canVote = false; %client.rescheduleVote = schedule(($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client); @@ -164,896 +617,14 @@ function playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %cli for(%i = 0; %i < $Host::EnableVoteSoundReminders; %i++) Game.voteReminder[%i] = schedule((%time * (%i + 1)), 0, "VoteSound", %game, %typename, %arg1, %arg2); } - //Added so vote will end on bogus votes - //$AutoVoteTimeoutSchedule = schedule(($Host::VoteTime * 1000) + 1000, 0, "AutoVoteTimeout"); } -function AutoVoteTimeout() +function DefaultGame::gameOver(%game) { - if(isEventPending($AutoVoteTimeoutSchedule)) - cancel($AutoVoteTimeoutSchedule); - - if( Game.scheduleVote !$= "") - { - cancel(Game.scheduleVote); - Game.scheduleVote = ""; - Game.kickClient = ""; - Game.scheduleVoteArgs = ""; - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - messageClient(%cl, 'closeVoteHud', ""); - if(%cl.team != 0) - clearBottomPrint(%cl); - } - clearVotes(); - $VoteSoundRandom = ""; - } -} - -function DefaultGame::sendGameVoteMenu(%game, %client, %key) -{ - %isAdmin = (%client.isAdmin || %client.isSuperAdmin); - %multipleTeams = %game.numTeams > 1; - - // ******************************************** - // Admin Vote For ... Submenu - // ******************************************** - if (!$Host::TournamentMode) - { - if (%client.ForceVote > 0) - %client.ForceVote = %client.ForceVote - 1; - - if (%client.ForceVote > 0) - { - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'change server to Tournament.', 'Vote Tournament Mode'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - messageClient(%client, 'MsgVoteItem',"", %key, 'ForceVote', 'Cancel Force Vote', "Cancel 'Vote To...'"); - return; // Display no further vote options - } - } - // TEAM OPTIONS - if(!$Host::TournamentMode) - { - if(%client.team != 0) // he isn't an observer - { - if(%multipleTeams) - messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); - - if($MatchStarted) - messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); - } - } - else if(%client.isAdmin) // only admins can change team during tournament mode - { - if(%client.team != 0) // he isn't an observer - { - if(%multipleTeams) - messageClient(%client, 'MsgVoteItem', "", %key, 'ChooseTeam', "", 'Change your Team'); - - messageClient(%client, 'MsgVoteItem', "", %key, 'MakeObserver', "", 'Become an Observer'); - } - } - if(!%client.canVote && !%isAdmin) - return; - - if(%game.scheduleVote $= "") - { - if(!%client.isAdmin) - { - if(!$Host::TournamentMode) - { - if($Host::AllowPlayerVoteChangeMission) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); - if($Host::AllowPlayerVoteTournamentMode) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Vote Tournament Mode'); - if($Host::AllowPlayerVoteTimeLimit) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - if($Host::AllowPlayerVoteSkipMission) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Vote to Skip Mission' ); - - //if(%multipleTeams && $Host::AllowPlayerVoteTeamDamage) - //{ - //if($teamDamage) - //messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); - //else - //messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); - //} - //if($CurrentMissionType !$= TR2) // z0dd - ZOD, 5/23/03. Added vote for Random teams - //{ - //if ( $RandomTeams ) - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteRandomTeams', 'disable random teams', 'Vote to Disable Random Teams' ); - //else - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteRandomTeams', 'enable random teams', 'Vote to Enable Random Teams' ); - //} - } - else - { - if(!$MatchStarted && !$CountdownStarted) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Vote to Start the Match'); - - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Vote to Change the Mission'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Vote Free For All Mode'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Vote to Change the Time Limit'); - - if(%multipleTeams) - { - if($teamDamage) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Vote to Disable Team Damage'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Vote to Enable Team Damage'); - } - } - } - else - { - if(!$Host::TournamentMode) - { - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTournamentMode', 'Change server to Tournament.', 'Tournament Mode'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteSkipMission', 'skip the mission to', 'Skip the Mission' ); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); - - if( $Host::AllowAdminVotes ) - messageClient(%client, 'MsgVoteItem', "", %key, 'ForceVote', 'Vote to ...', 'Vote to ...'); - } - else - { - if(!$MatchStarted && !$CountdownStarted) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteMatchStart', 'Start Match', 'Start Match'); - if(!$MatchStarted && $CountdownStarted) - messageClient(%client, 'MsgVoteItem', "", %key, 'cancelMatchStart', 'Cancel Match Start', 'Cancel Match Start'); - - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeMission', 'change the mission to', 'Change the Mission'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteFFAMode', 'Change server to Free For All.', 'Free For All Mode'); - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteChangeTimeLimit', 'change the time limit', 'Change the Time Limit'); - - if($Host::Password !$= "") - messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Disable PUG Password', 'Disable PUG Password'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'TogglePUGpassword', 'Enable PUG Password', 'Enable PUG Password'); - } - if(%multipleTeams) - { - if($teamDamage) - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'disable team damage', 'Disable Team Damage'); - else - messageClient(%client, 'MsgVoteItem', "", %key, 'VoteTeamDamage', 'enable team damage', 'Enable Team Damage'); - - //if($CurrentMissionType !$= TR2) // z0dd - ZOD, 5/23/03. Added vote for Random teams - //{ - //if ( $RandomTeams ) - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteRandomTeams', 'disable random teams', 'Disable Random Teams' ); - //else - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteRandomTeams', 'enable random teams', 'Enable Random Teams' ); - //} - } - - //Toggle Tournament Net Client - if(%client.isAdmin && $Host::EnableNetTourneyClient) - messageClient( %client, 'MsgVoteItem', "", %key, 'ToggleTourneyNetClient', 'Disable Tournament Net Client', "Disable Tournament Net Client" ); - else if(%client.isAdmin) - messageClient( %client, 'MsgVoteItem', "", %key, 'ToggleTourneyNetClient', 'Enable Tournament Net Client', "Enable Tournament Net Client" ); - - } - - if ($Host::ServerRules[1] !$= "" ) - { - messageClient( %client, 'MsgVoteItem', "", %key, 'showServerRules', 'show server rules', "Show Server Rules" ); - } - - //messageClient( %client, 'MsgVoteItem', "", %key, 'showNextMission', 'show next mission', "Show Next Mission" ); - } - else - { - if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) // allow admins to stop votes - { - messageClient(%client, 'MsgVoteItem', "", %key, 'stopRunningVote', 'stop current vote', 'Stop the Vote'); - } - - if (%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminPassVote) ) - { - messageClient( %client, 'MsgVoteItem', "", %key, 'passRunningVote', 'pass current vote', 'Pass the Vote'); - } - } - // Admin only options: - if ( %client.isAdmin ) - { - //if ( $LimitArmors ) - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorLimits', 'disable armor limiting', 'Disable armor limits' ); - //else - //messageClient( %client, 'MsgVoteItem', "", %key, 'VoteArmorLimits', 'enable armor limiting', 'Enable armor limits' ); - - // ----------------------------------------------------------------------------- - // z0dd - ZOD, 5/12/02. Add bot menu for admins - //%totalSlots = $Host::maxPlayers - ($HostGamePlayerCount + $HostGameBotCount); - //if( $HostGameBotCount > 0 && %totalSlots > 0) - //messageClient( %client, 'MsgVoteItem', "", %key, 'Addbot', "", 'Add a Bot' ); - // ----------------------------------------------------------------------------- - } -} - -function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %playerVote) -{ - // z0dd - ZOD, 9/29/02. Removed T2 demo code from here - - %typePass = true; - - // if not a valid vote, turn back. - // z0dd - ZOD, 5/13/03. Added vote Random, Fair teams, armor limting, Anti-Turtle and Armor Class - if($VoteMessage[%typeName] $= "" && (%typeName !$= "VoteTeamDamage" && %typeName !$= "VoteHoardMode" - && %typeName !$= "VoteGreedMode" && %typeName !$= "VoteRandomTeams" - && %typeName !$= "VoteFairTeams" && %typeName !$= "VoteArmorLimits" - && %typeName !$= "VoteAntiTurtleTime" && %typeName !$= "VoteArmorClass" - && %typeName !$= "VoteChangeMission" && %typeName !$= "VoteSkipMission" - && %typeName !$= "VoteKickPlayer" && %typeName !$= "BanPlayer" - && %typeName !$= "VoteFFAMode" && %typeName !$= "VoteTournamentMode" - && %typeName !$= "ForceVote" && %typeName !$= "VoteMatchStart" - && %typeName !$= "VoteClearServer" && %typeName !$= "VoteAdminPlayer" - && %typeName !$= "CancelMatchStart" && %typeName !$= "DMSLOnlyMode" - && %typeName !$= "SCtFProMode" && %typeName !$= "VotePro" - && %typeName !$= "VoteSplashDamage" && %typeName !$= "VoteDuelMode")) { - %typePass = false; - } - - if(( $VoteMessage[ %typeName, $TeamDamage ] $= "" && %typeName $= "VoteTeamDamage" )) - %typePass = false; - - if( !%typePass ){ - echo("New Vote failed. (%typePass)"); - return; // -> bye ;) - } - - %isAdmin = (%client.isAdmin || %client.isSuperAdmin); - if(!%client.canVote && !%isAdmin) - return; - - %clientsVoting = 0; - - // z0dd - ZOD, 5/19/03. Get the Admins client. - if(%isAdmin) - $AdminCl = %client; - - // Is this a tricon style call - if ( TriconWrapper( %client, %arg1, %typename ) ) - return; - - switch$(%typeName) - { - case "VoteKickPlayer": - if(%isAdmin && %client != %arg1) // client is an admin and the player to kick isn't the player himself - { - if(!%client.isSuperAdmin && %arg1.isAdmin) // only super admins can kick admins - { - messageClient(%client, '', '\c2You can not kick %1, %2 is an Admin!', %arg1.name, %arg1.sex $= "Male" ? 'he' : 'she'); - return; - } - Game.kickClientName = %arg1.name; - kick(%arg1, %client, %arg1.guid); // kick the player without entering the vote process - %authInfo = %arg1.getAuthInfo(); - adminLog(%client, " kicked " @ %arg1.nameBase @ "( " @ getField(%authInfo, 0) @ ", " @ getField(%authInfo, 1) @ ", " @ %arg1.guid @ ", " @ %arg1.getAddress() @ ")"); - } - else // normal vote - { - if(%arg1.isAdmin) // don't let players to kick admins - { - messageClient(%client, '', '\c2You can not kick %1, %2 is an Admin!', %arg1.name, %arg1.sex $= "Male" ? 'he' : 'she'); - return; - } - if(%client.team != %arg1.team && %arg1.team != 0) // kick works only with teammates or observers - { - messageClient(%client, '', '\c2Kick votes must be team based.'); - return; - } - if(Game.scheduleVote !$= "") // a vote is already in progress - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - Game.kickClient = %arg1; - Game.kickClientName = %arg1.name; - Game.kickGuid = %arg1.guid; - Game.kickTeam = %arg1.team; - if(%arg1.team != 0 && Game.numTeams > 1) - { - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - - if (%cl.isAdmin == true || (%cl.team == %client.team && !%cl.isAIControlled())) - { - if(%cl.isAdmin == true && %cl.team !$= %client.team) - { - messageClient(%cl, 'AdminOtherTeamKickVoteStarted', '\c2%1 has initiated a vote to kick %2 on the other team.~wgui/objective_notification.wav', %client.name, %arg1.name); - } - else - messageClient( %cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, "kick player", %arg1.name); - - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting, true); - } - else - { - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, "kick player", %arg1.name); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - } - - case "BanPlayer": - if((%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminBan)) && %client != %arg1) // only admins can use ban - { - if(!%client.isSuperAdmin && %arg1.isAdmin) // only super admins can ban admins - { - messageClient(%client, '', '\c2You can not ban %1, %2 is an Admin!', %arg1.name, %arg1.sex $= "Male" ? 'he' : 'she'); - return; - } - ban(%arg1, %client); // ban the player without entering the vote process - %authInfo = %arg1.getAuthInfo(); - adminLog(%client, " banned " @ %arg1.nameBase @ "( " @ getField(%authInfo, 0) @ ", " @ getField(%authInfo, 1) @ ", " @ %arg1.guid @ ", " @ %arg1.getAddress() @ ")"); - } - - case "VoteAdminPlayer": - if((%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdmin2Admin)) && %client != %arg1) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " made " @ %arg1.nameBase @ " an Admin."); - } - else if($Host::allowAdminPlayerVotes) // normal vote - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, "admin player", %arg1.name); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "VoteChangeMission": - if(%isAdmin && !%client.ForceVote ) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " changed the mission to " @ %arg1 @ " (" @ %arg2 @ ")"); - } - else if($Host::TournamentMode || (!$Host::TournamentMode && $Host::AllowPlayerVoteChangeMission)) - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %mission = $HostMissionFile[%arg3]; - %missionType = $HostTypeName[%arg4]; - if(!checkMapExist(%mission, %missionType)) - return; // map doesn't exist - - if(!$Host::TournamentMode && $Host::MapFFA[%mission, %missionType] !$= "" && $Host::MapFFA[%mission, %missionType] == 0) - return; // is FFA, but the map can't be played in FFA - - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3 (%4).', %client.name, "change the mission to", %arg1, %arg2); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "VoteSkipMission": - if(%isAdmin && !%client.ForceVote ) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " skipped the mission."); - } - else if($Host::TournamentMode || (!$Host::TournamentMode && $Host::AllowPlayerVoteChangeMission)) - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, "skip the mission" ); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "VoteFFAMode": - if(%isAdmin) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " changed the server to FFA Mode."); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Free For All Mode.', %client.name, "change the server to"); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "VoteTournamentMode": - if(%isAdmin && !%client.ForceVote) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " changed the server to Tournament Mode " @ %arg1 @ " (" @ %arg2 @ ")"); - } - else if(!$Host::TournamentMode) - { - if(getAdmin() == 0) - { - messageClient(%client, 'clientMsg', 'There must be a server admin to play in Tournament Mode.'); - return; - } - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 Tournament Mode (%3).', %client.name, "change the server to", %arg1); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "VoteMatchStart": - if(%isAdmin) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " started the match."); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, "start the match"); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "CancelMatchStart": - if(%isAdmin) // only admins can cancel match start - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " canceled match start."); - } - - case "VoteTeamDamage": - if(%isAdmin) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, (%arg1 $= "enable team damage" ? " ENABLED team damage." : " DISABLED team damage.")); - } - else if($Host::TournamentMode || (!$Host::TournamentMode && $Host::AllowPlayerVoteTeamDamage)) - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %actionMsg = $TeamDamage ? "disable team damage" : "enable team damage"; - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "VoteChangeTimeLimit": - if(%isAdmin && !%client.ForceVote ) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " changed the time limit to " @ %arg1); - } - else if($Host::TournamentMode || (!$Host::TournamentMode && $Host::AllowPlayerVoteTimeLimit)) - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - if(%arg1 $= "999") %time = "unlimited"; else %time = %arg1; - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, "change the time limit to", %time); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - StartVOTimeVote(%game); - } - - case "VoteGreedMode": - if(%isAdmin) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, (%arg1 $= "enable greed mode" ? " ENABLED Greed mode." : " DISABLED Greed mode.")); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %actionMsg = Game.greedMode ? "disable Greed mode" : "enable Greed mode"; - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "VoteHoardMode": - if(%isAdmin) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, (%arg1 $= "enable hoard mode" ? " ENABLED Hoard mode." : " DISABLED Hoard mode.")); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %actionMsg = Game.hoardMode ? "disable Hoard mode" : "enable Hoard mode"; - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - - case "passRunningVote": - if (%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminPassVote)) - { - adminStartNewVote( %client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " passed the vote in progress."); - } - - case "stopRunningVote": - if(%client.isSuperAdmin || (%client.isAdmin && $Host::AllowAdminStopVote)) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " stopped the vote in progress."); - } - - case "ForceVote": - if (%client.isAdmin && $Host::AllowAdminVotes) - { - if (%client.ForceVote) - { - %client.ForceVote = 0; - messageClient( %client, '', 'Vote to ... cancelled.' ); - } - else - { - %client.ForceVote = 2; - messageClient( %client, '', "Now select what to vote on, please." ); - } - } - case "ToggleTourneyNetClient": - if (%client.isAdmin) - { - if($Host::EnableNetTourneyClient) - { - $Host::EnableNetTourneyClient = 0; - - if(isActivePackage(checkver)) - deactivatePackage(checkver); - - messageClient( %client, '', "Tournament Net Client checking has been disabled.~wfx/powered/vehicle_screen_on.wav" ); - adminLog(%client, " has disabled Net Tourney Client checking."); - } - else - { - $Host::EnableNetTourneyClient = 1; - - if(!isActivePackage(checkver)) - activatePackage(checkver); - - //Boot Offenders into Obs - CheckVerObserver(%client); - - messageClient( %client, '', "Tournament Net Client checking has been enabled.~wfx/powered/vehicle_screen_on.wav" ); - ResetGetCountsStatus(); - adminLog(%client, " has enabled Net Tourney Client checking."); - } - } - case "TogglePUGpassword": - if (%client.isAdmin) - { - if($Host::Password !$= "") - { - $Host::Password = ""; - messageClient( %client, '', "PUG password been disabled.~wfx/powered/vehicle_screen_on.wav" ); - adminLog(%client, " has disabled pug password." ); - } - else - { - $Host::Password = $Host::PUGPassword; - messageClient( %client, '', "PUG password been enabled.~wfx/powered/vehicle_screen_on.wav" ); - adminLog(%client, " has enabled pug password." ); - } - } - case "cancelServerRestart": - if(%client.isSuperAdmin || (%client.isAdmin && $Host::EvoAdminCRCCheck)) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " canceled a server restart."); - } - - case "clearServerForMatch": - if ((%client.isSuperAdmin && $Host::EvoSuperClearServer) || (%client.isAdmin && $Host::EvoAdminClearServer)) - { - adminStartNewVote( %client, %typename, %arg1, %arg2, %arg3, %arg4 ); - adminLog(%client, " cleared server for match."); - } - case "showServerRules": - if (($Host::ServerRules[1] !$= "") && (!%client.CantView)) - { - for ( %i = 1; $Host::ServerRules[%i] !$= ""; %i++ ) - { - messageClient(%client, 'ServerRule', '\c2%1', $Host::ServerRules[%i] ); - } - %client.cantView = true; - %client.schedViewRules = schedule( 10000, %client, "resetViewSchedule", %client ); - } - case "showNextMission": - if ( !%client.CantView ) - { - %ShowNextMissionVar = $EvoCachedNextMission; - if($Host::EvoTourneySameMap && $Host::TournamentMode) %ShowNextMissionVar = $CurrentMission @ " (Same)"; - //MessageAll('MsgNotifyEvoNextMission', '\c2Next Mission: \c1%1', %ShowNextMissionVar); - messageClient(%client, 'MsgNotifyEvoNextMission', '\c2Next Mission: \c1%1', %ShowNextMissionVar); - - %client.cantView = true; - %client.schedViewRules = schedule( 10000, %client, "resetViewSchedule", %client ); - } - // - // sonic9k 11/6/2003 - Added support for LakRabbit DuelMode option - // - case "VoteDuelMode": - if( %isAdmin && !%client.ForceVote ) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " has toggled " @ %arg1 @ " (" @ %arg2 @ ")"); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %actionMsg = ($Host::LakRabbitDuelMode ? "disable Duel mode" : "enable Duel mode"); - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - // - // sonic9k 11/6/2003 - Added support for LakRabbit SplashDamage option - // - case "VoteSplashDamage": - if( %isAdmin && !%client.ForceVote ) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " has toggled " @ %arg1 @ " (" @ %arg2 @ ")"); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %actionMsg = ($Host::LakRabbitNoSplashDamage ? "enable SplashDamage" : "disable SplashDamage"); - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - // - // chocotaco 8/7/2018 - Added support for LakRabbit Pro option - // - case "VotePro": - if( %isAdmin && !%client.ForceVote ) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " has toggled " @ %arg1 @ " (" @ %arg2 @ ")"); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %actionMsg = ($Host::LakRabbitPubPro ? "disable Pro mode" : "enable Pro mode"); - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - case "SCtFProMode": - if( %isAdmin && !%client.ForceVote ) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " has toggled " @ %arg1 @ " (" @ %arg2 @ ")"); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %actionMsg = ($Host::SCtFProMode ? "disable Pro mode" : "enable Pro mode"); - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - case "DMSLOnlyMode": - if( %isAdmin && !%client.ForceVote ) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, " has toggled " @ %arg1 @ " (" @ %arg2 @ ")"); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - %actionMsg = ($Host::DMSLOnlyMode ? "disable Shocklance Only Mode" : "enable Shocklance Only Mode"); - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2.', %client.name, %actionMsg); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - //---------------------------- CLASSIC MOD - case "VoteArmorLimits": - if(%isAdmin) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, %arg3); - } - - case "VoteRandomTeams": - if(%isAdmin) - { - adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4); - adminLog(%client, %arg3); - } - else - { - if(Game.scheduleVote !$= "") - { - messageClient(%client, 'voteAlreadyRunning', '\c2A vote is already in progress.'); - return; - } - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - if(!%cl.isAIControlled()) - { - messageClient(%cl, 'VoteStarted', '\c2%1 initiated a vote to %2 %3.', %client.name, %arg3, %arg1); - %clientsVoting++; - } - } - playerStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4, %clientsVoting); - } - default: - return; - } + Parent::gameOver(%game); + + //Reset ClassicMaxMapChangeVotes + deleteVariables("$CMHasVoted*"); // Eolk - let people who have voted vote again } function DefaultGame::cancelMatchStart(%game, %admin) @@ -1074,46 +645,86 @@ function DefaultGame::cancelMatchStart(%game, %admin) } } +//------------------------------------------------------------------------------ +// all team based votes here +function DefaultGame::voteKickPlayer(%game, %admin, %client) +{ + %cause = ""; + + if(isObject(%admin)) + { + kick(%client, %admin, %client.guid ); + %cause = "(admin)"; + } + else + { + %team = %client.team; + %totalVotes = %game.votesFor[%game.kickTeam] + %game.votesAgainst[%game.kickTeam]; + if(%totalVotes > 0 && (%game.votesFor[%game.kickTeam] / %totalVotes) > ($Host::VotePasspercent / 100)) + { + kick(%client, %admin, %game.kickGuid); + %cause = "(vote)"; + } + else + { + for ( %idx = 0; %idx < ClientGroup.getCount(); %idx++ ) + { + %cl = ClientGroup.getObject( %idx ); + + if (%cl.team == %game.kickTeam && !%cl.isAIControlled()) + messageClient( %cl, 'MsgVoteFailed', '\c2Kick player vote did not pass.' ); + } + } + } + + %game.kickTeam = ""; + %game.kickGuid = ""; + %game.kickClientName = ""; + + if(%cause !$= "") + logEcho($AdminCl.nameBase @ ": " @ %name @ " (cl " @ %game.kickClient @ ") kicked " @ %cause, 1); +} + +//------------------------------------------------------------------------------ function DefaultGame::voteChangeMission(%game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId) { %mission = $HostMissionFile[%missionId]; - %missionType = $HostTypeName[%missionTypeId]; - if(!checkMapExist(%mission, %missionType)) - return; // map doesn't exist - - if(!$Host::TournamentMode && $Host::MapFFA[%mission, %missionType] !$= "" && $Host::MapFFA[%mission, %missionType] == 0) - return; // is FFA, but the map can't be played in FFA - - if(%admin) + if ( %mission $= "" ) { - messageAll('MsgAdminChangeMission', '\c2The Admin has changed the mission to %1 (%2).', %missionDisplayName, %typeDisplayName); - logEcho("mission changed to " @ %missionDisplayName @ "/" @ %typeDisplayName @ " (admin)"); + error( "Invalid mission index passed to DefaultGame::voteChangeMission!" ); + return; + } + + %missionType = $HostTypeName[%missionTypeId]; + if ( %missionType $= "" ) + { + error( "Invalid mission type id passed to DefaultGame::voteChangeMission!" ); + return; + } + + // Eolk - Part of $admincl fix. + if(isObject(%admin)) + { + messageAll('MsgAdminChangeMission', '\c2The Admin %3 has changed the mission to %1 (%2).', %missionDisplayName, %typeDisplayName, %admin.name ); %game.gameOver(); - - // set a flag, so next map the skip mission vote won't start - $AdminChangedMission = 1; - loadMission(%mission, %missionType, false); + loadMission( %mission, %missionType, false ); } else { %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; - // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - ZOD - // Changed it back. Choco + // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) { - messageAll('MsgVotePassed', '\c2The mission was changed to %1 (%2) by vote.', %missionDisplayName, %typeDisplayName); - logEcho("mission changed to " @ %missionDisplayName @ "/" @ %typeDisplayName @ " (vote)"); - %game.gameOver(); - - loadMission(%mission, %missionType, false); + messageAll('MsgVotePassed', '\c2The mission was changed to %1 (%2) by vote.', %missionDisplayName, %typeDisplayName ); + %game.gameOver(); + loadMission( %mission, %missionType, false ); } - else - { - messageAll('MsgVoteFailed', '\c2Change mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); - } + else + messageAll('MsgVoteFailed', '\c2Change mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); } } +//------------------------------------------------------------------------------ function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %typeDisplayName, %missionId, %missionTypeId ) { %mission = $HostMissionFile[%missionId]; @@ -1131,96 +742,206 @@ function DefaultGame::voteTournamentMode( %game, %admin, %missionDisplayName, %t } %cause = ""; - if (%admin) + if (isObject(%admin)) { - messageAll( 'MsgAdminForce', '\c2The Admin %2 has switched the server to Tournament mode (%1).', %missionDisplayName, $AdminCl.name ); + messageAll( 'MsgAdminForce', '\c2The Admin %2 has switched the server to Tournament mode (%1).', %missionDisplayName, %admin.name ); setModeTournament( %mission, %missionType ); - %cause = "(admin)"; } else { %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; - // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - ZOD - // Changed it back. Choco - if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) + // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) { messageAll('MsgVotePassed', '\c2Server switched to Tournament mode by vote (%1): %2 percent.', %missionDisplayName, mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); setModeTournament( %mission, %missionType ); - %cause = "(vote)"; } else - { messageAll('MsgVoteFailed', '\c2Tournament mode vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); - } } + if(%cause !$= "") logEcho($AdminCl.nameBase @ ": tournament mode set "@%cause, 1); } -function DefaultGame::voteChangeTimeLimit(%game, %admin, %newLimit) -{ - if(%newLimit == 999) +//------------------------------------------------------------------------------ +function DefaultGame::voteChangeTimeLimit( %game, %admin, %newLimit ) +{ + if( %newLimit == 999 ) %display = "unlimited"; else %display = %newLimit; %cause = ""; - if(%admin) + if ( %admin ) { - messageAll('MsgAdminForce', '\c2The Admin changed the mission time limit to %1 minutes.', %display); + messageAll( 'MsgAdminForce', '\c2The Admin %2 changed the mission time limit to %1 minutes.', %display, %admin.name ); $Host::TimeLimit = %newLimit; - %cause = "(admin)"; - - // reset the voted time limit when changing mission - $TimeLimitChanged = 1; } - else if($Host::AllowPlayerVoteTimeLimit) + else { %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; - // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - ZOD - // Changed it back. Choco - if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) + // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) { - ResetVOTimeChanged(%game); - messageAll('MsgVotePassed', '\c2The mission time limit was set to %1 minutes by vote.', %display); - $Host::TimeLimit = %newLimit; - %cause = "(vote)"; - - // reset the voted time limit when changing mission - $TimeLimitChanged = 1; + messageAll('MsgVotePassed', '\c2The mission time limit was set to %1 minutes by vote.', %display); + $Host::TimeLimit = %newLimit; } else - { - messageAll('MsgVoteFailed', '\c2The vote to change the mission time limit did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); - ResetVOall(%game); - //called so the game can end with a failed timevote for voteovertime - DefaultGame::checkTimeLimit(%game, %forced); - } + messageAll('MsgVoteFailed', '\c2The vote to change the mission time limit did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); } - //if the time limit was actually changed... - if(%cause !$= "") + //if the match has been started, reset the end of match countdown + if ($matchStarted) { - logEcho("time limit set to " @ %display SPC %cause); + //schedule the end of match countdown + %elapsedTimeMS = getSimTime() - $missionStartTime; + %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) - %elapsedTimeMS; + error("time limit="@$Host::TimeLimit@", elapsed="@(%elapsedTimeMS / 60000)@", curtimeleftms="@%curTimeLeftMS); + CancelEndCountdown(); + EndCountdown(%curTimeLeftMS); + cancel(%game.timeSync); + %game.checkTimeLimit(true); + } +} - //if the match has been started, reset the end of match countdown - if($matchStarted) +//------------------------------------------------------------------------------ +function DefaultGame::voteFFAMode( %game, %admin, %client ) +{ + %cause = ""; + %name = getTaggedString(%client.name); + + if(isObject(%admin)) + { + messageAll('MsgAdminForce', '\c2The Admin %1 has switched the server to Free For All mode.', %admin.name); + setModeFFA($CurrentMission, $CurrentMissionType); + } + else + { + %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; + // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) { - //schedule the end of match countdown - %elapsedTimeMS = getSimTime() - $missionStartTime; - %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) - %elapsedTimeMS; - CancelEndCountdown(); - - if ( %newLimit != 999 ) - { - EndCountdown(%curTimeLeftMS); - cancel( %game.timeSync ); - %game.checkTimeLimit( true ); - } - else - { - cancel(%game.timeSync); - } + messageAll('MsgVotePassed', '\c2Server switched to Free For All mode by vote.', %client); + setModeFFA($CurrentMission, $CurrentMissionType); + } + else + messageAll('MsgVoteFailed', '\c2Free For All mode vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); + } +} + +function DefaultGame::voteSkipMission(%game, %admin, %arg1, %arg2, %arg3, %arg4) +{ + if(isObject(%admin)) + { + messageAll('MsgAdminForce', '\c2The Admin %1 has skipped to the next mission.',%admin.name ); + %game.gameOver(); + //loadMission( findNextCycleMission(), $CurrentMissionType, false ); + cycleMissions(); + } + else + { + %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; + // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) + { + messageAll('MsgVotePassed', '\c2The mission was skipped to next by vote.'); + echo("mission skipped (vote)"); + %game.gameOver(); + //loadMission( findNextCycleMission(), $CurrentMissionType, false ); + cycleMissions(); + } + else + messageAll('MsgVoteFailed', '\c2Skip mission vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); + } +} + +//------------------------------------------------------------------------------ +function DefaultGame::voteMatchStart( %game, %admin) +{ + %cause = ""; + %ready = forceTourneyMatchStart(); + if(isObject(%admin)) + { + if(!%ready) + { + // z0dd - ZOD, 5/19/03. This was sending to %client, there is no %client declared, duh + messageClient( %admin, 'msgClient', '\c2No players are ready yet.'); + return; + } + else + { + messageAll('msgMissionStart', '\c2The admin %1 has forced the match to start.', %admin.name); + startTourneyCountdown(); + } + } + else + { + if(!%ready) + { + messageAll( 'msgClient', '\c2Vote passed to start match, but no players are ready yet.'); + return; + } + else + { + %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; + // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) + { + messageAll('MsgVotePassed', '\c2The match has been started by vote: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); + startTourneyCountdown(); + } + else + messageAll('MsgVoteFailed', '\c2Start Match vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); + } + } +} + +//------------------------------------------------------------------------------ +function DefaultGame::voteTeamDamage(%game, %admin) +{ + %setto = ""; + %cause = ""; + if(isObject(%admin)) + { + if($teamDamage) + { + messageAll('MsgAdminForce', '\c2The Admin %1 has disabled team damage.', %admin.name); + $Host::TeamDamageOn = $TeamDamage = 0; + %setto = "disabled"; + } + else + { + messageAll('MsgAdminForce', '\c2The Admin %1 has enabled team damage.', %admin.name); + $Host::TeamDamageOn = $TeamDamage = 1; + %setto = "enabled"; + } + } + else + { + %totalVotes = %game.totalVotesFor + %game.totalVotesAgainst; + // Added people who dont vote into the equation, now if you do not vote, it doesn't count as a no. - z0dd - ZOD + if(%totalVotes > 0 && (%game.totalVotesFor / (ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone)) > ($Host::VotePasspercent / 100)) + { + if($teamDamage) + { + messageAll('MsgVotePassed', '\c2Team damage was disabled by vote.'); + $Host::TeamDamageOn = $TeamDamage = 0; + %setto = "disabled"; + } + else + { + messageAll('MsgVotePassed', '\c2Team damage was enabled by vote.'); + $Host::TeamDamageOn = $TeamDamage = 1; + %setto = "enabled"; + } + } + else + { + if($teamDamage) + messageAll('MsgVoteFailed', '\c2Disable team damage vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); + else + messageAll('MsgVoteFailed', '\c2Enable team damage vote did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); } } } @@ -1369,7 +1090,8 @@ function DefaultGame::passRunningVote(%game, %admin, %arg1, %arg2, %arg3, %arg4) if ( %admin && Game.scheduleVote !$= "" ) { passCurrentVote(); - messageAll('MsgAdminForce', '\c2The admin has passed the vote.' ); + messageAll('MsgAdminForce', '\c2The Admin passed the vote.' ); + echo("The admin" SPC %admin.nameBase SPC "has passed the vote."); } } @@ -1378,61 +1100,31 @@ function DefaultGame::stopRunningVote(%game, %admin, %arg1, %arg2, %arg3, %arg4) if(%admin && Game.scheduleVote !$= "") { stopCurrentVote(); - messageAll('MsgAdminForce', '\c2The Admin stopped the vote.~wfx/misc/bounty_completed.wav'); + messageAll('MsgAdminForce', '\c2The Admin stopped the vote.'); + echo("The admin" SPC %admin.nameBase SPC "has stopped the vote."); } } -function adminStartNewVote(%client, %typename, %arg1, %arg2, %arg3, %arg4) +function adminStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4) { - // this function handle only admin votes - if(%client.isAdmin && %client != %arg1) - { - if(Game.scheduleVote !$= "" && Game.voteType $= %typeName) - { - messageAll('closeVoteHud', ""); - cancel(Game.scheduleVote); - Game.scheduleVote = ""; - Game.scheduleVoteArgs = ""; - } - Game.evalVote(%typeName, true, %arg1, %arg2, %arg3, %arg4); - } + if ( Game.scheduleVote !$= "" && Game.voteType $= %typeName ) + { + messageAll('closeVoteHud', ""); + cancel(Game.scheduleVote); + Game.scheduleVote = ""; + + // Eolk - Voting control variables + Game.votingArgs[typeName] = ""; + Game.votingArgs[arg1] = ""; + Game.votingArgs[arg2] = ""; + Game.votingArgs[arg3] = ""; + Game.votingArgs[arg4] = ""; + } + Game.evalVote(%typeName, %client, %arg1, %arg2, %arg3, %arg4); } }; -function PizzaTriconPopup(%client, %key, %text, %function, %number) -{ - if ( %client.pizza ) - { - messageClient( %client, 'MsgPlayerPopupItem', "", %key, %function, "", %text, %number ); - return; - } - if ( %client.tricon ) - { - messageClient( %client, 'MsgPlayerPopupItem', "", %key, %function, "", %text, 10000+%number ); - return; - } -} - -function TriconWrapper(%client, %target, %function) -{ - switch(%function) - { - case 10016: - serverCmdWhois( %client, %target ); - return 1; - - case 10017: - serverCmdAddToBanList( %client, %target ); - return 1; - - case 10019: - serverCmdSuperAdminPlayer( %client, %target ); - return 1; - } - return 0; -} - // checkMapExist(%missionName, %missionType) // Info: check if a map exist in the mission type function checkMapExist(%missionName, %missionType) @@ -1462,27 +1154,34 @@ function checkMapExist(%missionName, %missionType) // Info: passes a vote that is running. function passCurrentVote() // Edit GG { - cancel(Game.scheduleVote); - Game.totalVotesFor = ClientGroup.getCount() - $HostGameBotCount; - Game.totalVotesAgainst = 0; - Game.evalVote(Game.scheduleVoteArgs[typeName], false, Game.scheduleVoteArgs[arg1], Game.scheduleVoteArgs[arg2], Game.scheduleVoteArgs[arg3], Game.scheduleVoteArgs[arg4]); - Game.scheduleVote = ""; - Game.scheduleVoteArgs = ""; - Game.kickClient = ""; - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) + if(Game.scheduleVote !$= "") { - %cl = ClientGroup.getObject(%idx); - messageClient(%cl, 'closeVoteHud', ""); - if(%cl.team != 0) - clearBottomPrint(%cl); - } - clearVotes(); - //Stop vote chimes - for(%i = 0; %i < $Host::EnableVoteSoundReminders; %i++) - { - if(isEventPending(Game.voteReminder[%i])) - cancel(Game.voteReminder[%i]); - Game.voteReminder[%i] = ""; + messageAll('closeVoteHud', ""); + cancel(Game.scheduleVote); + Game.scheduleVote = ""; + Game.kickClient = ""; + + if(Game.votingArgs[typeName] $= "VoteKickPlayer") // special case here + { + Game.votesFor[Game.kickTeam] = ClientGroup.getCount() - $HostGameBotCount; + Game.votesAgainst[Game.kickTeam] = 0; + } + else + { + Game.totalVotesFor = ClientGroup.getCount() - $HostGameBotCount; + Game.totalVotesAgainst = 0; + } + + Game.evalVote(Game.votingArgs[typeName], false, Game.votingArgs[arg1], Game.votingArgs[arg2], Game.votingArgs[arg3], Game.votingArgs[arg4]); + clearVotes(); + + //Stop vote chimes + for(%i = 0; %i < $Host::EnableVoteSoundReminders; %i++) + { + if(isEventPending(Game.voteReminder[%i])) + cancel(Game.voteReminder[%i]); + Game.voteReminder[%i] = ""; + } } } @@ -1490,25 +1189,22 @@ function passCurrentVote() // Edit GG // Info: stop a vote that is still running function stopCurrentVote() { - cancel(Game.scheduleVote); - Game.scheduleVote = ""; - Game.kickClient = ""; - Game.scheduleVoteArgs = ""; - for(%idx = 0; %idx < ClientGroup.getCount(); %idx++) - { - %cl = ClientGroup.getObject(%idx); - messageClient(%cl, 'closeVoteHud', ""); - if(%cl.team != 0) - clearBottomPrint(%cl); - } - clearVotes(); - //Stop vote chimes - for(%i = 0; %i < $Host::EnableVoteSoundReminders; %i++) - { - if(isEventPending(Game.voteReminder[%i])) - cancel(Game.voteReminder[%i]); - Game.voteReminder[%i] = ""; - } + if(Game.scheduleVote !$= "") + { + messageAll('closeVoteHud', ""); + cancel(Game.scheduleVote); + Game.scheduleVote = ""; + Game.kickClient = ""; + clearVotes(); + + //Stop vote chimes + for(%i = 0; %i < $Host::EnableVoteSoundReminders; %i++) + { + if(isEventPending(Game.voteReminder[%i])) + cancel(Game.voteReminder[%i]); + Game.voteReminder[%i] = ""; + } + } } // calcVotes(%typeName, %arg1, %arg2, %arg3, %arg4) @@ -1556,6 +1252,22 @@ function calcVotes(%typeName, %arg1, %arg2, %arg3, %arg4) clearVotes(); } +function messageAdmins(%msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13) +{ + for(%i = 0; %i < ClientGroup.getCount(); %i++) + { + %cl = ClientGroup.getObject(%i); + if(%cl.isAdmin) + messageClient(%cl, %msgType, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13); + } +} + +function resetViewSchedule(%client) +{ + %client.cantView = false; + %client.schedViewRules = ""; +} + // Prevent package from being activated if it is already if (!isActivePackage(ExtraVoteMenu)) activatePackage(ExtraVoteMenu); \ No newline at end of file diff --git a/Classic/scripts/autoexec/VoteSound.cs b/Classic/scripts/autoexec/VoteSound.cs index 8952bab..a2154a8 100644 --- a/Classic/scripts/autoexec/VoteSound.cs +++ b/Classic/scripts/autoexec/VoteSound.cs @@ -24,6 +24,15 @@ function VoteSound( %game, %typename, %arg1, %arg2 ) if(%arg1 $= "999") %arg1 = "unlimited"; messageAll('', '\c1Vote in Progress: \c0To change the time limit to %1. %2~wgui/objective_notification.wav', %arg1, %votemsg ); echo("Vote in Progress: To change the time limit to" SPC %arg1 @ "."); + case "VoteTournamentMode": + messageAll('', '\c1Vote in Progress: \c0To change the mission to Tournament Mode (%1). %3~wgui/objective_notification.wav', %arg1, %arg2, %votemsg ); + echo("Vote in Progress: To change the mission to Tournament Mode" SPC "(" @ %arg1 @ ")."); + case "VoteMatchStart": + messageAll('', '\c1Vote in Progress: \c0To start the match. %3~wgui/objective_notification.wav', %arg1, %arg2, %votemsg ); + echo("Vote in Progress: To start the match."); + case "VoteFFAMode": + messageAll('', '\c1Vote in Progress: \c0To change the server to Free For All Mode. %3~wgui/objective_notification.wav', %arg1, %arg2, %votemsg ); + echo("Vote in Progress: To change the server to Free For All Mode."); case "VoteKickPlayer": if(%arg1.team != 0 && Game.numTeams > 1) //Not observer { @@ -47,9 +56,6 @@ function VoteSound( %game, %typename, %arg1, %arg2 ) else //Is observer messageAll('', '\c1Vote in Progress: \c0To kick player %1. %2~wgui/objective_notification.wav', %arg1.nameBase, %votemsg ); echo("Vote in Progress: To kick player" SPC %arg1.nameBase SPC "(" @ %arg1.guid @ ")."); - case "VoteTournamentMode": - messageAll('', '\c1Vote in Progress: \c0To change the mission to Tournament Mode (%1). %3~wgui/objective_notification.wav', %arg1, %arg2, %votemsg ); - echo("Vote in Progress: To change the mission to Tournament Mode" SPC "(" @ %arg1 @ ")."); default: messageAll('', '\c1Vote in Progress: \c0To %1. %2~wgui/objective_notification.wav', %arg1, %votemsg ); echo("Vote in Progress: To" SPC %arg1); diff --git a/Classic/scripts/serverDefaults.cs b/Classic/scripts/serverDefaults.cs index 36c9e9f..b8e82da 100644 --- a/Classic/scripts/serverDefaults.cs +++ b/Classic/scripts/serverDefaults.cs @@ -168,6 +168,7 @@ $Host::ClassicStatsType = 2; $Host::ClassicViralBanning = 1; $Host::ClassicWhitelist = "prefs/whitelist.cs"; $Host::ClassicSuppressTraversalRootError = 1; +$Host::ClassicMaxVotes = 5; $Host::ServerRules1 = "\c2if\c4(\c3%client.fun == \c5true \c4&& \c3%client.Llama_Grabs \c4< \c51\c4)"; $Host::ServerRules2 = " \c1Be_Courteous\c4(\c2%client, %game\c4);"; $Host::ServerRules3 = "\c2else if\c4(\c3%client.attitude \c4!$ = \c5%client.fun\c4)";