Skip to content

Commit 43245fe

Browse files
Merge pull request #220 from sniperpl/dev
chatprefix, .rr
2 parents 3d1ddc1 + 97496be commit 43245fe

File tree

5 files changed

+28
-26
lines changed

5 files changed

+28
-26
lines changed

Diff for: .gitignore

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

Diff for: 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"))

Diff for: 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
}

Diff for: 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 },

Diff for: 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)
@@ -1356,9 +1356,11 @@ private string GetColorTreatedString(string message)
13561356
private void SendAvailableCommandsMessage(CCSPlayerController? player)
13571357
{
13581358
if (!IsPlayerValid(player)) return;
1359+
1360+
ReplyToUserCommand(player, "Available commands:");
1361+
13591362
if (isPractice)
13601363
{
1361-
ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}");
13621364
player!.PrintToChat($" {ChatColors.Green}Spawns: {ChatColors.Default}.spawn, .ctspawn, .tspawn, .bestspawn, .worstspawn");
13631365
player.PrintToChat($" {ChatColors.Green}Bots: {ChatColors.Default}.bot, .nobots, .crouchbot, .boost, .crouchboost");
13641366
player.PrintToChat($" {ChatColors.Green}Nades: {ChatColors.Default}.loadnade, .savenade, .importnade, .listnades");
@@ -1369,20 +1371,17 @@ private void SendAvailableCommandsMessage(CCSPlayerController? player)
13691371
}
13701372
if (readyAvailable)
13711373
{
1372-
ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}");
13731374
player!.PrintToChat($" {ChatColors.Green}Ready/Unready: {ChatColors.Default}.ready, .unready");
13741375
return;
13751376
}
13761377
if (isSideSelectionPhase)
13771378
{
1378-
ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}");
13791379
player!.PrintToChat($" {ChatColors.Green}Side Selection: {ChatColors.Default}.stay, .switch");
13801380
return;
13811381
}
13821382
if (matchStarted)
13831383
{
13841384
string stopCommandMessage = isStopCommandAvailable ? ", .stop" : "";
1385-
ReplyToUserCommand(player, $"{ChatColors.Green}Available commands: {ChatColors.Default}");
13861385
player!.PrintToChat($" {ChatColors.Green}Pause/Restore: {ChatColors.Default}.pause, .unpause, .tac, .tech{stopCommandMessage}");
13871386
return;
13881387
}

0 commit comments

Comments
 (0)