From 1184d38b60e7b0b0f0ab97571aa80d11c648d4e2 Mon Sep 17 00:00:00 2001 From: sniperpl Date: Wed, 28 Aug 2024 00:20:29 +0200 Subject: [PATCH 1/4] chatprefix, .rr --- .gitignore | 3 ++- ConsoleCommands.cs | 1 + MatchZy.cs | 1 + Utility.cs | 38 +++++++++++++++++++------------------- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 557ab36..1817949 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ obj/* -bin/* \ No newline at end of file +bin/* +/.vs \ No newline at end of file diff --git a/ConsoleCommands.cs b/ConsoleCommands.cs index 96ad012..7814c17 100644 --- a/ConsoleCommands.cs +++ b/ConsoleCommands.cs @@ -441,6 +441,7 @@ public void OnEndMatchCommand(CCSPlayerController? player, CommandInfo? command) } [ConsoleCommand("css_restart", "Restarts the match")] + [ConsoleCommand("css_rr", "Restarts the match")] public void OnRestartMatchCommand(CCSPlayerController? player, CommandInfo? command) { if (IsPlayerAdmin(player, "css_restart", "@css/config")) diff --git a/MatchZy.cs b/MatchZy.cs index eaf0a93..953e182 100644 --- a/MatchZy.cs +++ b/MatchZy.cs @@ -135,6 +135,7 @@ public override void Load(bool hotReload) { { ".skipveto", OnSkipVetoCommand }, { ".sv", OnSkipVetoCommand }, { ".restart", OnRestartMatchCommand }, + { ".rr", OnRestartMatchCommand }, { ".endmatch", OnEndMatchCommand }, { ".forceend", OnEndMatchCommand }, { ".reloadmap", OnMapReloadCommand }, diff --git a/Utility.cs b/Utility.cs index ec4783b..97c6f92 100644 --- a/Utility.cs +++ b/Utility.cs @@ -32,6 +32,25 @@ private void PrintToPlayerChat(CCSPlayerController player, string message) player.PrintToChat($"{chatPrefix} {message}"); } + private void ReplyToUserCommand(CCSPlayerController? player, string message, bool console = false) + { + if (player == null) + { + Server.PrintToConsole($"{chatPrefix} {message}"); + } + else + { + if (console) + { + player.PrintToConsole($"{chatPrefix} {message}"); + } + else + { + player.PrintToChat($"{chatPrefix} {message}"); + } + } + } + private void LoadAdmins() { string fileName = "MatchZy/admins.json"; @@ -1125,25 +1144,6 @@ public bool IsTeamSwapRequired() return false; } - private void ReplyToUserCommand(CCSPlayerController? player, string message, bool console = false) - { - if (player == null) - { - Server.PrintToConsole($"[MatchZy] {message}"); - } - else - { - if (console) - { - player.PrintToConsole($"[MatchZy] {message}"); - } - else - { - player.PrintToChat($"{chatPrefix} {message}"); - } - } - } - private void PauseMatch(CCSPlayerController? player, CommandInfo? command) { if (isMatchLive && isPaused) From ca9c2a6999c725d6615f048aa83c0c282046f8e6 Mon Sep 17 00:00:00 2001 From: sniperpl Date: Wed, 28 Aug 2024 01:49:13 +0200 Subject: [PATCH 2/4] msgs? --- MapVeto.cs | 4 ++-- Utility.cs | 29 +++++++++++++---------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/MapVeto.cs b/MapVeto.cs index 3dc01e7..144bec5 100644 --- a/MapVeto.cs +++ b/MapVeto.cs @@ -199,7 +199,7 @@ public void HandeMapBanCommand(CCSPlayerController player, string map) if (player.UserId != vetoCaptains[currentTeamToBan]) return; if (!BanMap(map, playerTeam)) { - player.PrintToChat($"{chatPrefix} {map} is not a valid map."); + PrintToPlayerChat(player, $"{map} is not a valid map."); } else { HandleVetoStep(); } @@ -229,7 +229,7 @@ public void HandeMapPickCommand(CCSPlayerController player, string map) if (player.UserId != vetoCaptains[currentTeamToPick]) return; if (!PickMap(map, playerTeam)) { - player.PrintToChat($"{chatPrefix} {map} is not a valid map."); + PrintToPlayerChat(player, $"{map} is not a valid map."); } else { HandleVetoStep(); } diff --git a/Utility.cs b/Utility.cs index 97c6f92..f04870c 100644 --- a/Utility.cs +++ b/Utility.cs @@ -1356,35 +1356,32 @@ private string GetColorTreatedString(string message) private void SendAvailableCommandsMessage(CCSPlayerController? player) { if (!IsPlayerValid(player)) return; + + ReplyToUserCommand(player, "Available commands:"); + if (isPractice) { - ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}"); - player!.PrintToChat($" {ChatColors.Green}Spawns: {ChatColors.Default}.spawn, .ctspawn, .tspawn, .bestspawn, .worstspawn"); - player.PrintToChat($" {ChatColors.Green}Bots: {ChatColors.Default}.bot, .nobots, .crouchbot, .boost, .crouchboost"); - player.PrintToChat($" {ChatColors.Green}Nades: {ChatColors.Default}.loadnade, .savenade, .importnade, .listnades"); - player.PrintToChat($" {ChatColors.Green}Nade Throw: {ChatColors.Default}.rethrow, .throwindex , .lastindex, .delay "); - player.PrintToChat($" {ChatColors.Green}Utility & Toggles: {ChatColors.Default}.clear, .fastforward, .last, .back, .solid, .impacts, .traj"); - player.PrintToChat($" {ChatColors.Green}Sides & Others: {ChatColors.Default}.ct, .t, .spec, .fas, .god, .dryrun, .break, .exitprac"); + player!.PrintToChat($"{ChatColors.Green}Spawns: {ChatColors.Default}.spawn, .ctspawn, .tspawn, .bestspawn, .worstspawn"); + player.PrintToChat($"{ChatColors.Green}Bots: {ChatColors.Default}.bot, .nobots, .crouchbot, .boost, .crouchboost"); + player.PrintToChat($"{ChatColors.Green}Nades: {ChatColors.Default}.loadnade, .savenade, .importnade, .listnades"); + player.PrintToChat($"{ChatColors.Green}Nade Throw: {ChatColors.Default}.rethrow, .throwindex , .lastindex, .delay "); + player.PrintToChat($"{ChatColors.Green}Utility & Toggles: {ChatColors.Default}.clear, .fastforward, .last, .back, .solid, .impacts, .traj"); + player.PrintToChat($"{ChatColors.Green}Sides & Others: {ChatColors.Default}.ct, .t, .spec, .fas, .god, .dryrun, .break, .exitprac"); return; } if (readyAvailable) { - ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}"); - player!.PrintToChat($" {ChatColors.Green}Ready/Unready: {ChatColors.Default}.ready, .unready"); - return; + + return player!.PrintToChat($"{ChatColors.Green}Ready/Unready: {ChatColors.Default}.ready, .unready"); } if (isSideSelectionPhase) { - ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}"); - player!.PrintToChat($" {ChatColors.Green}Side Selection: {ChatColors.Default}.stay, .switch"); - return; + return player!.PrintToChat($"{ChatColors.Green}Side Selection: {ChatColors.Default}.stay, .switch"); } if (matchStarted) { string stopCommandMessage = isStopCommandAvailable ? ", .stop" : ""; - ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}"); - player!.PrintToChat($" {ChatColors.Green}Pause/Restore: {ChatColors.Default}.pause, .unpause, .tac, .tech{stopCommandMessage}"); - return; + return player!.PrintToChat($"{ChatColors.Green}Pause/Restore: {ChatColors.Default}.pause, .unpause, .tac, .tech{stopCommandMessage}"); } } From bcaf7dcf215fe3bc1cb42f66f4a4b2c778adf0b0 Mon Sep 17 00:00:00 2001 From: sniperpl Date: Wed, 28 Aug 2024 01:50:11 +0200 Subject: [PATCH 3/4] . --- Utility.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Utility.cs b/Utility.cs index f04870c..48daace 100644 --- a/Utility.cs +++ b/Utility.cs @@ -1371,17 +1371,19 @@ private void SendAvailableCommandsMessage(CCSPlayerController? player) } if (readyAvailable) { - - return player!.PrintToChat($"{ChatColors.Green}Ready/Unready: {ChatColors.Default}.ready, .unready"); + player!.PrintToChat($"{ChatColors.Green}Ready/Unready: {ChatColors.Default}.ready, .unready"); + return; } if (isSideSelectionPhase) { - return player!.PrintToChat($"{ChatColors.Green}Side Selection: {ChatColors.Default}.stay, .switch"); + player!.PrintToChat($"{ChatColors.Green}Side Selection: {ChatColors.Default}.stay, .switch"); + return; } if (matchStarted) { string stopCommandMessage = isStopCommandAvailable ? ", .stop" : ""; - return player!.PrintToChat($"{ChatColors.Green}Pause/Restore: {ChatColors.Default}.pause, .unpause, .tac, .tech{stopCommandMessage}"); + player!.PrintToChat($"{ChatColors.Green}Pause/Restore: {ChatColors.Default}.pause, .unpause, .tac, .tech{stopCommandMessage}"); + return; } } From 97496be51741d0250c1d90d00a3d5d3ff4888515 Mon Sep 17 00:00:00 2001 From: sniperpl Date: Wed, 28 Aug 2024 01:55:47 +0200 Subject: [PATCH 4/4] idk why i changed this xd --- Utility.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Utility.cs b/Utility.cs index 48daace..faa3eb8 100644 --- a/Utility.cs +++ b/Utility.cs @@ -1361,28 +1361,28 @@ private void SendAvailableCommandsMessage(CCSPlayerController? player) if (isPractice) { - player!.PrintToChat($"{ChatColors.Green}Spawns: {ChatColors.Default}.spawn, .ctspawn, .tspawn, .bestspawn, .worstspawn"); - player.PrintToChat($"{ChatColors.Green}Bots: {ChatColors.Default}.bot, .nobots, .crouchbot, .boost, .crouchboost"); - player.PrintToChat($"{ChatColors.Green}Nades: {ChatColors.Default}.loadnade, .savenade, .importnade, .listnades"); - player.PrintToChat($"{ChatColors.Green}Nade Throw: {ChatColors.Default}.rethrow, .throwindex , .lastindex, .delay "); - player.PrintToChat($"{ChatColors.Green}Utility & Toggles: {ChatColors.Default}.clear, .fastforward, .last, .back, .solid, .impacts, .traj"); - player.PrintToChat($"{ChatColors.Green}Sides & Others: {ChatColors.Default}.ct, .t, .spec, .fas, .god, .dryrun, .break, .exitprac"); + player!.PrintToChat($" {ChatColors.Green}Spawns: {ChatColors.Default}.spawn, .ctspawn, .tspawn, .bestspawn, .worstspawn"); + player.PrintToChat($" {ChatColors.Green}Bots: {ChatColors.Default}.bot, .nobots, .crouchbot, .boost, .crouchboost"); + player.PrintToChat($" {ChatColors.Green}Nades: {ChatColors.Default}.loadnade, .savenade, .importnade, .listnades"); + player.PrintToChat($" {ChatColors.Green}Nade Throw: {ChatColors.Default}.rethrow, .throwindex , .lastindex, .delay "); + player.PrintToChat($" {ChatColors.Green}Utility & Toggles: {ChatColors.Default}.clear, .fastforward, .last, .back, .solid, .impacts, .traj"); + player.PrintToChat($" {ChatColors.Green}Sides & Others: {ChatColors.Default}.ct, .t, .spec, .fas, .god, .dryrun, .break, .exitprac"); return; } if (readyAvailable) { - player!.PrintToChat($"{ChatColors.Green}Ready/Unready: {ChatColors.Default}.ready, .unready"); + player!.PrintToChat($" {ChatColors.Green}Ready/Unready: {ChatColors.Default}.ready, .unready"); return; } if (isSideSelectionPhase) { - player!.PrintToChat($"{ChatColors.Green}Side Selection: {ChatColors.Default}.stay, .switch"); + player!.PrintToChat($" {ChatColors.Green}Side Selection: {ChatColors.Default}.stay, .switch"); return; } if (matchStarted) { string stopCommandMessage = isStopCommandAvailable ? ", .stop" : ""; - player!.PrintToChat($"{ChatColors.Green}Pause/Restore: {ChatColors.Default}.pause, .unpause, .tac, .tech{stopCommandMessage}"); + player!.PrintToChat($" {ChatColors.Green}Pause/Restore: {ChatColors.Default}.pause, .unpause, .tac, .tech{stopCommandMessage}"); return; } }