From ec81ce6b7481c0561345d840b970b2ab7318b34c Mon Sep 17 00:00:00 2001 From: ChocoTaco1 Date: Sat, 4 Apr 2020 14:38:45 -0400 Subject: [PATCH] Merge branch 'NoEvo' --- Classic/prefs/serverPrefs.cs | 2 ++ Classic/scripts/autoexec/EnableLogs.cs | 25 ++++++++++++-- .../{ExploitPatches.cs => MemPatches.cs} | 2 +- Classic/scripts/autoexec/VoteMenu.cs | 33 ++++++++++++++++--- Classic/scripts/autoexec/VoteOverTime.cs | 3 -- Classic/scripts/serverDefaults.cs | 2 ++ 6 files changed, 57 insertions(+), 10 deletions(-) rename Classic/scripts/autoexec/{ExploitPatches.cs => MemPatches.cs} (97%) diff --git a/Classic/prefs/serverPrefs.cs b/Classic/prefs/serverPrefs.cs index e43140d..9e17204 100644 --- a/Classic/prefs/serverPrefs.cs +++ b/Classic/prefs/serverPrefs.cs @@ -72,6 +72,8 @@ $Host::ClassicTelnetPort = 666; $Host::ClassicTkLimit = 0; $Host::ClassicUseHighPerformanceCounter = 0; $Host::ClassicViralBanning = 1; +$Host::ClassicVoteLog = 1; +$Host::ClassicVoteLogPath = "logs/Vote/Vote.log"; $Host::ClassicWhitelist = "prefs/whitelist.cs"; $Host::CRCTextures = 0; $Host::Dedicated = 1; diff --git a/Classic/scripts/autoexec/EnableLogs.cs b/Classic/scripts/autoexec/EnableLogs.cs index 8b48083..b36463e 100644 --- a/Classic/scripts/autoexec/EnableLogs.cs +++ b/Classic/scripts/autoexec/EnableLogs.cs @@ -1,5 +1,7 @@ -$Host::ClassicAdminLog = 1; -$Host::ClassicConnectLog = 1; +//$Host::ClassicAdminLog = 1; +//$Host::ClassicConnectLog = 1; +//$Host::ClassicVoteLog = 1; + //exec("scripts/autoexec/EnableLogs.cs"); //Enable Logs @@ -58,4 +60,23 @@ function connectLog(%client, %isDisconnect) logEcho($ConnectLog); echo($ConnectLog); } +} + +// voteLog(%client, %votemsg) +// Info: Logs the vote events +function voteLog(%client, %votemsg) +{ + if($Host::ClassicVoteLog) + { + // get the client info + %authInfo = %client.getAuthInfo(); + %ip = getField(strreplace(%client.getAddress(),":","\t"),1); + + // this is the info that will be logged + $VoteLog = "#P[" @ $HostGamePlayerCount @ "]" SPC formatTimeString("M-d") SPC formatTimeString("[HH:nn]") SPC %client.nameBase @ " (" @ getField(%authInfo, 0) @ "," SPC %client.guid @ ") Initiated a vote:" SPC %votemsg SPC "CM[" @ $CurrentMission @ "]"; + + %logpath = $Host::ClassicVoteLogPath; + export("$VoteLog", %logpath, true); + logEcho($VoteLog); + } } \ No newline at end of file diff --git a/Classic/scripts/autoexec/ExploitPatches.cs b/Classic/scripts/autoexec/MemPatches.cs similarity index 97% rename from Classic/scripts/autoexec/ExploitPatches.cs rename to Classic/scripts/autoexec/MemPatches.cs index c18aa03..db77650 100644 --- a/Classic/scripts/autoexec/ExploitPatches.cs +++ b/Classic/scripts/autoexec/MemPatches.cs @@ -1,4 +1,4 @@ -// Exploit Patches Script +// Memory Patches // Remote Code Execution Patch by Bahke memPatch("A3C300","A370C3A300E8D609A0FF8B46205053E98103A0FF"); diff --git a/Classic/scripts/autoexec/VoteMenu.cs b/Classic/scripts/autoexec/VoteMenu.cs index 2be5859..6562509 100644 --- a/Classic/scripts/autoexec/VoteMenu.cs +++ b/Classic/scripts/autoexec/VoteMenu.cs @@ -323,6 +323,8 @@ function serverCmdStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, % { if(%arg1 $= "999") %time = "unlimited"; else %time = %arg1; %msg = %client.nameBase @ " initiated a vote to change the time limit to " @ %time @ "."; + // VoteOvertime + StartVOTimeVote(%game); } case "VoteMatchStart": @@ -547,6 +549,14 @@ function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %tea } else { + if(%typeName $= "VoteChangeTimeLimit") + { + if(%arg1 $= "999") + %time = "Unlimited"; + else + %time = %arg1; + } + %count = ClientGroup.getCount(); for(%i = 0; %i < %count; %i++) { @@ -561,7 +571,6 @@ function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %tea 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); @@ -605,7 +614,14 @@ function playerStartNewVote(%client, %typeName, %arg1, %arg2, %arg3, %arg4, %tea %client.canVote = false; %client.rescheduleVote = schedule(($Host::voteSpread * 1000) + ($Host::voteTime * 1000) , 0, "resetVotePrivs", %client); - echo("Vote Initiated by" SPC %client.nameBase SPC %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4); + echo(%msg); + + // Log Vote + if($Host::ClassicVoteLog) + { + %votemsg = %typeName SPC %arg1 SPC %arg2 SPC %arg3 SPC %arg4; + voteLog(%client, %votemsg); + } if($Host::EnableVoteSoundReminders > 0) { @@ -783,9 +799,17 @@ function DefaultGame::voteChangeTimeLimit( %game, %admin, %newLimit ) { messageAll('MsgVotePassed', '\c2The mission time limit was set to %1 minutes by vote.', %display); $Host::TimeLimit = %newLimit; + // VoteOvertime + ResetVOTimeChanged(%game); + // Reset the voted time limit when changing mission + $TimeLimitChanged = 1; } 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)); + { + messageAll('MsgVoteFailed', '\c2The vote to change the mission time limit did not pass: %1 percent.', mFloor(%game.totalVotesFor/(ClientGroup.getCount() - $HostGameBotCount - %game.totalVotesNone) * 100)); + // VoteOvertime + ResetVOall(%game); + } } //if the match has been started, reset the end of match countdown @@ -1094,7 +1118,8 @@ function DefaultGame::passRunningVote(%game, %admin, %arg1, %arg2, %arg3, %arg4) function DefaultGame::stopRunningVote(%game, %admin, %arg1, %arg2, %arg3, %arg4) { - if(%admin && Game.scheduleVote !$= "") + %curTimeLeftMS = ($Host::TimeLimit * 60 * 1000) + $missionStartTime - getSimTime(); + if(%admin && Game.scheduleVote !$= "" && %curTimeLeftMS > 0) { stopCurrentVote(); messageAll('MsgAdminForce', '\c2The Admin stopped the vote.'); diff --git a/Classic/scripts/autoexec/VoteOverTime.cs b/Classic/scripts/autoexec/VoteOverTime.cs index 6e6ce4e..87a52c8 100644 --- a/Classic/scripts/autoexec/VoteOverTime.cs +++ b/Classic/scripts/autoexec/VoteOverTime.cs @@ -68,9 +68,6 @@ function DefaultGame::gameOver(%game) //Reset everything to do with Vote Overtime ResetVOall(%game); - - if(isEventPending($VoteSoundSchedule)) - cancel($VoteSoundSchedule); } }; diff --git a/Classic/scripts/serverDefaults.cs b/Classic/scripts/serverDefaults.cs index b8e82da..8ee37a7 100644 --- a/Classic/scripts/serverDefaults.cs +++ b/Classic/scripts/serverDefaults.cs @@ -169,6 +169,8 @@ $Host::ClassicViralBanning = 1; $Host::ClassicWhitelist = "prefs/whitelist.cs"; $Host::ClassicSuppressTraversalRootError = 1; $Host::ClassicMaxVotes = 5; +$Host::ClassicVoteLog = 1; +$Host::ClassicVoteLogPath = "logs/Vote/Vote.log"; $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)";