Update basecommands.cs

Separation of "RG" and "RR".
> Requires review.
This commit is contained in:
criskkky 2024-03-12 16:27:09 -03:00
parent cce265c6b7
commit f3b203ea10

View file

@ -637,17 +637,14 @@ namespace CS2_SimpleAdmin
Logger.LogInformation($"{callerName} executed command ({command.ArgString})."); Logger.LogInformation($"{callerName} executed command ({command.ArgString}).");
} }
[ConsoleCommand("css_rr")]
[ConsoleCommand("css_rg")] [ConsoleCommand("css_rg")]
[ConsoleCommand("css_restart")]
[ConsoleCommand("css_restartgame")] [ConsoleCommand("css_restartgame")]
[RequiresPermissions("@css/generic")] [RequiresPermissions("@css/generic")]
[CommandHelper(minArgs: 0, usage: "", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)] [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); RestartGame(caller);
} }
public static void RestartGame(CCSPlayerController? admin) public static void RestartGame(CCSPlayerController? admin)
{ {
Helper.LogCommand(admin, "css_restartgame"); Helper.LogCommand(admin, "css_restartgame");
@ -655,7 +652,25 @@ namespace CS2_SimpleAdmin
// TODO: Localize // TODO: Localize
var name = admin == null ? "Console" : admin.PlayerName; var name = admin == null ? "Console" : admin.PlayerName;
Server.PrintToChatAll($"[SA] {name}: Restarting game..."); 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
} }
} }
} }