Skip to content

Commit 9e663f0

Browse files
Merge branch 'dev' of https://github.com/shobhit-pathak/MatchZy into dev
2 parents 1533b68 + 43245fe commit 9e663f0

File tree

5 files changed

+28
-26
lines changed

5 files changed

+28
-26
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
obj/*
2-
bin/*
2+
bin/*
3+
/.vs

ConsoleCommands.cs

+1
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ public void OnEndMatchCommand(CCSPlayerController? player, CommandInfo? command)
441441
}
442442

443443
[ConsoleCommand("css_restart", "Restarts the match")]
444+
[ConsoleCommand("css_rr", "Restarts the match")]
444445
public void OnRestartMatchCommand(CCSPlayerController? player, CommandInfo? command)
445446
{
446447
if (IsPlayerAdmin(player, "css_restart", "@css/config"))

MapVeto.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public void HandeMapBanCommand(CCSPlayerController player, string map)
199199
if (player.UserId != vetoCaptains[currentTeamToBan]) return;
200200

201201
if (!BanMap(map, playerTeam)) {
202-
player.PrintToChat($"{chatPrefix} {map} is not a valid map.");
202+
PrintToPlayerChat(player, $"{map} is not a valid map.");
203203
} else {
204204
HandleVetoStep();
205205
}
@@ -229,7 +229,7 @@ public void HandeMapPickCommand(CCSPlayerController player, string map)
229229
if (player.UserId != vetoCaptains[currentTeamToPick]) return;
230230

231231
if (!PickMap(map, playerTeam)) {
232-
player.PrintToChat($"{chatPrefix} {map} is not a valid map.");
232+
PrintToPlayerChat(player, $"{map} is not a valid map.");
233233
} else {
234234
HandleVetoStep();
235235
}

MatchZy.cs

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public override void Load(bool hotReload) {
135135
{ ".skipveto", OnSkipVetoCommand },
136136
{ ".sv", OnSkipVetoCommand },
137137
{ ".restart", OnRestartMatchCommand },
138+
{ ".rr", OnRestartMatchCommand },
138139
{ ".endmatch", OnEndMatchCommand },
139140
{ ".forceend", OnEndMatchCommand },
140141
{ ".reloadmap", OnMapReloadCommand },

Utility.cs

+22-23
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@ private void PrintToPlayerChat(CCSPlayerController player, string message)
3232
player.PrintToChat($"{chatPrefix} {message}");
3333
}
3434

35+
private void ReplyToUserCommand(CCSPlayerController? player, string message, bool console = false)
36+
{
37+
if (player == null)
38+
{
39+
Server.PrintToConsole($"{chatPrefix} {message}");
40+
}
41+
else
42+
{
43+
if (console)
44+
{
45+
player.PrintToConsole($"{chatPrefix} {message}");
46+
}
47+
else
48+
{
49+
player.PrintToChat($"{chatPrefix} {message}");
50+
}
51+
}
52+
}
53+
3554
private void LoadAdmins()
3655
{
3756
string fileName = "MatchZy/admins.json";
@@ -1125,25 +1144,6 @@ public bool IsTeamSwapRequired()
11251144
return false;
11261145
}
11271146

1128-
private void ReplyToUserCommand(CCSPlayerController? player, string message, bool console = false)
1129-
{
1130-
if (player == null)
1131-
{
1132-
Server.PrintToConsole($"[MatchZy] {message}");
1133-
}
1134-
else
1135-
{
1136-
if (console)
1137-
{
1138-
player.PrintToConsole($"[MatchZy] {message}");
1139-
}
1140-
else
1141-
{
1142-
player.PrintToChat($"{chatPrefix} {message}");
1143-
}
1144-
}
1145-
}
1146-
11471147
private void PauseMatch(CCSPlayerController? player, CommandInfo? command)
11481148
{
11491149
if (isMatchLive && isPaused)
@@ -1357,9 +1357,11 @@ private string GetColorTreatedString(string message)
13571357
private void SendAvailableCommandsMessage(CCSPlayerController? player)
13581358
{
13591359
if (!IsPlayerValid(player)) return;
1360+
1361+
ReplyToUserCommand(player, "Available commands:");
1362+
13601363
if (isPractice)
13611364
{
1362-
ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}");
13631365
player!.PrintToChat($" {ChatColors.Green}Spawns: {ChatColors.Default}.spawn, .ctspawn, .tspawn, .bestspawn, .worstspawn");
13641366
player.PrintToChat($" {ChatColors.Green}Bots: {ChatColors.Default}.bot, .nobots, .crouchbot, .boost, .crouchboost");
13651367
player.PrintToChat($" {ChatColors.Green}Nades: {ChatColors.Default}.loadnade, .savenade, .importnade, .listnades");
@@ -1370,20 +1372,17 @@ private void SendAvailableCommandsMessage(CCSPlayerController? player)
13701372
}
13711373
if (readyAvailable)
13721374
{
1373-
ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}");
13741375
player!.PrintToChat($" {ChatColors.Green}Ready/Unready: {ChatColors.Default}.ready, .unready");
13751376
return;
13761377
}
13771378
if (isSideSelectionPhase)
13781379
{
1379-
ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}");
13801380
player!.PrintToChat($" {ChatColors.Green}Side Selection: {ChatColors.Default}.stay, .switch");
13811381
return;
13821382
}
13831383
if (matchStarted)
13841384
{
13851385
string stopCommandMessage = isStopCommandAvailable ? ", .stop" : "";
1386-
ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}");
13871386
player!.PrintToChat($" {ChatColors.Green}Pause/Restore: {ChatColors.Default}.pause, .unpause, .tac, .tech{stopCommandMessage}");
13881387
return;
13891388
}

0 commit comments

Comments
 (0)