Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update basecommands.cs #79

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions Commands/basecommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -642,25 +642,40 @@ public void OnRconCommand(CCSPlayerController? caller, CommandInfo command)
Logger.LogInformation($"{callerName} executed command ({command.ArgString}).");
}

[ConsoleCommand("css_rr")]
[ConsoleCommand("css_rg")]
[ConsoleCommand("css_restart")]
[ConsoleCommand("css_restartgame")]
[RequiresPermissions("@css/generic")]
[CommandHelper(minArgs: 0, usage: "", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnRestartCommand(CCSPlayerController? caller, CommandInfo command)
public void OnRestartGameCommand(CCSPlayerController? caller, CommandInfo command)
{
RestartGame(caller);
}

public static void RestartGame(CCSPlayerController? admin)
{
Helper.LogCommand(admin, "css_restartgame");

// TODO: Localize
var name = admin == null ? "Console" : admin.PlayerName;
Server.PrintToChatAll($"[SA] {name}: Restarting game...");
Server.ExecuteCommand("mp_restartgame 2");
Server.ExecuteCommand("mp_restartgame 1");
}

[ConsoleCommand("css_rr")]
[ConsoleCommand("css_restartround")]
[RequiresPermissions("@css/generic")]
[CommandHelper(minArgs: 0, usage: "", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnRestartRoundCommand(CCSPlayerController? caller, CommandInfo command)
{
RestartRound(caller);
}
public static void RestartRound(CCSPlayerController? admin)
{
Helper.LogCommand(admin, "css_restartround");

// TODO: Localize
var name = admin == null ? "Console" : admin.PlayerName;
Server.PrintToChatAll($"[SA] {name}: Restarting round...");
Server.ExecuteCommand("sv_cheats 1; endround; sv_cheats 0"); // Lazy solution but works
}
}
}
Loading