mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-18 10:43:23 +00:00
Admin immunity + Discord
- Fixed command logging + small refactor - Fixed admin immunity - Separated penalty webhook - More customizable penalty webhook
This commit is contained in:
@@ -52,7 +52,6 @@ namespace CS2_SimpleAdmin
|
||||
if (_database == null || player is null || !player.IsValid) return;
|
||||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
|
||||
if (CheckValidBan(caller, time) == false)
|
||||
return;
|
||||
|
||||
@@ -139,11 +138,10 @@ namespace CS2_SimpleAdmin
|
||||
Server.ExecuteCommand($"banid 2 {new SteamID(player.SteamID).SteamId3}");
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, DiscordWebhookClientPenalty, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, $"css_ban {(string.IsNullOrEmpty(player.PlayerName) ? player.SteamID.ToString() : player.PlayerName)} {time} {reason}");
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _localizer);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addban")]
|
||||
@@ -244,7 +242,7 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, DiscordWebhookClientPenalty, _localizer);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _localizer);
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
@@ -254,7 +252,6 @@ namespace CS2_SimpleAdmin
|
||||
});
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
//Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer);
|
||||
if (UnlockedCommands)
|
||||
Server.ExecuteCommand($"banid 2 {steamId.SteamId3}");
|
||||
@@ -282,8 +279,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
var reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
var adminInfo = new PlayerInfo
|
||||
@@ -365,7 +360,8 @@ namespace CS2_SimpleAdmin
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
}
|
||||
}
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, DiscordWebhookClientPenalty, _localizer);
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _localizer);
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
@@ -375,7 +371,6 @@ namespace CS2_SimpleAdmin
|
||||
});
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
command.ReplyToCommand($"Banned player with IP address {ipAddress}.");
|
||||
}
|
||||
@@ -422,7 +417,6 @@ namespace CS2_SimpleAdmin
|
||||
BanManager banManager = new(_database, Config);
|
||||
Task.Run(async () => await banManager.UnbanPlayer(pattern, callerSteamId, reason));
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
command.ReplyToCommand($"Unbanned player with pattern {pattern}.");
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
||||
@@ -45,7 +44,6 @@ namespace CS2_SimpleAdmin
|
||||
var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
||||
var utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
foreach (var player in Helper.GetValidPlayers())
|
||||
@@ -92,7 +90,6 @@ namespace CS2_SimpleAdmin
|
||||
var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
||||
var utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
Helper.PrintToCenterAll(utf8String.ReplaceColorTags());
|
||||
@@ -106,7 +103,6 @@ namespace CS2_SimpleAdmin
|
||||
var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
||||
var utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
VirtualFunctions.ClientPrintAll(
|
||||
|
||||
@@ -135,8 +135,6 @@ namespace CS2_SimpleAdmin
|
||||
var flagsList = flags.Split(',').Select(flag => flag.Trim()).ToList();
|
||||
_ = adminManager.AddAdminBySteamId(steamid, name, flagsList, immunity, time, globalAdmin);
|
||||
|
||||
if (command != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_addadmin {steamid} {name} {flags} {immunity} {time}");
|
||||
|
||||
var msg = $"Added '{flags}' flags to '{name}' ({steamid})";
|
||||
@@ -185,8 +183,6 @@ namespace CS2_SimpleAdmin
|
||||
AdminManager.RemovePlayerAdminData(steamId);
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
|
||||
if (command != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_deladmin {steamid}");
|
||||
|
||||
var msg = $"Removed flags from '{steamid}'";
|
||||
@@ -233,8 +229,6 @@ namespace CS2_SimpleAdmin
|
||||
var flagsList = flags.Split(',').Select(flag => flag.Trim()).ToList();
|
||||
_ = adminManager.AddGroup(name, flagsList, immunity, globalGroup);
|
||||
|
||||
if (command != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_addgroup {name} {flags} {immunity}");
|
||||
|
||||
var msg = $"Created group '{name}' with flags '{flags}'";
|
||||
@@ -275,8 +269,6 @@ namespace CS2_SimpleAdmin
|
||||
ReloadAdmins(caller);
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
|
||||
if (command != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_delgroup {name}");
|
||||
|
||||
var msg = $"Removed group '{name}'";
|
||||
@@ -348,7 +340,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
if (SilentPlayers.Contains(caller.Slot))
|
||||
if (!SilentPlayers.Add(caller.Slot))
|
||||
{
|
||||
SilentPlayers.Remove(caller.Slot);
|
||||
caller.PrintToChat($"You aren't hidden now!");
|
||||
@@ -356,7 +348,6 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
else
|
||||
{
|
||||
SilentPlayers.Add(caller.Slot);
|
||||
Server.ExecuteCommand("sv_disable_teamselect_menu 1");
|
||||
|
||||
if (caller.PlayerPawn.Value != null && caller.PawnIsAlive)
|
||||
@@ -547,24 +538,22 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.Pawn.Value!.Freeze();
|
||||
|
||||
if (command != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_kick {player?.PlayerName} {reason}");
|
||||
Helper.LogCommand(caller, $"css_kick {(string.IsNullOrEmpty(player.PlayerName) ? player.SteamID.ToString() : player.PlayerName)} {reason}");
|
||||
|
||||
if (string.IsNullOrEmpty(reason) == false)
|
||||
{
|
||||
if (player != null && !player.IsBot)
|
||||
if (!player.IsBot)
|
||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||
{
|
||||
player.PrintToCenter(_localizer!["sa_player_kick_message", reason, callerName]);
|
||||
}
|
||||
if (player != null && player.UserId.HasValue)
|
||||
if (player.UserId.HasValue)
|
||||
AddTimer(Config.KickTime, () => Helper.KickPlayer(player.UserId.Value, reason),
|
||||
CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player != null && player.UserId.HasValue)
|
||||
if (player.UserId.HasValue)
|
||||
AddTimer(Config.KickTime, () => Helper.KickPlayer(player.UserId.Value),
|
||||
CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
}
|
||||
@@ -638,9 +627,7 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
if (command == null) return;
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.LogCommand(caller, command?.GetCommandString ?? $"css_map {map}");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_changewsmap", "Change workshop map.")]
|
||||
@@ -677,9 +664,7 @@ namespace CS2_SimpleAdmin
|
||||
Server.ExecuteCommand(issuedCommand);
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
|
||||
if (command == null) return;
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.LogCommand(caller, command?.GetCommandString ?? $"css_wsmap {map}");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_cvar", "Change a cvar.")]
|
||||
@@ -702,7 +687,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
var value = command.GetArg(2);
|
||||
@@ -720,7 +704,6 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
Server.ExecuteCommand(command.ArgString);
|
||||
|
||||
@@ -124,10 +124,8 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
if (command == null) return;
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, DiscordWebhookClientPenalty, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.LogCommand(caller, $"css_gag {(string.IsNullOrEmpty(player.PlayerName) ? player.SteamID.ToString() : player.PlayerName)} {time} {reason}");
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _localizer);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addgag")]
|
||||
@@ -229,7 +227,7 @@ namespace CS2_SimpleAdmin
|
||||
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time);
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, DiscordWebhookClientPenalty, _localizer);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _localizer);
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
@@ -237,7 +235,6 @@ namespace CS2_SimpleAdmin
|
||||
await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time);
|
||||
});
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
command.ReplyToCommand($"Gagged player with steamid {steamid}.");
|
||||
@@ -260,13 +257,13 @@ namespace CS2_SimpleAdmin
|
||||
command.ReplyToCommand($"Too short pattern to search.");
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
|
||||
var found = false;
|
||||
|
||||
var pattern = command.GetArg(1);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
MuteManager muteManager = new(_database);
|
||||
|
||||
if (Helper.ValidateSteamId(pattern, out var steamId) && steamId != null)
|
||||
@@ -461,13 +458,9 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _localizer);
|
||||
Helper.LogCommand(caller, $"css_mute {(string.IsNullOrEmpty(player.PlayerName) ? player.SteamID.ToString() : player.PlayerName)} {time} {reason}");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addmute")]
|
||||
@@ -564,7 +557,7 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _localizer);
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
@@ -572,7 +565,6 @@ namespace CS2_SimpleAdmin
|
||||
await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 1);
|
||||
});
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
command.ReplyToCommand($"Muted player with steamid {steamid}.");
|
||||
@@ -596,7 +588,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
var pattern = command.GetArg(1);
|
||||
@@ -793,9 +784,8 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (command == null) return;
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Silence, _localizer);
|
||||
Helper.LogCommand(caller, $"css_silence {(string.IsNullOrEmpty(player.PlayerName) ? player.SteamID.ToString() : player.PlayerName)} {time} {reason}");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_addsilence")]
|
||||
@@ -893,7 +883,7 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Silence, _localizer);
|
||||
}
|
||||
}
|
||||
Task.Run(async () =>
|
||||
@@ -901,7 +891,6 @@ namespace CS2_SimpleAdmin
|
||||
await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 2);
|
||||
});
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
command.ReplyToCommand($"Silenced player with steamid {steamid}.");
|
||||
@@ -925,7 +914,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
var pattern = command.GetArg(1);
|
||||
|
||||
@@ -17,7 +17,6 @@ namespace CS2_SimpleAdmin
|
||||
if (command.ArgCount < 2)
|
||||
return;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
VoteAnswers.Clear();
|
||||
@@ -50,11 +49,10 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
Helper.PrintToCenterAll(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
||||
|
||||
if (_localizer != null)
|
||||
player.SendLocalizedMessage(_localizer,
|
||||
"sa_admin_vote_message",
|
||||
caller == null ? "Console" : caller.PlayerName,
|
||||
question);
|
||||
player.SendLocalizedMessage(_localizer,
|
||||
"sa_admin_vote_message",
|
||||
caller == null ? "Console" : caller.PlayerName,
|
||||
question);
|
||||
|
||||
voteMenu.Open(player);
|
||||
|
||||
|
||||
@@ -19,9 +19,7 @@ namespace CS2_SimpleAdmin
|
||||
var playersToTarget = targets.Players.Where(player =>
|
||||
player.IsValid &&
|
||||
player is { PawnIsAlive: true, IsHLTV: false, Connected: PlayerConnectedState.PlayerConnected }).ToList();
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
if (caller!.CanTarget(player))
|
||||
@@ -62,9 +60,7 @@ namespace CS2_SimpleAdmin
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
var playersToTarget = targets.Players.Where(player => player is { IsValid: true, PawnIsAlive: true, IsHLTV: false }).ToList();
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
if (caller!.CanTarget(player))
|
||||
@@ -123,11 +119,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player!.Pawn.Value!.Unfreeze();
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_unfreeze {player?.PlayerName}");
|
||||
|
||||
if (caller != null && SilentPlayers.Contains(caller.Slot)) return;
|
||||
foreach (var controller in Helper.GetValidPlayers().Where(controller => controller is { IsValid: true, IsBot: false }))
|
||||
|
||||
@@ -33,16 +33,11 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
player?.CommitSuicide(false, true);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_slay {player?.PlayerName}");
|
||||
|
||||
if (caller != null && SilentPlayers.Contains(caller.Slot)) return;
|
||||
foreach (var controller in Helper.GetValidPlayers().Where(controller => controller is { IsValid: true, IsBot: false }))
|
||||
@@ -114,11 +109,7 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
if (!caller.CanTarget(player)) return;
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_give {player.PlayerName} {weaponName}");
|
||||
|
||||
player.GiveNamedItem(weaponName);
|
||||
SubGiveWeapon(caller, player, weaponName, callerName);
|
||||
@@ -173,11 +164,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.RemoveWeapons();
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_strip {player.PlayerName}");
|
||||
|
||||
if (caller != null && SilentPlayers.Contains(caller.Slot)) return;
|
||||
foreach (var controller in Helper.GetValidPlayers().Where(controller => controller is { IsValid: true, IsBot: false }))
|
||||
@@ -222,11 +209,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.SetHp(health);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_hp {player.PlayerName} {health}");
|
||||
|
||||
if (caller != null && SilentPlayers.Contains(caller.Slot)) return;
|
||||
foreach (var controller in Helper.GetValidPlayers().Where(controller => controller is { IsValid: true, IsBot: false }))
|
||||
@@ -272,11 +255,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.SetSpeed((float)speed);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_speed {player?.PlayerName} {speed}");
|
||||
|
||||
if (caller != null && SilentPlayers.Contains(caller.Slot)) return;
|
||||
foreach (var controller in Helper.GetValidPlayers().Where(controller => controller is { IsValid: true, IsBot: false }))
|
||||
@@ -299,9 +278,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
var targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
|
||||
var playersToTarget = targets.Players.Where(player => player.IsValid && player is { PawnIsAlive: true, IsHLTV: false }).ToList();
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
@@ -324,11 +301,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.SetGravity((float)gravity);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_gravity {player?.PlayerName} {gravity}");
|
||||
|
||||
if (caller != null && SilentPlayers.Contains(caller.Slot)) return;
|
||||
foreach (var controller in Helper.GetValidPlayers().Where(controller => controller is { IsValid: true, IsBot: false }))
|
||||
@@ -374,11 +347,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.SetMoney(money);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_money {player?.PlayerName} {money}");
|
||||
|
||||
if (caller != null && SilentPlayers.Contains(caller.Slot)) return;
|
||||
foreach (var controller in Helper.GetValidPlayers().Where(controller => controller is { IsValid: true, IsBot: false }))
|
||||
@@ -421,17 +390,10 @@ namespace CS2_SimpleAdmin
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
if (player == null) return;
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
Helper.LogCommand(caller, $"css_god {player.PlayerName}");
|
||||
|
||||
if (!GodPlayers.Contains(player.Slot))
|
||||
{
|
||||
GodPlayers.Add(player.Slot);
|
||||
}
|
||||
else
|
||||
if (!GodPlayers.Add(player.Slot))
|
||||
{
|
||||
GodPlayers.Remove(player.Slot);
|
||||
}
|
||||
@@ -483,12 +445,7 @@ namespace CS2_SimpleAdmin
|
||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
player!.Pawn.Value!.Slap(damage);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
if (_localizer != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_slap {player?.PlayerName} {damage}");
|
||||
|
||||
if (_localizer == null)
|
||||
return;
|
||||
@@ -599,9 +556,7 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
if (command == null) return;
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_team {player?.PlayerName} {teamName}");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_rename", "Rename a player.")]
|
||||
@@ -620,7 +575,6 @@ namespace CS2_SimpleAdmin
|
||||
var playersToTarget = targets.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList();
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
@@ -658,7 +612,6 @@ namespace CS2_SimpleAdmin
|
||||
var playersToTarget = targets.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList();
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
@@ -728,11 +681,7 @@ namespace CS2_SimpleAdmin
|
||||
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
|
||||
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.LogCommand(caller, $"css_respawn {player?.PlayerName}");
|
||||
|
||||
if (caller != null && SilentPlayers.Contains(caller.Slot)) return;
|
||||
foreach (var controller in Helper.GetValidPlayers().Where(controller => controller is { IsValid: true, IsBot: false }))
|
||||
@@ -762,7 +711,6 @@ namespace CS2_SimpleAdmin
|
||||
var playersToTarget = targets.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList();
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
@@ -806,7 +754,6 @@ namespace CS2_SimpleAdmin
|
||||
var playersToTarget = targets.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList();
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user