Skip to content

Commit

Permalink
chatprefix, .rr
Browse files Browse the repository at this point in the history
  • Loading branch information
sniperpl committed Aug 27, 2024
1 parent 3d1ddc1 commit 1184d38
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
obj/*
bin/*
bin/*
/.vs
1 change: 1 addition & 0 deletions ConsoleCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
1 change: 1 addition & 0 deletions MatchZy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public override void Load(bool hotReload) {
{ ".skipveto", OnSkipVetoCommand },
{ ".sv", OnSkipVetoCommand },
{ ".restart", OnRestartMatchCommand },
{ ".rr", OnRestartMatchCommand },
{ ".endmatch", OnEndMatchCommand },
{ ".forceend", OnEndMatchCommand },
{ ".reloadmap", OnMapReloadCommand },
Expand Down
38 changes: 19 additions & 19 deletions Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1184d38

Please sign in to comment.