1.6.1a
🆕 **What's new and what's changed:**
```diff
+ Added `css_hidecomms` command - Disable showing penalties when player connect
+ Added customizable commands in `Commands.json` file in plugin config directory
- U can disable command by removing aliases or rename/add more aliases (remember to not remove key, edit only Aliases)
+ Added missing `Console` translation `sa_console`
+ Added `LogCommand` to api
```
This commit is contained in:
parent
702a0315b8
commit
32520c7e84
19 changed files with 361 additions and 207 deletions
208
CS2-SimpleAdmin/Commands/RegisterCommands.cs
Normal file
208
CS2-SimpleAdmin/Commands/RegisterCommands.cs
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CS2_SimpleAdmin;
|
||||
|
||||
public static class RegisterCommands
|
||||
{
|
||||
private delegate void CommandCallback(CCSPlayerController? caller, CommandInfo.CommandCallback callback);
|
||||
|
||||
private static readonly string CommandsPath = Path.Combine(CS2_SimpleAdmin.ConfigDirectory, "Commands.json");
|
||||
private static readonly List<CommandMapping> CommandMappings =
|
||||
[
|
||||
new CommandMapping("css_ban", CS2_SimpleAdmin.Instance.OnBanCommand),
|
||||
new CommandMapping("css_addban", CS2_SimpleAdmin.Instance.OnAddBanCommand),
|
||||
new CommandMapping("css_banip", CS2_SimpleAdmin.Instance.OnBanIpCommand),
|
||||
new CommandMapping("css_unban", CS2_SimpleAdmin.Instance.OnUnbanCommand),
|
||||
new CommandMapping("css_warn", CS2_SimpleAdmin.Instance.OnWarnCommand),
|
||||
new CommandMapping("css_unwarn", CS2_SimpleAdmin.Instance.OnUnwarnCommand),
|
||||
|
||||
new CommandMapping("css_asay", CS2_SimpleAdmin.Instance.OnAdminToAdminSayCommand),
|
||||
new CommandMapping("css_cssay", CS2_SimpleAdmin.Instance.OnAdminCustomSayCommand),
|
||||
new CommandMapping("css_say", CS2_SimpleAdmin.Instance.OnAdminSayCommand),
|
||||
new CommandMapping("css_psay", CS2_SimpleAdmin.Instance.OnAdminPrivateSayCommand),
|
||||
new CommandMapping("css_csay", CS2_SimpleAdmin.Instance.OnAdminCenterSayCommand),
|
||||
new CommandMapping("css_hsay", CS2_SimpleAdmin.Instance.OnAdminHudSayCommand),
|
||||
|
||||
new CommandMapping("css_penalties", CS2_SimpleAdmin.Instance.OnPenaltiesCommand),
|
||||
new CommandMapping("css_admin", CS2_SimpleAdmin.Instance.OnAdminCommand),
|
||||
new CommandMapping("css_adminhelp", CS2_SimpleAdmin.Instance.OnAdminHelpCommand),
|
||||
new CommandMapping("css_addadmin", CS2_SimpleAdmin.Instance.OnAddAdminCommand),
|
||||
new CommandMapping("css_deladmin", CS2_SimpleAdmin.Instance.OnDelAdminCommand),
|
||||
new CommandMapping("css_addgroup", CS2_SimpleAdmin.Instance.OnAddGroup),
|
||||
new CommandMapping("css_delgroup", CS2_SimpleAdmin.Instance.OnDelGroupCommand),
|
||||
new CommandMapping("css_reloadadmins", CS2_SimpleAdmin.Instance.OnRelAdminCommand),
|
||||
new CommandMapping("css_hide", CS2_SimpleAdmin.Instance.OnHideCommand),
|
||||
new CommandMapping("css_hidecomms", CS2_SimpleAdmin.Instance.OnHideCommsCommand),
|
||||
new CommandMapping("css_who", CS2_SimpleAdmin.Instance.OnWhoCommand),
|
||||
new CommandMapping("css_disconnected", CS2_SimpleAdmin.Instance.OnDisconnectedCommand),
|
||||
new CommandMapping("css_warns", CS2_SimpleAdmin.Instance.OnWarnsCommand),
|
||||
new CommandMapping("css_players", CS2_SimpleAdmin.Instance.OnPlayersCommand),
|
||||
new CommandMapping("css_kick", CS2_SimpleAdmin.Instance.OnKickCommand),
|
||||
new CommandMapping("css_map", CS2_SimpleAdmin.Instance.OnMapCommand),
|
||||
new CommandMapping("css_wsmap", CS2_SimpleAdmin.Instance.OnWorkshopMapCommand),
|
||||
new CommandMapping("css_cvar", CS2_SimpleAdmin.Instance.OnCvarCommand),
|
||||
new CommandMapping("css_rcon", CS2_SimpleAdmin.Instance.OnRconCommand),
|
||||
new CommandMapping("css_rr", CS2_SimpleAdmin.Instance.OnRestartCommand),
|
||||
|
||||
new CommandMapping("css_gag", CS2_SimpleAdmin.Instance.OnGagCommand),
|
||||
new CommandMapping("css_addgag", CS2_SimpleAdmin.Instance.OnAddGagCommand),
|
||||
new CommandMapping("css_ungag", CS2_SimpleAdmin.Instance.OnUngagCommand),
|
||||
new CommandMapping("css_mute", CS2_SimpleAdmin.Instance.OnMuteCommand),
|
||||
new CommandMapping("css_addmute", CS2_SimpleAdmin.Instance.OnAddMuteCommand),
|
||||
new CommandMapping("css_unmute", CS2_SimpleAdmin.Instance.OnUnmuteCommand),
|
||||
new CommandMapping("css_silence", CS2_SimpleAdmin.Instance.OnSilenceCommand),
|
||||
new CommandMapping("css_addsilence", CS2_SimpleAdmin.Instance.OnAddSilenceCommand),
|
||||
new CommandMapping("css_unsilence", CS2_SimpleAdmin.Instance.OnUnsilenceCommand),
|
||||
|
||||
new CommandMapping("css_vote", CS2_SimpleAdmin.Instance.OnVoteCommand),
|
||||
|
||||
new CommandMapping("css_noclip", CS2_SimpleAdmin.Instance.OnNoclipCommand),
|
||||
new CommandMapping("css_freeze", CS2_SimpleAdmin.Instance.OnFreezeCommand),
|
||||
new CommandMapping("css_unfreeze", CS2_SimpleAdmin.Instance.OnUnfreezeCommand),
|
||||
new CommandMapping("css_godmode", CS2_SimpleAdmin.Instance.OnGodCommand),
|
||||
|
||||
new CommandMapping("css_slay", CS2_SimpleAdmin.Instance.OnSlayCommand),
|
||||
new CommandMapping("css_slap", CS2_SimpleAdmin.Instance.OnSlapCommand),
|
||||
new CommandMapping("css_give", CS2_SimpleAdmin.Instance.OnGiveCommand),
|
||||
new CommandMapping("css_strip", CS2_SimpleAdmin.Instance.OnStripCommand),
|
||||
new CommandMapping("css_hp", CS2_SimpleAdmin.Instance.OnHpCommand),
|
||||
new CommandMapping("css_speed", CS2_SimpleAdmin.Instance.OnSpeedCommand),
|
||||
new CommandMapping("css_gravity", CS2_SimpleAdmin.Instance.OnGravityCommand),
|
||||
new CommandMapping("css_money", CS2_SimpleAdmin.Instance.OnMoneyCommand),
|
||||
new CommandMapping("css_team", CS2_SimpleAdmin.Instance.OnTeamCommand),
|
||||
new CommandMapping("css_rename", CS2_SimpleAdmin.Instance.OnRenameCommand),
|
||||
new CommandMapping("css_prename", CS2_SimpleAdmin.Instance.OnPrenameCommand),
|
||||
new CommandMapping("css_respawn", CS2_SimpleAdmin.Instance.OnRespawnCommand),
|
||||
new CommandMapping("css_tp", CS2_SimpleAdmin.Instance.OnGotoCommand),
|
||||
new CommandMapping("css_bring", CS2_SimpleAdmin.Instance.OnBringCommand)
|
||||
];
|
||||
|
||||
public static void InitializeCommands()
|
||||
{
|
||||
if (!File.Exists(CommandsPath))
|
||||
{
|
||||
CreateConfig();
|
||||
InitializeCommands();
|
||||
}
|
||||
else
|
||||
{
|
||||
Register();
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateConfig()
|
||||
{
|
||||
var commands = new CommandsConfig
|
||||
{
|
||||
Commands = new Dictionary<string, Command>
|
||||
{
|
||||
{ "css_ban", new Command { Aliases = ["css_ban"] } },
|
||||
{ "css_addban", new Command { Aliases = ["css_addban"] } },
|
||||
{ "css_banip", new Command { Aliases = ["css_banip"] } },
|
||||
{ "css_unban", new Command { Aliases = ["css_unban"] } },
|
||||
{ "css_warn", new Command { Aliases = ["css_warn"] } },
|
||||
{ "css_unwarn", new Command { Aliases = ["css_unwarn"] } },
|
||||
{ "css_asay", new Command { Aliases = ["css_asay"] } },
|
||||
{ "css_cssay", new Command { Aliases = ["css_cssay"] } },
|
||||
{ "css_say", new Command { Aliases = ["css_say"] } },
|
||||
{ "css_psay", new Command { Aliases = ["css_psay"] } },
|
||||
{ "css_csay", new Command { Aliases = ["css_csay"] } },
|
||||
{ "css_hsay", new Command { Aliases = ["css_hsay"] } },
|
||||
{ "css_penalties", new Command { Aliases = ["css_penalties", "css_mypenalties", "css_comms"] } },
|
||||
{ "css_admin", new Command { Aliases = ["css_admin"] } },
|
||||
{ "css_adminhelp", new Command { Aliases = ["css_adminhelp"] } },
|
||||
{ "css_addadmin", new Command { Aliases = ["css_addadmin"] } },
|
||||
{ "css_deladmin", new Command { Aliases = ["css_deladmin"] } },
|
||||
{ "css_addgroup", new Command { Aliases = ["css_addgroup"] } },
|
||||
{ "css_delgroup", new Command { Aliases = ["css_delgroup"] } },
|
||||
{ "css_reloadadmins", new Command { Aliases = ["css_reloadadmins"] } },
|
||||
{ "css_hide", new Command { Aliases = ["css_hide", "css_stealth"] } },
|
||||
{ "css_hidecomms", new Command { Aliases = ["css_hidecomms"] } },
|
||||
{ "css_who", new Command { Aliases = ["css_who"] } },
|
||||
{ "css_disconnected", new Command { Aliases = ["css_disconnected", "css_last"] } },
|
||||
{ "css_warns", new Command { Aliases = ["css_warns"] } },
|
||||
{ "css_players", new Command { Aliases = ["css_players"] } },
|
||||
{ "css_kick", new Command { Aliases = ["css_kick"] } },
|
||||
{ "css_map", new Command { Aliases = ["css_map", "css_changemap"] } },
|
||||
{ "css_wsmap", new Command { Aliases = ["css_wsmap", "css_changewsmap", "css_workshop"] } },
|
||||
{ "css_cvar", new Command { Aliases = ["css_cvar"] } },
|
||||
{ "css_rcon", new Command { Aliases = ["css_rcon"] } },
|
||||
{ "css_rr", new Command { Aliases = ["css_rr", "css_rg", "css_restart", "css_restartgame"] } },
|
||||
{ "css_gag", new Command { Aliases = ["css_gag"] } },
|
||||
{ "css_addgag", new Command { Aliases = ["css_addgag"] } },
|
||||
{ "css_ungag", new Command { Aliases = ["css_ungag"] } },
|
||||
{ "css_mute", new Command { Aliases = ["css_mute"] } },
|
||||
{ "css_addmute", new Command { Aliases = ["css_addmute"] } },
|
||||
{ "css_unmute", new Command { Aliases = ["css_unmute"] } },
|
||||
{ "css_silence", new Command { Aliases = ["css_silence"] } },
|
||||
{ "css_addsilence", new Command { Aliases = ["css_addsilence"] } },
|
||||
{ "css_unsilence", new Command { Aliases = ["css_unsilence"] } },
|
||||
{ "css_vote", new Command { Aliases = ["css_vote"] } },
|
||||
{ "css_noclip", new Command { Aliases = ["css_noclip"] } },
|
||||
{ "css_freeze", new Command { Aliases = ["css_freeze"] } },
|
||||
{ "css_unfreeze", new Command { Aliases = ["css_unfreeze"] } },
|
||||
{ "css_godmode", new Command { Aliases = ["css_godmode"] } },
|
||||
{ "css_slay", new Command { Aliases = ["css_slay"] } },
|
||||
{ "css_slap", new Command { Aliases = ["css_slap"] } },
|
||||
{ "css_give", new Command { Aliases = ["css_give"] } },
|
||||
{ "css_strip", new Command { Aliases = ["css_strip"] } },
|
||||
{ "css_hp", new Command { Aliases = ["css_hp"] } },
|
||||
{ "css_speed", new Command { Aliases = ["css_speed"] } },
|
||||
{ "css_gravity", new Command { Aliases = ["css_gravity"] } },
|
||||
{ "css_money", new Command { Aliases = ["css_money"] } },
|
||||
{ "css_team", new Command { Aliases = ["css_team"] } },
|
||||
{ "css_rename", new Command { Aliases = ["css_rename"] } },
|
||||
{ "css_prename", new Command { Aliases = ["css_prename"] } },
|
||||
{ "css_respawn", new Command { Aliases = ["css_respawn"] } },
|
||||
{ "css_tp", new Command { Aliases = ["css_tp", "css_tpto", "css_goto"] } },
|
||||
{ "css_bring", new Command { Aliases = ["css_bring", "css_tphere"] } }
|
||||
}
|
||||
};
|
||||
|
||||
var json = JsonConvert.SerializeObject(commands, Formatting.Indented);
|
||||
File.WriteAllText(CommandsPath, json);
|
||||
}
|
||||
|
||||
private static void Register()
|
||||
{
|
||||
var json = File.ReadAllText(CommandsPath);
|
||||
var commandsConfig = JsonConvert.DeserializeObject<CommandsConfig>(json);
|
||||
|
||||
if (commandsConfig?.Commands == null) return;
|
||||
|
||||
foreach (var command in commandsConfig.Commands)
|
||||
{
|
||||
if (command.Value.Aliases == null) continue;
|
||||
|
||||
CS2_SimpleAdmin._logger?.LogInformation(
|
||||
$"Registering command: `{command.Key}` with aliases: `{string.Join(", ", command.Value.Aliases)}`");
|
||||
|
||||
var mapping = CommandMappings.FirstOrDefault(m => m.CommandKey == command.Key);
|
||||
if (mapping == null || command.Value.Aliases.Length == 0) continue;
|
||||
|
||||
foreach (var alias in command.Value.Aliases)
|
||||
{
|
||||
CS2_SimpleAdmin.Instance.AddCommand(alias, "", mapping.Callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CommandsConfig
|
||||
{
|
||||
public Dictionary<string, Command>? Commands { get; init; }
|
||||
}
|
||||
|
||||
private class Command
|
||||
{
|
||||
public string[]? Aliases { get; init; }
|
||||
}
|
||||
|
||||
private class CommandMapping(string commandKey, CommandInfo.CommandCallback callback)
|
||||
{
|
||||
public string CommandKey { get; } = commandKey;
|
||||
public CommandInfo.CommandCallback Callback { get; } = callback;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,12 +12,11 @@ namespace CS2_SimpleAdmin;
|
|||
|
||||
public partial class CS2_SimpleAdmin
|
||||
{
|
||||
[ConsoleCommand("css_ban")]
|
||||
[RequiresPermissions("@css/ban")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnBanCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
if (command.ArgCount < 2)
|
||||
return;
|
||||
|
||||
|
|
@ -56,7 +55,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!CheckValidBan(caller, time)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= "Console";
|
||||
callerName ??= _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Freeze player pawn if alive
|
||||
if (player.PawnIsAlive)
|
||||
|
|
@ -128,13 +127,12 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedEvent(playerInfo, adminInfo, PenaltyType.Ban, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addban")]
|
||||
[RequiresPermissions("@css/ban")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnAddBanCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
var callerName = caller?.PlayerName ?? "Console";
|
||||
var callerName = caller?.PlayerName ?? _localizer?["sa_console"] ?? "Console";
|
||||
if (command.ArgCount < 2 || string.IsNullOrEmpty(command.GetArg(1))) return;
|
||||
if (!Helper.ValidateSteamId(command.GetArg(1), out var steamId) || steamId == null)
|
||||
{
|
||||
|
|
@ -185,13 +183,12 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedAddedEvent(steamId, adminInfo, PenaltyType.Ban, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_banip")]
|
||||
[RequiresPermissions("@css/ban")]
|
||||
[CommandHelper(minArgs: 1, usage: "<ip> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnBanIpCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
var callerName = caller?.PlayerName ?? "Console";
|
||||
var callerName = caller?.PlayerName ?? _localizer?["sa_console"] ?? "Console";
|
||||
if (command.ArgCount < 2 || string.IsNullOrEmpty(command.GetArg(1))) return;
|
||||
var ipAddress = command.GetArg(1);
|
||||
|
||||
|
|
@ -255,14 +252,13 @@ public partial class CS2_SimpleAdmin
|
|||
return false;
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unban")]
|
||||
[RequiresPermissions("@css/unban")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid or name or ip> [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnUnbanCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? "Console";
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
if (command.GetArg(1).Length <= 1)
|
||||
{
|
||||
|
|
@ -281,14 +277,13 @@ public partial class CS2_SimpleAdmin
|
|||
command.ReplyToCommand($"Unbanned player with pattern {pattern}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_warn")]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnWarnCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null)
|
||||
return;
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
if (command.ArgCount < 2)
|
||||
return;
|
||||
|
||||
|
|
@ -326,7 +321,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!CheckValidBan(caller, time)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= "Console";
|
||||
callerName ??= _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Freeze player pawn if alive
|
||||
if (player.PawnIsAlive)
|
||||
|
|
@ -395,14 +390,13 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedEvent(playerInfo, adminInfo, PenaltyType.Warn, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unwarn")]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid or name or ip>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnUnwarnCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? "Console";
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
if (command.GetArg(1).Length <= 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ namespace CS2_SimpleAdmin;
|
|||
|
||||
public partial class CS2_SimpleAdmin
|
||||
{
|
||||
[ConsoleCommand("css_asay", "Say to all admins.")]
|
||||
[CommandHelper(1, "<message>")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
public void OnAdminToAdminSayCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -26,12 +25,11 @@ public partial class CS2_SimpleAdmin
|
|||
{
|
||||
if (_localizer != null)
|
||||
player.PrintToChat(_localizer["sa_adminchat_template_admin",
|
||||
caller == null ? "Console" : caller.PlayerName,
|
||||
caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName,
|
||||
utf8String]);
|
||||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_cssay", "Say custom text to all players - u can use color tags.")]
|
||||
[CommandHelper(1, "<message>")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
public void OnAdminCustomSayCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -49,7 +47,6 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_say", "Say to all players.")]
|
||||
[CommandHelper(1, "<message>")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
public void OnAdminSayCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -69,12 +66,11 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_psay", "Private message a player.")]
|
||||
[CommandHelper(2, "<#userid or name> <message>")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
public void OnAdminPrivateSayCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
|
@ -96,7 +92,6 @@ public partial class CS2_SimpleAdmin
|
|||
command.ReplyToCommand($" Private message sent!");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_csay", "Say to all players (in center).")]
|
||||
[CommandHelper(1, "<message>")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
public void OnAdminCenterSayCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -109,7 +104,6 @@ public partial class CS2_SimpleAdmin
|
|||
Helper.PrintToCenterAll(utf8String.ReplaceColorTags());
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_hsay", "Say to all players (in hud).")]
|
||||
[CommandHelper(1, "<message>")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
public void OnAdminHudSayCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@ namespace CS2_SimpleAdmin;
|
|||
|
||||
public partial class CS2_SimpleAdmin
|
||||
{
|
||||
[ConsoleCommand("css_penalties")]
|
||||
[ConsoleCommand("css_mypenalties")]
|
||||
[ConsoleCommand("css_comms")]
|
||||
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
public void OnPenaltiesCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
|
|
@ -128,7 +125,6 @@ public partial class CS2_SimpleAdmin
|
|||
});
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_admin")]
|
||||
[RequiresPermissions("@css/generic")]
|
||||
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -139,7 +135,6 @@ public partial class CS2_SimpleAdmin
|
|||
AdminMenu.OpenMenu(caller);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_adminhelp")]
|
||||
[RequiresPermissions("@css/generic")]
|
||||
public void OnAdminHelpCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
|
|
@ -151,7 +146,6 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addadmin")]
|
||||
[CommandHelper(minArgs: 4, usage: "<steamid> <name> <flags/groups> <immunity> <duration>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
[RequiresPermissions("@css/root")]
|
||||
public void OnAddAdminCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -207,7 +201,6 @@ public partial class CS2_SimpleAdmin
|
|||
Server.PrintToConsole(msg);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_deladmin")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
[RequiresPermissions("@css/root")]
|
||||
public void OnDelAdminCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -255,7 +248,6 @@ public partial class CS2_SimpleAdmin
|
|||
Server.PrintToConsole(msg);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addgroup")]
|
||||
[CommandHelper(minArgs: 3, usage: "<group_name> <flags> <immunity>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
[RequiresPermissions("@css/root")]
|
||||
public void OnAddGroup(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -301,7 +293,6 @@ public partial class CS2_SimpleAdmin
|
|||
Server.PrintToConsole(msg);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_delgroup")]
|
||||
[CommandHelper(minArgs: 1, usage: "<group_name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
[RequiresPermissions("@css/root")]
|
||||
public void OnDelGroupCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -341,7 +332,6 @@ public partial class CS2_SimpleAdmin
|
|||
Server.PrintToConsole(msg);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_reloadadmins")]
|
||||
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
[RequiresPermissions("@css/root")]
|
||||
public void OnRelAdminCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -391,8 +381,6 @@ public partial class CS2_SimpleAdmin
|
|||
//_ = _adminManager.GiveAllFlags();
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_stealth")]
|
||||
[ConsoleCommand("css_hide")]
|
||||
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
public void OnHideCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -421,7 +409,25 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_who")]
|
||||
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
public void OnHideCommsCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (caller == null)
|
||||
return;
|
||||
|
||||
if (!AdminDisabledJoinComms.Add(caller.SteamID))
|
||||
{
|
||||
AdminDisabledJoinComms.Remove(caller.SteamID);
|
||||
command.ReplyToCommand("From now on, you'll see penalty notifications");
|
||||
}
|
||||
else
|
||||
{
|
||||
AdminDisabledJoinComms.Add(caller.SteamID);
|
||||
command.ReplyToCommand($"You don't see penalty notifications now");
|
||||
}
|
||||
}
|
||||
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
[RequiresPermissions("@css/generic")]
|
||||
public void OnWhoCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -476,8 +482,6 @@ public partial class CS2_SimpleAdmin
|
|||
});
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_disconnected")]
|
||||
[ConsoleCommand("css_last")]
|
||||
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
public void OnDisconnectedCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -494,7 +498,7 @@ public partial class CS2_SimpleAdmin
|
|||
disconnectedMenuAction?.AddMenuOption(_localizer["sa_ban"], (_, _) =>
|
||||
{
|
||||
DurationMenu.OpenMenu(caller, _localizer["sa_ban"], player, (_, _, duration) =>
|
||||
ReasonMenu.OpenMenu(caller, PenaltyType.Ban, "Powód", player, (_, _, reason) =>
|
||||
ReasonMenu.OpenMenu(caller, PenaltyType.Ban, _localizer["sa_reason"], player, (_, _, reason) =>
|
||||
{
|
||||
caller.ExecuteClientCommandFromServer($"css_addban {player.SteamId.SteamId64} {duration} \"{reason}\"");
|
||||
}));
|
||||
|
|
@ -502,7 +506,7 @@ public partial class CS2_SimpleAdmin
|
|||
disconnectedMenuAction?.AddMenuOption(_localizer["sa_mute"], (_, _) =>
|
||||
{
|
||||
DurationMenu.OpenMenu(caller, _localizer["sa_mute"], player, (_, _, duration) =>
|
||||
ReasonMenu.OpenMenu(caller, PenaltyType.Mute, "Powód", player, (_, _, reason) =>
|
||||
ReasonMenu.OpenMenu(caller, PenaltyType.Mute, _localizer["sa_reason"], player, (_, _, reason) =>
|
||||
{
|
||||
caller.ExecuteClientCommandFromServer($"css_addmute {player.SteamId.SteamId64} {duration} \"{reason}\"");
|
||||
}));
|
||||
|
|
@ -510,7 +514,7 @@ public partial class CS2_SimpleAdmin
|
|||
disconnectedMenuAction?.AddMenuOption(_localizer["sa_gag"], (_, _) =>
|
||||
{
|
||||
DurationMenu.OpenMenu(caller, _localizer["sa_gag"], player, (_, _, duration) =>
|
||||
ReasonMenu.OpenMenu(caller, PenaltyType.Mute, "Powód", player, (_, _, reason) =>
|
||||
ReasonMenu.OpenMenu(caller, PenaltyType.Mute, _localizer["sa_reason"], player, (_, _, reason) =>
|
||||
{
|
||||
caller.ExecuteClientCommandFromServer($"css_addgag {player.SteamId.SteamId64} {duration} \"{reason}\"");
|
||||
}));
|
||||
|
|
@ -518,7 +522,7 @@ public partial class CS2_SimpleAdmin
|
|||
disconnectedMenuAction?.AddMenuOption(_localizer["sa_silence"], (_, _) =>
|
||||
{
|
||||
DurationMenu.OpenMenu(caller, _localizer["sa_silence"], player, (_, _, duration) =>
|
||||
ReasonMenu.OpenMenu(caller, PenaltyType.Mute, "Powód", player, (_, _, reason) =>
|
||||
ReasonMenu.OpenMenu(caller, PenaltyType.Mute, _localizer["sa_reason"], player, (_, _, reason) =>
|
||||
{
|
||||
caller.ExecuteClientCommandFromServer($"css_addsilence {player.SteamId.SteamId64} {duration} \"{reason}\"");
|
||||
}));
|
||||
|
|
@ -531,7 +535,6 @@ public partial class CS2_SimpleAdmin
|
|||
disconnectedMenu?.Open(caller);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_warns")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
public void OnWarnsCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -586,7 +589,6 @@ public partial class CS2_SimpleAdmin
|
|||
});
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_players")]
|
||||
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
[RequiresPermissions("@css/generic")]
|
||||
public void OnPlayersCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -654,12 +656,11 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_kick")]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnKickCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
var reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
var targets = GetTarget(command);
|
||||
|
|
@ -695,7 +696,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!player.UserId.HasValue) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller != null ? caller.PlayerName : "Console";
|
||||
callerName ??= caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
reason ??= _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
var playerInfo = PlayersInfo[player.UserId.Value];
|
||||
|
|
@ -743,8 +744,6 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedEvent(playerInfo, adminInfo, PenaltyType.Kick, reason);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_changemap")]
|
||||
[ConsoleCommand("css_map")]
|
||||
[RequiresPermissions("@css/changemap")]
|
||||
[CommandHelper(minArgs: 1, usage: "<mapname>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnMapCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -755,7 +754,7 @@ public partial class CS2_SimpleAdmin
|
|||
|
||||
public void ChangeMap(CCSPlayerController? caller, string map, CommandInfo? command = null)
|
||||
{
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
map = map.ToLower();
|
||||
|
||||
if (map.StartsWith("ws:"))
|
||||
|
|
@ -802,9 +801,6 @@ public partial class CS2_SimpleAdmin
|
|||
Helper.LogCommand(caller, command?.GetCommandString ?? $"css_map {map}");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_changewsmap", "Change workshop map.")]
|
||||
[ConsoleCommand("css_wsmap", "Change workshop map.")]
|
||||
[ConsoleCommand("css_workshop", "Change workshop map.")]
|
||||
[CommandHelper(1, "<name or id>")]
|
||||
[RequiresPermissions("@css/changemap")]
|
||||
public void OnWorkshopMapCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -816,7 +812,7 @@ public partial class CS2_SimpleAdmin
|
|||
public void ChangeWorkshopMap(CCSPlayerController? caller, string map, CommandInfo? command = null)
|
||||
{
|
||||
map = map.ToLower();
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Determine the workshop command
|
||||
var issuedCommand = long.TryParse(map, out var mapId)
|
||||
|
|
@ -842,13 +838,12 @@ public partial class CS2_SimpleAdmin
|
|||
Helper.LogCommand(caller, command?.GetCommandString ?? $"css_wsmap {map}");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_cvar", "Change a cvar.")]
|
||||
[CommandHelper(2, "<cvar> <value>")]
|
||||
[RequiresPermissions("@css/cvar")]
|
||||
public void OnCvarCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var cvar = ConVar.Find(command.GetArg(1));
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
if (cvar == null)
|
||||
{
|
||||
|
|
@ -872,12 +867,11 @@ public partial class CS2_SimpleAdmin
|
|||
Logger.LogInformation($"{callerName} changed cvar {cvar.Name} to {value}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_rcon", "Run a server console command.")]
|
||||
[CommandHelper(1, "<command>")]
|
||||
[RequiresPermissions("@css/rcon")]
|
||||
public void OnRconCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
|
|
@ -886,10 +880,6 @@ public partial class CS2_SimpleAdmin
|
|||
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)
|
||||
|
|
@ -902,7 +892,7 @@ public partial class CS2_SimpleAdmin
|
|||
Helper.LogCommand(admin, "css_restartgame");
|
||||
|
||||
// TODO: Localize
|
||||
var name = admin == null ? "Console" : admin.PlayerName;
|
||||
var name = admin == null ? _localizer?["sa_console"] ?? "Console" : admin.PlayerName;
|
||||
Server.PrintToChatAll($"[SA] {name}: Restarting game...");
|
||||
Server.ExecuteCommand("mp_restartgame 2");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ namespace CS2_SimpleAdmin;
|
|||
|
||||
public partial class CS2_SimpleAdmin
|
||||
{
|
||||
[ConsoleCommand("css_gag")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnGagCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
var reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
|
|
@ -51,7 +50,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
callerName ??= caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
muteManager ??= new MuteManager(Database);
|
||||
|
||||
// Get player and admin information
|
||||
|
|
@ -101,7 +100,6 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedEvent(playerInfo, adminInfo, PenaltyType.Gag, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addgag")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnAddGagCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -109,7 +107,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (Database == null) return;
|
||||
|
||||
// Set caller name
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
// Validate command arguments
|
||||
if (command.ArgCount < 2 || string.IsNullOrEmpty(command.GetArg(1))) return;
|
||||
|
|
@ -160,14 +158,13 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedAddedEvent(steamId, adminInfo, PenaltyType.Gag, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_ungag")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid or name> [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnUngagCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? "Console";
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? _localizer?["sa_console"] ?? "Console";
|
||||
var pattern = command.GetArg(1);
|
||||
var reason = command.GetArg(2);
|
||||
|
||||
|
|
@ -229,13 +226,12 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_mute")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnMuteCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
var reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
|
|
@ -270,7 +266,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
callerName ??= caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
muteManager ??= new MuteManager(Database);
|
||||
|
||||
// Get player and admin information
|
||||
|
|
@ -323,7 +319,6 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedEvent(playerInfo, adminInfo, PenaltyType.Mute, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addmute")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnAddMuteCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -331,7 +326,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (Database == null) return;
|
||||
|
||||
// Set caller name
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
// Validate command arguments
|
||||
if (command.ArgCount < 2 || string.IsNullOrEmpty(command.GetArg(1))) return;
|
||||
|
|
@ -382,14 +377,13 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedAddedEvent(steamId, adminInfo, PenaltyType.Mute, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unmute")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnUnmuteCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? "Console";
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? _localizer?["sa_console"] ?? "Console";
|
||||
var pattern = command.GetArg(1);
|
||||
var reason = command.GetArg(2);
|
||||
|
||||
|
|
@ -453,13 +447,12 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_silence")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnSilenceCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
var reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
|
|
@ -494,7 +487,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
callerName ??= caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
muteManager ??= new MuteManager(Database);
|
||||
|
||||
// Get player and admin information
|
||||
|
|
@ -544,7 +537,6 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedEvent(playerInfo, adminInfo, PenaltyType.Silence, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addsilence")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnAddSilenceCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -552,7 +544,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (Database == null) return;
|
||||
|
||||
// Set caller name
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
// Validate command arguments
|
||||
if (command.ArgCount < 2 || string.IsNullOrEmpty(command.GetArg(1))) return;
|
||||
|
|
@ -603,14 +595,13 @@ public partial class CS2_SimpleAdmin
|
|||
SimpleAdminApi?.OnPlayerPenaltiedAddedEvent(steamId, adminInfo, PenaltyType.Silence, reason, time);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unsilence")]
|
||||
[RequiresPermissions("@css/chat")]
|
||||
[CommandHelper(minArgs: 1, usage: "<steamid or name> [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnUnsilenceCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if (Database == null) return;
|
||||
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? "Console";
|
||||
var callerSteamId = caller?.SteamID.ToString() ?? _localizer?["sa_console"] ?? "Console";
|
||||
var pattern = command.GetArg(1);
|
||||
var reason = command.GetArg(2);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ namespace CS2_SimpleAdmin;
|
|||
|
||||
public partial class CS2_SimpleAdmin
|
||||
{
|
||||
[ConsoleCommand("css_vote")]
|
||||
[RequiresPermissions("@css/generic")]
|
||||
[CommandHelper(minArgs: 2, usage: "<question> [... options ...]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnVoteCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -47,11 +46,11 @@ public partial class CS2_SimpleAdmin
|
|||
|
||||
voteMenu.PostSelectAction = PostSelectAction.Close;
|
||||
|
||||
Helper.PrintToCenterAll(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
||||
Helper.PrintToCenterAll(_localizer["sa_admin_vote_message", caller == null ? _localizer["sa_console"] : caller.PlayerName, question]);
|
||||
|
||||
player.SendLocalizedMessage(_localizer,
|
||||
"sa_admin_vote_message",
|
||||
caller == null ? "Console" : caller.PlayerName,
|
||||
caller == null ? _localizer["sa_console"] : caller.PlayerName,
|
||||
question);
|
||||
|
||||
voteMenu.Open(player);
|
||||
|
|
|
|||
|
|
@ -7,12 +7,11 @@ namespace CS2_SimpleAdmin;
|
|||
|
||||
public partial class CS2_SimpleAdmin
|
||||
{
|
||||
[ConsoleCommand("css_noclip", "Noclip a player.")]
|
||||
[CommandHelper(1, "<#userid or name>")]
|
||||
[RequiresPermissions("@css/cheats")]
|
||||
public void OnNoclipCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
|
@ -35,7 +34,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller != null ? caller.PlayerName : "Console";
|
||||
callerName ??= caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Toggle no-clip mode for the player
|
||||
player.Pawn.Value?.ToggleNoclip();
|
||||
|
|
@ -62,12 +61,11 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_god")]
|
||||
[RequiresPermissions("@css/cheats")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnGodCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
||||
|
|
@ -90,7 +88,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Toggle god mode for the player
|
||||
if (!GodPlayers.Add(player.Slot))
|
||||
|
|
@ -116,12 +114,11 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_freeze", "Freeze a player.")]
|
||||
[CommandHelper(1, "<#userid or name> [duration]")]
|
||||
[RequiresPermissions("@css/slay")]
|
||||
public void OnFreezeCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
int.TryParse(command.GetArg(2), out var time);
|
||||
|
||||
var targets = GetTarget(command);
|
||||
|
|
@ -143,7 +140,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller != null ? caller.PlayerName : "Console";
|
||||
callerName ??= caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Freeze player pawn
|
||||
player.Pawn.Value?.Freeze();
|
||||
|
|
@ -172,12 +169,11 @@ public partial class CS2_SimpleAdmin
|
|||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unfreeze", "Unfreeze a player.")]
|
||||
[CommandHelper(1, "<#userid or name>")]
|
||||
[RequiresPermissions("@css/slay")]
|
||||
public void OnUnfreezeCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
|
@ -195,7 +191,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller != null ? caller.PlayerName : "Console";
|
||||
callerName ??= caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Unfreeze player pawn
|
||||
player.Pawn.Value?.Unfreeze();
|
||||
|
|
|
|||
|
|
@ -10,12 +10,11 @@ namespace CS2_SimpleAdmin;
|
|||
|
||||
public partial class CS2_SimpleAdmin
|
||||
{
|
||||
[ConsoleCommand("css_slay")]
|
||||
[RequiresPermissions("@css/slay")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnSlayCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
||||
|
|
@ -33,7 +32,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller != null ? caller.PlayerName : "Console";
|
||||
callerName ??= caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Make the player commit suicide
|
||||
player.CommitSuicide(false, true);
|
||||
|
|
@ -56,12 +55,11 @@ public partial class CS2_SimpleAdmin
|
|||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_give")]
|
||||
[RequiresPermissions("@css/cheats")]
|
||||
[CommandHelper(minArgs: 2, usage: "<#userid or name> <weapon>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnGiveCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
||||
|
|
@ -106,7 +104,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller != null ? caller.PlayerName : "Console";
|
||||
callerName ??= caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Give weapon to the player
|
||||
player.GiveNamedItem(weaponName);
|
||||
|
|
@ -134,7 +132,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller != null ? caller.PlayerName : "Console";
|
||||
callerName ??= caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Give weapon to the player
|
||||
player.GiveNamedItem(weapon);
|
||||
|
|
@ -157,12 +155,11 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_strip")]
|
||||
[RequiresPermissions("@css/slay")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnStripCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
||||
|
|
@ -182,7 +179,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller != null ? caller.PlayerName : "Console";
|
||||
callerName ??= caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Check if player is valid, alive, and connected
|
||||
if (!player.IsValid || !player.PawnIsAlive || player.Connected != PlayerConnectedState.PlayerConnected)
|
||||
|
|
@ -209,7 +206,6 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_hp")]
|
||||
[RequiresPermissions("@css/slay")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> <health>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnHpCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -236,7 +232,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Set player's health
|
||||
player.SetHp(health);
|
||||
|
|
@ -259,12 +255,11 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_speed")]
|
||||
[RequiresPermissions("@css/slay")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> <speed>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnSpeedCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
float.TryParse(command.GetArg(2), out var speed);
|
||||
|
||||
var targets = GetTarget(command);
|
||||
|
|
@ -289,7 +284,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Set player's speed
|
||||
player.SetSpeed(speed);
|
||||
|
|
@ -317,7 +312,7 @@ public partial class CS2_SimpleAdmin
|
|||
[CommandHelper(minArgs: 1, usage: "<#userid or name> <gravity>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnGravityCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
float.TryParse(command.GetArg(2), out var gravity);
|
||||
|
||||
var targets = GetTarget(command);
|
||||
|
|
@ -342,7 +337,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Set player's gravity
|
||||
player.SetGravity(gravity);
|
||||
|
|
@ -365,12 +360,11 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_money")]
|
||||
[RequiresPermissions("@css/slay")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> <money>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnMoneyCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
int.TryParse(command.GetArg(2), out var money);
|
||||
|
||||
var targets = GetTarget(command);
|
||||
|
|
@ -395,7 +389,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Set player's money
|
||||
player.SetMoney(money);
|
||||
|
|
@ -418,7 +412,6 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_slap")]
|
||||
[RequiresPermissions("@css/slay")]
|
||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> [damage]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnSlapCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -452,7 +445,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Apply slap damage to the player
|
||||
player.Pawn.Value?.Slap(damage);
|
||||
|
|
@ -477,14 +470,13 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_team")]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
[CommandHelper(minArgs: 2, usage: "<#userid or name> [<ct/tt/spec>] [-k]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnTeamCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
var teamName = command.GetArg(2).ToLower();
|
||||
var _teamName = "SPEC";
|
||||
string _teamName;
|
||||
var teamNum = CsTeam.Spectator;
|
||||
|
||||
var targets = GetTarget(command);
|
||||
|
|
@ -535,7 +527,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller != null ? caller.PlayerName : "Console";
|
||||
var callerName = caller != null ? caller.PlayerName : _localizer?["sa_console"] ?? "Console";
|
||||
|
||||
// Change team based on the provided teamName and conditions
|
||||
if (!teamName.Equals("swap", StringComparison.OrdinalIgnoreCase))
|
||||
|
|
@ -574,13 +566,12 @@ public partial class CS2_SimpleAdmin
|
|||
Helper.ShowAdminActivity(activityMessageKey, callerName, adminActivityArgs);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_rename", "Rename a player.")]
|
||||
[CommandHelper(1, "<#userid or name> <new name>")]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
public void OnRenameCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
// Get the new name from the command arguments
|
||||
var newName = command.GetArg(2);
|
||||
|
|
@ -620,13 +611,12 @@ public partial class CS2_SimpleAdmin
|
|||
});
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_prename", "Permanent rename a player.")]
|
||||
[CommandHelper(1, "<#userid or name> <new name>")]
|
||||
[RequiresPermissions("@css/ban")]
|
||||
public void OnPRenameCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
public void OnPrenameCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
// Set default caller name if not provided
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
// Get the new name from the command arguments
|
||||
var newName = command.GetArg(2);
|
||||
|
|
@ -670,12 +660,11 @@ public partial class CS2_SimpleAdmin
|
|||
});
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_respawn", "Respawn a dead player.")]
|
||||
[CommandHelper(1, "<#userid or name>")]
|
||||
[RequiresPermissions("@css/cheats")]
|
||||
public void OnRespawnCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
var callerName = caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
|
@ -699,7 +688,7 @@ public partial class CS2_SimpleAdmin
|
|||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
// Set default caller name if not provided
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
callerName ??= caller == null ? _localizer?["sa_console"] ?? "Console" : caller.PlayerName;
|
||||
|
||||
// Ensure the player's pawn is valid before attempting to respawn
|
||||
if (_cBasePlayerControllerSetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return;
|
||||
|
|
@ -728,9 +717,6 @@ public partial class CS2_SimpleAdmin
|
|||
Helper.ShowAdminActivity(activityMessageKey, callerName, adminActivityArgs);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_tp", "Teleport to a player.")]
|
||||
[ConsoleCommand("css_tpto", "Teleport to a player.")]
|
||||
[ConsoleCommand("css_goto", "Teleport to a player.")]
|
||||
[CommandHelper(1, "<#userid or name>")]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
public void OnGotoCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -764,7 +750,7 @@ public partial class CS2_SimpleAdmin
|
|||
|
||||
// Prepare message key and arguments for the teleport notification
|
||||
var activityMessageKey = "sa_admin_tp_message";
|
||||
var adminActivityArgs = new object[] { player.PlayerName };
|
||||
var adminActivityArgs = new object[] { "CALLER", player.PlayerName };
|
||||
|
||||
// Show admin activity
|
||||
if (!SilentPlayers.Contains(caller.Slot) && _localizer != null)
|
||||
|
|
@ -774,8 +760,6 @@ public partial class CS2_SimpleAdmin
|
|||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_bring", "Teleport a player to you.")]
|
||||
[ConsoleCommand("css_tphere", "Teleport a player to you.")]
|
||||
[CommandHelper(1, "<#userid or name>")]
|
||||
[RequiresPermissions("@css/kick")]
|
||||
public void OnBringCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
|
|
@ -809,7 +793,7 @@ public partial class CS2_SimpleAdmin
|
|||
|
||||
// Prepare message key and arguments for the bring notification
|
||||
var activityMessageKey = "sa_admin_bring_message";
|
||||
var adminActivityArgs = new object[] { player.PlayerName };
|
||||
var adminActivityArgs = new object[] { "CALLER", player.PlayerName };
|
||||
|
||||
// Show admin activity
|
||||
if (!SilentPlayers.Contains(caller.Slot) && _localizer != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue