diff --git a/CS2-SimpleAdmin.cs b/CS2-SimpleAdmin.cs index 2875f68..402517d 100644 --- a/CS2-SimpleAdmin.cs +++ b/CS2-SimpleAdmin.cs @@ -38,7 +38,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig "CS2-SimpleAdmin"; public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)"; public override string ModuleAuthor => "daffyy & Dliix66"; - public override string ModuleVersion => "1.3.7a"; + public override string ModuleVersion => "1.3.8a"; public CS2_SimpleAdminConfig Config { get; set; } = new(); diff --git a/Commands/basebans.cs b/Commands/basebans.cs index 094e711..c6dba6c 100644 --- a/Commands/basebans.cs +++ b/Commands/basebans.cs @@ -1,10 +1,9 @@ -using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands.Targeting; -using CounterStrikeSharp.API.Modules.Entities; using System.Text; namespace CS2_SimpleAdmin @@ -20,7 +19,7 @@ namespace CS2_SimpleAdmin if (command.ArgCount < 2) return; - string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; + string reason = _localizer?["sa_unknown"] ?? "Unknown"; TargetResult? targets = GetTarget(command); if (targets == null) return; @@ -31,8 +30,7 @@ namespace CS2_SimpleAdmin return; } - Database database = new Database(dbConnectionString); - + Database database = new(dbConnectionString); BanManager _banManager = new(database, Config); int.TryParse(command.GetArg(2), out int time); @@ -44,12 +42,12 @@ namespace CS2_SimpleAdmin { if (caller!.CanTarget(player)) { - Ban(caller, player, time, reason, callerName, _banManager); + Ban(caller, player, time, reason, callerName, _banManager, command); } }); } - internal void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, BanManager? banManager = null) + internal void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, BanManager? banManager = null, CommandInfo? command = null) { if (_database == null) return; @@ -74,10 +72,6 @@ namespace CS2_SimpleAdmin IpAddress = caller?.IpAddress?.Split(":")[0] }; - string commandName = $"css_ban {player.SteamID} {time} {reason}"; - Helper.LogCommand(caller, commandName); - Helper.TryLogCommandOnDiscord(caller, commandName); - Task.Run(async () => { banManager ??= new BanManager(_database, Config); @@ -133,6 +127,13 @@ namespace CS2_SimpleAdmin } } } + + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer); } [ConsoleCommand("css_addban")] @@ -154,16 +155,9 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - - string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; - - Database database = new Database(dbConnectionString); + string reason = _localizer?["sa_unknown"] ?? "Unknown"; + Database database = new(dbConnectionString); BanManager _banManager = new(database, Config); int.TryParse(command.GetArg(2), out int time); @@ -178,8 +172,6 @@ namespace CS2_SimpleAdmin IpAddress = caller?.IpAddress?.Split(":")[0] }; - Helper.LogCommand(caller, command); - List matches = Helper.GetPlayerFromSteamid64(steamid); if (matches.Count == 1) { @@ -238,6 +230,8 @@ namespace CS2_SimpleAdmin } } } + + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer); } Task.Run(async () => @@ -246,7 +240,14 @@ namespace CS2_SimpleAdmin await _banManager.AddBanBySteamid(steamid, adminInfo, reason, time); }); - command.ReplyToCommand($"Banned player with steamid {steamid}."); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } + //Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer); + + command?.ReplyToCommand($"Banned player with steamid {steamid}."); } [ConsoleCommand("css_banip")] @@ -269,13 +270,9 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); - string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; + string reason = _localizer?["sa_unknown"] ?? "Unknown"; PlayerInfo adminInfo = new PlayerInfo { @@ -284,8 +281,6 @@ namespace CS2_SimpleAdmin IpAddress = caller?.IpAddress?.Split(":")[0] }; - Helper.LogCommand(caller, command); - int.TryParse(command.GetArg(2), out int time); if (command.ArgCount >= 3 && command.GetArg(3).Length > 0) @@ -348,8 +343,14 @@ namespace CS2_SimpleAdmin } if (player.UserId.HasValue) - AddTimer(Config.KickTime, () => Helper.KickPlayer(player.UserId.Value, "Banned"), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); + { + AddTimer(Config.KickTime, () => + { + Helper.KickPlayer(player.UserId.Value, "Banned"); + }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); + } } + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer); } Task.Run(async () => @@ -358,7 +359,13 @@ namespace CS2_SimpleAdmin await _banManager.AddBanByIp(ipAddress, adminInfo, reason, time); }); - command.ReplyToCommand($"Banned player with IP address {ipAddress}."); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } + + command?.ReplyToCommand($"Banned player with IP address {ipAddress}."); } [ConsoleCommand("css_unban")] @@ -375,19 +382,14 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - - Helper.LogCommand(caller, command); - string pattern = command.GetArg(1); - BanManager _banManager = new BanManager(_database, Config); + BanManager _banManager = new(_database, Config); Task.Run(async () => await _banManager.UnbanPlayer(pattern)); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, command); + command.ReplyToCommand($"Unbanned player with pattern {pattern}."); } } diff --git a/Commands/basechat.cs b/Commands/basechat.cs index 6cee028..b347df9 100644 --- a/Commands/basechat.cs +++ b/Commands/basechat.cs @@ -4,7 +4,6 @@ using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands.Targeting; -using CounterStrikeSharp.API.Modules.Entities; using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Utils; using System.Text; @@ -21,12 +20,7 @@ namespace CS2_SimpleAdmin if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return; string callerName = caller == null ? "Console" : caller.PlayerName; - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); @@ -54,12 +48,7 @@ namespace CS2_SimpleAdmin byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); string utf8String = Encoding.UTF8.GetString(utf8BytesString); - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); foreach (CCSPlayerController _player in Helper.GetValidPlayers()) @@ -84,7 +73,7 @@ namespace CS2_SimpleAdmin if (targets == null) return; List playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList(); - Helper.LogCommand(caller, command); + //Helper.LogCommand(caller, command); int range = command.GetArg(0).Length + command.GetArg(1).Length + 2; string message = command.GetCommandString[range..]; @@ -109,12 +98,7 @@ namespace CS2_SimpleAdmin byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); string utf8String = Encoding.UTF8.GetString(utf8BytesString); - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); Helper.PrintToCenterAll(StringExtensions.ReplaceColorTags(utf8String)); @@ -129,12 +113,7 @@ namespace CS2_SimpleAdmin byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); string utf8String = Encoding.UTF8.GetString(utf8BytesString); - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); VirtualFunctions.ClientPrintAll( diff --git a/Commands/basecommands.cs b/Commands/basecommands.cs index d120a25..18a5c2c 100644 --- a/Commands/basecommands.cs +++ b/Commands/basecommands.cs @@ -1,4 +1,4 @@ -using CounterStrikeSharp.API; +using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Translations; @@ -131,7 +131,7 @@ namespace CS2_SimpleAdmin int time = 0; int.TryParse(command.GetArg(5), out time); - AddAdmin(caller, steamid, name, flags, immunity, time, globalAdmin); + AddAdmin(caller, steamid, name, flags, immunity, time, globalAdmin, command); } public void AddAdmin(CCSPlayerController? caller, string steamid, string name, string flags, int immunity, int time = 0, bool globalAdmin = false, CommandInfo? command = null) @@ -140,9 +140,9 @@ namespace CS2_SimpleAdmin AdminSQLManager _adminManager = new(_database); _ = _adminManager.AddAdminBySteamId(steamid, name, flags, immunity, time, globalAdmin); - string commandName = $"css_addadmin {steamid} {name} {flags} {immunity} {time}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, $"css_addadmin {steamid} {name} {flags} {immunity} {time}"); string msg = $"Added '{flags}' flags to '{name}' ({steamid})"; if (command != null) @@ -170,7 +170,7 @@ namespace CS2_SimpleAdmin string steamid = command.GetArg(1); bool globalDelete = command.GetArg(2).ToLower().Equals("-g"); - RemoveAdmin(caller, steamid, globalDelete); + RemoveAdmin(caller, steamid, globalDelete, command); } public void RemoveAdmin(CCSPlayerController? caller, string steamid, bool globalDelete = false, CommandInfo? command = null) @@ -193,9 +193,9 @@ namespace CS2_SimpleAdmin } }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); - string commandName = $"css_deladmin {steamid}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, $"css_deladmin {steamid}"); string msg = $"Removed flags from '{steamid}'"; if (command != null) @@ -221,10 +221,7 @@ namespace CS2_SimpleAdmin public void ReloadAdmins(CCSPlayerController? caller) { if (_database == null) return; - - string commandName = "css_reladmin"; - Helper.TryLogCommandOnDiscord(caller, commandName); - + foreach (SteamID steamId in AdminSQLManager._adminCache.Keys.ToList()) { if (AdminSQLManager._adminCache.TryRemove(steamId, out _)) @@ -280,11 +277,8 @@ namespace CS2_SimpleAdmin TargetResult? targets = GetTarget(command); if (targets == null) return; - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } + Helper.LogCommand(caller, command); + //Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); List playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList(); @@ -378,7 +372,7 @@ namespace CS2_SimpleAdmin public void OnKickCommand(CCSPlayerController? caller, CommandInfo command) { string callerName = caller == null ? "Console" : caller.PlayerName; - string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; + string reason = _localizer?["sa_unknown"] ?? "Unknown"; TargetResult? targets = GetTarget(command); @@ -402,12 +396,12 @@ namespace CS2_SimpleAdmin if (caller!.CanTarget(player)) { - Kick(caller, player, reason, callerName); + Kick(caller, player, reason, callerName, command); } }); } - public void Kick(CCSPlayerController? caller, CCSPlayerController player, string reason = "Unknown", string? callerName = null) + public void Kick(CCSPlayerController? caller, CCSPlayerController player, string reason = "Unknown", string? callerName = null, CommandInfo? command = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; if (player.PawnIsAlive) @@ -415,11 +409,11 @@ namespace CS2_SimpleAdmin player.Pawn.Value!.Freeze(); } - reason = reason ?? CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; - - string commandName = $"css_kick {player.PlayerName} {reason}"; - Helper.LogCommand(caller, commandName); - Helper.TryLogCommandOnDiscord(caller, commandName); + reason = reason ?? _localizer?["sa_unknown"] ?? "Unknown"; + + if (command != null) + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, $"css_kick {player.PlayerName} {reason}"); if (string.IsNullOrEmpty(reason) == false) { @@ -479,12 +473,7 @@ namespace CS2_SimpleAdmin _command = $"ds_workshop_changelevel {map.Replace("ws:", "")}"; } - string commandName = command?.GetCommandString ?? $"css_changewsmap {map}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - if (command is not null) - Helper.LogCommand(caller, command); - - AddTimer(2.0f, () => + AddTimer(3.0f, () => { Server.ExecuteCommand(_command); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); @@ -502,6 +491,11 @@ namespace CS2_SimpleAdmin Server.PrintToConsole(msg); return; } + + AddTimer(3.0f, () => + { + Server.ExecuteCommand($"changelevel {map}"); + }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) @@ -517,15 +511,10 @@ namespace CS2_SimpleAdmin } } - if (!map.StartsWith("ws:")) + if (command != null) { - string commandName = command?.GetCommandString ?? $"css_changemap {map}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - - AddTimer(2.0f, () => - { - Server.ExecuteCommand($"changelevel {map}"); - }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, command); } } @@ -568,16 +557,17 @@ namespace CS2_SimpleAdmin } } } - - string commandName = command?.GetCommandString ?? $"css_changewsmap {map}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - if (command is not null) - Helper.LogCommand(caller, command); - AddTimer(2.0f, () => + AddTimer(3.0f, () => { Server.ExecuteCommand(_command); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); + + if (command != null) + { + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, command); + } } [ConsoleCommand("css_cvar", "Change a cvar.")] @@ -600,12 +590,7 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); var value = command.GetArg(2); @@ -623,12 +608,7 @@ namespace CS2_SimpleAdmin { string callerName = caller == null ? "Console" : caller.PlayerName; - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); Server.ExecuteCommand(command.ArgString); @@ -649,13 +629,10 @@ namespace CS2_SimpleAdmin public static void RestartGame(CCSPlayerController? admin) { + Helper.LogCommand(admin, "css_restartgame"); + // TODO: Localize - string name = admin == null ? "Console" : admin.PlayerName; - - string commandName = "css_restartgame"; - Helper.TryLogCommandOnDiscord(admin, commandName); - Helper.LogCommand(admin, commandName); - + var name = admin == null ? "Console" : admin.PlayerName; Server.PrintToChatAll($"[SA] {name}: Restarting game..."); Server.ExecuteCommand("mp_restartgame 2"); } diff --git a/Commands/basecomms.cs b/Commands/basecomms.cs index e7e57f4..d66a69b 100644 --- a/Commands/basecomms.cs +++ b/Commands/basecomms.cs @@ -1,11 +1,10 @@ -using CounterStrikeSharp.API; +using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands.Targeting; -using CounterStrikeSharp.API.Modules.Entities; using System.Text; namespace CS2_SimpleAdmin @@ -21,7 +20,7 @@ namespace CS2_SimpleAdmin string callerName = caller == null ? "Console" : caller.PlayerName; int time = 0; - string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; + string reason = _localizer?["sa_unknown"] ?? "Unknown"; TargetResult? targets = GetTarget(command); if (targets == null) return; @@ -44,12 +43,12 @@ namespace CS2_SimpleAdmin { if (caller!.CanTarget(player)) { - Gag(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager); + Gag(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command); } }); } - internal void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null) + internal void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null) { if (_database == null) return; callerName ??= caller == null ? "Console" : caller.PlayerName; @@ -69,10 +68,6 @@ namespace CS2_SimpleAdmin Name = caller?.PlayerName, IpAddress = caller?.IpAddress?.Split(":")[0] }; - - string commandName = $"css_gag {player?.SteamID} {time} {reason}"; - Helper.LogCommand(caller, commandName); - Helper.TryLogCommandOnDiscord(caller, commandName); Task.Run(async () => { @@ -83,7 +78,6 @@ namespace CS2_SimpleAdmin Server.ExecuteCommand($"css_tag_mute {player!.SteamID}"); playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time); - if (time == 0) { if (!player!.IsBot && !player.IsHLTV) @@ -130,6 +124,13 @@ namespace CS2_SimpleAdmin } } } + + if (command != null) + { + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer); + Helper.LogCommand(caller, command); + } } [ConsoleCommand("css_addgag")] @@ -153,14 +154,8 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - int time = 0; - string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; + string reason = _localizer?["sa_unknown"] ?? "Unknown"; MuteManager _muteManager = new(_database); PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager(); @@ -177,8 +172,6 @@ namespace CS2_SimpleAdmin IpAddress = caller?.IpAddress?.Split(":")[0] }; - Helper.LogCommand(caller, command); - List matches = Helper.GetPlayerFromSteamid64(steamid); if (matches.Count == 1) { @@ -239,6 +232,8 @@ 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); } Task.Run(async () => @@ -246,7 +241,13 @@ namespace CS2_SimpleAdmin await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 0); }); - command.ReplyToCommand($"Gagged player with steamid {steamid}."); + if (command != null) + { + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, command); + } + + command?.ReplyToCommand($"Gagged player with steamid {steamid}."); } [ConsoleCommand("css_ungag")] @@ -265,12 +266,7 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); bool found = false; @@ -372,7 +368,7 @@ namespace CS2_SimpleAdmin string callerName = caller == null ? "Console" : caller.PlayerName; int time = 0; - string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; + string reason = _localizer?["sa_unknown"] ?? "Unknown"; TargetResult? targets = GetTarget(command); if (targets == null) return; @@ -395,12 +391,12 @@ namespace CS2_SimpleAdmin { if (caller!.CanTarget(player)) { - Mute(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager); + Mute(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command); } }); } - internal void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null) + internal void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null) { if (_database == null) return; callerName ??= caller == null ? "Console" : caller.PlayerName; @@ -420,10 +416,6 @@ namespace CS2_SimpleAdmin Name = caller?.PlayerName, IpAddress = caller?.IpAddress?.Split(":")[0] }; - - string commandName = $"css_mute {player?.SteamID} {time} {reason}"; - Helper.LogCommand(caller, commandName); - Helper.TryLogCommandOnDiscord(caller, commandName); player!.VoiceFlags = VoiceFlags.Muted; @@ -475,6 +467,13 @@ 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); + } } [ConsoleCommand("css_addmute")] @@ -497,16 +496,8 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - - Helper.LogCommand(caller, command); - int time = 0; - string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; + string reason = _localizer?["sa_unknown"] ?? "Unknown"; MuteManager _muteManager = new(_database); PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager(); @@ -578,6 +569,8 @@ namespace CS2_SimpleAdmin } } } + + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); } Task.Run(async () => @@ -585,7 +578,13 @@ namespace CS2_SimpleAdmin await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 1); }); - command.ReplyToCommand($"Muted player with steamid {steamid}."); + if (command != null) + { + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, command); + } + + command?.ReplyToCommand($"Muted player with steamid {steamid}."); } [ConsoleCommand("css_unmute")] @@ -604,12 +603,7 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); string pattern = command.GetArg(1); @@ -720,12 +714,12 @@ namespace CS2_SimpleAdmin { if (caller!.CanTarget(player)) { - Silence(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager); + Silence(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command); } }); } - internal void Silence(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null) + internal void Silence(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null) { if (_database == null) return; callerName ??= caller == null ? "Console" : caller.PlayerName; @@ -745,10 +739,6 @@ namespace CS2_SimpleAdmin Name = caller?.PlayerName, IpAddress = caller?.IpAddress?.Split(":")[0] }; - - string commandName = $"css_silence {player?.SteamID} {time} {reason}"; - Helper.LogCommand(caller, commandName); - Helper.TryLogCommandOnDiscord(caller, commandName); Task.Run(async () => { @@ -759,7 +749,6 @@ namespace CS2_SimpleAdmin Server.ExecuteCommand($"css_tag_mute {player!.SteamID}"); player!.VoiceFlags = VoiceFlags.Muted; - playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time); if (time == 0) @@ -808,6 +797,13 @@ namespace CS2_SimpleAdmin } } } + + if (command != null) + { + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, command); + } } [ConsoleCommand("css_addsilence")] @@ -830,14 +826,6 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - - Helper.LogCommand(caller, command); - int time = 0; string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; @@ -913,6 +901,8 @@ namespace CS2_SimpleAdmin } } } + + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); } } Task.Run(async () => @@ -920,7 +910,13 @@ namespace CS2_SimpleAdmin await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 2); }); - command.ReplyToCommand($"Silenced player with steamid {steamid}."); + if (command != null) + { + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, command); + } + + command?.ReplyToCommand($"Silenced player with steamid {steamid}."); } [ConsoleCommand("css_unsilence")] @@ -939,12 +935,7 @@ namespace CS2_SimpleAdmin return; } - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); string pattern = command.GetArg(1); diff --git a/Commands/basevotes.cs b/Commands/basevotes.cs index 03965c1..088ada6 100644 --- a/Commands/basevotes.cs +++ b/Commands/basevotes.cs @@ -3,7 +3,6 @@ using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; -using CounterStrikeSharp.API.Modules.Entities; using CounterStrikeSharp.API.Modules.Menu; using System.Text; @@ -20,12 +19,7 @@ namespace CS2_SimpleAdmin if (command.GetArg(1) == null || command.GetArg(1).Length < 0 || command.ArgCount < 2) return; - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); voteAnswers.Clear(); diff --git a/Commands/funcommands.cs b/Commands/funcommands.cs index 6d32789..f2b7f53 100644 --- a/Commands/funcommands.cs +++ b/Commands/funcommands.cs @@ -1,10 +1,9 @@ -using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands.Targeting; -using CounterStrikeSharp.API.Modules.Entities; using System.Text; namespace CS2_SimpleAdmin @@ -21,6 +20,8 @@ namespace CS2_SimpleAdmin TargetResult? targets = GetTarget(command); List playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && player.PawnIsAlive && !player.IsHLTV).ToList(); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + playersToTarget.ForEach(player => { if (caller!.CanTarget(player)) @@ -35,9 +36,7 @@ namespace CS2_SimpleAdmin callerName ??= caller == null ? "Console" : caller.PlayerName; player!.Pawn.Value!.ToggleNoclip(); - string commandName = $"css_noclip {player.PlayerName}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + Helper.LogCommand(caller, $"css_noclip {player.PlayerName}"); if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -64,6 +63,8 @@ namespace CS2_SimpleAdmin TargetResult? targets = GetTarget(command); List playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList(); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + playersToTarget.ForEach(player => { if (!player.IsBot && player.SteamID.ToString().Length != 17) @@ -82,9 +83,7 @@ namespace CS2_SimpleAdmin player.Pawn.Value!.Freeze(); - string commandName = $"css_freeze {player.PlayerName}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + Helper.LogCommand(caller, $"css_freeze {player.PlayerName}"); if (time > 0) AddTimer(time, () => player.Pawn.Value!.Unfreeze(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); @@ -118,19 +117,21 @@ namespace CS2_SimpleAdmin if (!player.IsBot && player.SteamID.ToString().Length != 17) return; - Unfreeze(caller, player, callerName); + Unfreeze(caller, player, callerName, command); }); } - public void Unfreeze(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null) + public void Unfreeze(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; player!.Pawn.Value!.Unfreeze(); - string commandName = $"css_unfreeze {player.PlayerName}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { diff --git a/Commands/playercommands.cs b/Commands/playercommands.cs index 593392a..190f3e5 100644 --- a/Commands/playercommands.cs +++ b/Commands/playercommands.cs @@ -1,10 +1,9 @@ -using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands.Targeting; -using CounterStrikeSharp.API.Modules.Entities; using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Utils; @@ -27,11 +26,11 @@ namespace CS2_SimpleAdmin playersToTarget.ForEach(player => { - Slay(caller, player, callerName); + Slay(caller, player, callerName, command); }); } - public void Slay(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null) + public void Slay(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null) { if (!player.IsBot && player.SteamID.ToString().Length != 17) return; @@ -40,9 +39,11 @@ namespace CS2_SimpleAdmin player.CommitSuicide(false, true); - string commandName = $"css_slay {player.PlayerName}"; - Helper.LogCommand(caller, commandName); - Helper.TryLogCommandOnDiscord(caller, commandName); + if (command != null) + { + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.LogCommand(caller, command); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -99,7 +100,7 @@ namespace CS2_SimpleAdmin if (!player.IsBot && player.SteamID.ToString().Length != 17) return; - GiveWeapon(caller, player, weaponName, callerName); + GiveWeapon(caller, player, weaponName, callerName, command); }); } @@ -111,9 +112,13 @@ namespace CS2_SimpleAdmin SubGiveWeapon(caller, player!, weapon.ToString(), callerName); } - public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null) + public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null, CommandInfo? command = null) { - Helper.LogCommand(caller, $"css_give {player?.PlayerName} {weaponName}"); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } player?.GiveNamedItem(weaponName); SubGiveWeapon(caller, player!, weaponName, callerName); @@ -122,11 +127,7 @@ namespace CS2_SimpleAdmin public void SubGiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; - - string commandName = $"css_give {player.PlayerName} {weaponName}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); - + if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { foreach (CCSPlayerController _player in Helper.GetValidPlayers()) @@ -156,12 +157,12 @@ namespace CS2_SimpleAdmin { if (caller!.CanTarget(player)) { - StripWeapons(caller, player, callerName); + StripWeapons(caller, player, callerName, command); } }); } - public void StripWeapons(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null) + public void StripWeapons(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; @@ -170,9 +171,11 @@ namespace CS2_SimpleAdmin player.RemoveWeapons(); - string commandName = $"css_strip {player.PlayerName}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -206,12 +209,12 @@ namespace CS2_SimpleAdmin { if (caller!.CanTarget(player)) { - SetHp(caller, player, health, callerName); + SetHp(caller, player, health, callerName, command); } }); } - public void SetHp(CCSPlayerController? caller, CCSPlayerController player, int health, string? callerName = null) + public void SetHp(CCSPlayerController? caller, CCSPlayerController player, int health, string? callerName = null, CommandInfo? command = null) { if (!player.IsBot && player.SteamID.ToString().Length != 17) return; @@ -220,9 +223,11 @@ namespace CS2_SimpleAdmin player.SetHp(health); - string commandName = $"css_hp {player.PlayerName} {health}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -259,20 +264,22 @@ namespace CS2_SimpleAdmin if (caller!.CanTarget(player)) { - SetSpeed(caller, player, speed, callerName); + SetSpeed(caller, player, speed, callerName, command); } }); } - public void SetSpeed(CCSPlayerController? caller, CCSPlayerController player, double speed, string? callerName = null) + public void SetSpeed(CCSPlayerController? caller, CCSPlayerController player, double speed, string? callerName = null, CommandInfo? command = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; player.SetSpeed((float)speed); - string commandName = $"css_speed {player?.PlayerName} {speed}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -300,6 +307,8 @@ namespace CS2_SimpleAdmin TargetResult? targets = GetTarget(command); if (targets == null) return; + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + List playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList(); playersToTarget.ForEach(player => @@ -309,20 +318,22 @@ namespace CS2_SimpleAdmin if (caller!.CanTarget(player)) { - SetGravity(caller, player, gravity, callerName); + SetGravity(caller, player, gravity, callerName, command); } }); } - public void SetGravity(CCSPlayerController? caller, CCSPlayerController player, double gravity, string? callerName = null) + public void SetGravity(CCSPlayerController? caller, CCSPlayerController player, double gravity, string? callerName = null, CommandInfo? command = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; player.SetGravity((float)gravity); - string commandName = $"css_gravity {player?.PlayerName} {gravity}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -359,20 +370,22 @@ namespace CS2_SimpleAdmin if (caller!.CanTarget(player)) { - SetMoney(caller, player, money, callerName); + SetMoney(caller, player, money, callerName, command); } }); } - public void SetMoney(CCSPlayerController? caller, CCSPlayerController player, int money, string? callerName = null) + public void SetMoney(CCSPlayerController? caller, CCSPlayerController player, int money, string? callerName = null, CommandInfo? command = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; player.SetMoney(money); - string commandName = $"css_money {player?.PlayerName} {money}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -406,40 +419,42 @@ namespace CS2_SimpleAdmin if (caller!.CanTarget(player)) { - God(caller, player, callerName); + God(caller, player, callerName, command); } }); } - public void God(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null) + public void God(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; - if (player == null || player.IsValid == false) - return; - - string commandName = $"css_god {player.PlayerName}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, callerName); - - if (!godPlayers.Contains(player.Slot)) + if (player != null) { - godPlayers.Add(player.Slot); - } - else - { - RemoveFromConcurrentBag(godPlayers, player.Slot); - } - - if (caller == null || !silentPlayers.Contains(caller.Slot)) - { - foreach (CCSPlayerController _player in Helper.GetValidPlayers()) + if (command != null) { - using (new WithTemporaryCulture(_player.GetLanguage())) + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } + + if (!godPlayers.Contains(player.Slot)) + { + godPlayers.Add(player.Slot); + } + else + { + RemoveFromConcurrentBag(godPlayers, player.Slot); + } + + if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) + { + foreach (CCSPlayerController _player in Helper.GetValidPlayers()) { - StringBuilder sb = new(_localizer!["sa_prefix"]); - sb.Append(_localizer["sa_admin_god_message", callerName, player.PlayerName]); - _player.PrintToChat(sb.ToString()); + using (new WithTemporaryCulture(_player.GetLanguage())) + { + StringBuilder sb = new(_localizer!["sa_prefix"]); + sb.Append(_localizer["sa_admin_god_message", callerName, player.PlayerName]); + _player.PrintToChat(sb.ToString()); + } } } } @@ -470,19 +485,21 @@ namespace CS2_SimpleAdmin if (caller!.CanTarget(player)) { - Slap(caller, player, damage); + Slap(caller, player, damage, command); } }); } - public void Slap(CCSPlayerController? caller, CCSPlayerController player, int damage, string? callerName = null) + public void Slap(CCSPlayerController? caller, CCSPlayerController player, int damage, CommandInfo? command = null) { - callerName ??= caller == null ? "Console" : caller.PlayerName; + string callerName = caller == null ? "Console" : caller.PlayerName; player!.Pawn.Value!.Slap(damage); - string commandName = $"css_slap {player.PlayerName} {damage}"; - Helper.LogCommand(caller, callerName); - Helper.TryLogCommandOnDiscord(caller, commandName); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -540,23 +557,18 @@ namespace CS2_SimpleAdmin bool kill = command.GetArg(3).ToLower().Equals("-k"); - Helper.LogCommand(caller, command); - playersToTarget.ForEach(player => { - ChangeTeam(caller, player, _teamName, teamNum, kill, callerName); + ChangeTeam(caller, player, _teamName, teamNum, kill, callerName, command); }); } - public void ChangeTeam(CCSPlayerController? caller, CCSPlayerController player, string teamName, CsTeam teamNum, bool kill, string? callerName = null) + public void ChangeTeam(CCSPlayerController? caller, CCSPlayerController player, string teamName, CsTeam teamNum, bool kill, string? callerName = null, CommandInfo? command = null) { if (!player.IsBot && player.SteamID.ToString().Length != 17) return; callerName ??= caller == null ? "Console" : caller.PlayerName; - string commandName = $"css_team {player.PlayerName} {teamName} {teamNum} {kill}"; - Helper.LogCommand(caller, commandName); - Helper.TryLogCommandOnDiscord(caller, commandName); if (!teamName.Equals("swap")) { @@ -594,6 +606,12 @@ namespace CS2_SimpleAdmin } } } + + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } } [ConsoleCommand("css_rename", "Rename a player.")] @@ -610,13 +628,8 @@ namespace CS2_SimpleAdmin TargetResult? targets = GetTarget(command); List playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList(); - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); playersToTarget.ForEach(player => { @@ -625,7 +638,6 @@ namespace CS2_SimpleAdmin if (caller!.CanTarget(player)) { - if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { foreach (CCSPlayerController _player in Helper.GetValidPlayers()) @@ -661,25 +673,27 @@ namespace CS2_SimpleAdmin if (caller!.CanTarget(player)) { - Respawn(caller, player, callerName); + Respawn(caller, player, callerName, command); } }); } - public void Respawn(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null) + public void Respawn(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null) { callerName ??= caller == null ? "Console" : caller.PlayerName; if (CBasePlayerController_SetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return; - CCSPlayerPawn? playerPawn = player.PlayerPawn.Value; + var playerPawn = player.PlayerPawn.Value; CBasePlayerController_SetPawnFunc.Invoke(player, playerPawn, true, false); VirtualFunction.CreateVoid(player.Handle, GameData.GetOffset("CCSPlayerController_Respawn"))(player); - string commandName = $"css_respawn {player.PlayerName}"; - Helper.TryLogCommandOnDiscord(caller, commandName); - Helper.LogCommand(caller, commandName); + if (command != null) + { + Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + } if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) { @@ -713,13 +727,8 @@ namespace CS2_SimpleAdmin List playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList(); - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); playersToTarget.ForEach(player => { @@ -769,14 +778,8 @@ namespace CS2_SimpleAdmin List playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList(); - if (_discordWebhookClientLog != null && _localizer != null) - { - string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; - _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); - } - - Helper.LogCommand(caller, command); + Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); playersToTarget.ForEach(player => { diff --git a/Events.cs b/Events.cs index efcb0ab..7c5ea63 100644 --- a/Events.cs +++ b/Events.cs @@ -87,7 +87,6 @@ public partial class CS2_SimpleAdmin } } - [GameEventHandler] public HookResult OnPlayerFullConnect(EventPlayerConnectFull @event, GameEventInfo info) { @@ -226,10 +225,13 @@ public partial class CS2_SimpleAdmin public HookResult OnCommandSay(CCSPlayerController? player, CommandInfo info) { - if (player is null || !player.IsValid || player.IsBot || player.IsHLTV || info.GetArg(1).Length == 0 || info.GetArg(1).StartsWith("/") + if (player is null || !player.IsValid || player.IsBot || player.IsHLTV || info.GetArg(1).StartsWith("/") || info.GetArg(1).StartsWith("!") && info.GetArg(1).Length >= 12) return HookResult.Continue; + if (info.GetArg(1).Length == 0) + return HookResult.Handled; + PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager(); if (playerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag) || playerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Silence)) @@ -240,10 +242,13 @@ public partial class CS2_SimpleAdmin public HookResult OnCommandTeamSay(CCSPlayerController? player, CommandInfo info) { - if (player is null || !player.IsValid || player.IsBot || player.IsHLTV || info.GetArg(1).Length == 0 || info.GetArg(1).StartsWith("/") + if (player is null || !player.IsValid || player.IsBot || player.IsHLTV || info.GetArg(1).StartsWith("/") || info.GetArg(1).StartsWith("!") && info.GetArg(1).Length >= 12) return HookResult.Continue; + if (info.GetArg(1).Length == 0) + return HookResult.Handled; + PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager(); if (playerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag) || playerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Silence)) @@ -297,7 +302,6 @@ public partial class CS2_SimpleAdmin AddTimer(61.0f, () => { - #if DEBUG Logger.LogCritical("[OnMapStart] Expired check"); #endif @@ -407,7 +411,6 @@ public partial class CS2_SimpleAdmin await _adminManager.GiveAllFlags(); }); - }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); AddTimer(3.0f, () => diff --git a/Helper.cs b/Helper.cs index acf51d6..b6200b3 100644 --- a/Helper.cs +++ b/Helper.cs @@ -7,6 +7,8 @@ using CounterStrikeSharp.API.Modules.Entities; using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Menu; using Discord; +using Discord.Webhook; +using Microsoft.Extensions.Localization; using Microsoft.Extensions.Logging; using System.Reflection; using System.Runtime.CompilerServices; @@ -196,6 +198,88 @@ namespace CS2_SimpleAdmin return new List { embed.Build() }; } + public static void SendDiscordLogMessage(CCSPlayerController? caller, CommandInfo command, DiscordWebhookClient? discordWebhookClientLog, IStringLocalizer? localizer) + { + if (discordWebhookClientLog != null && localizer != null) + { + string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; + string callerName = caller != null ? caller.PlayerName : "Console"; + discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString])); + } + } + + public enum PenaltyType + { + Ban, + Mute, + Gag, + Silence, + } + + public static string ConvertMinutesToTime(int minutes) + { + TimeSpan time = TimeSpan.FromMinutes(minutes); + + return time.Days > 0 ? $"{time.Days}d {time.Hours}h {time.Minutes}m" : time.Hours > 0 ? $"{time.Hours}h {time.Minutes}m" : $"{time.Minutes}m"; + } + + public static void SendDiscordPenaltyMessage(CCSPlayerController? caller, CCSPlayerController? target, string reason, int duration, PenaltyType penalty, DiscordWebhookClient? discordWebhookClientPenalty, IStringLocalizer? localizer) + { + if (discordWebhookClientPenalty != null && localizer != null) + { + string callercommunityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : ""; + string targetcommunityUrl = target != null ? "<" + new SteamID(target.SteamID).ToCommunityUrl().ToString() + ">" : ""; + string callerName = caller != null ? caller.PlayerName : "Console"; + string targetName = target != null ? target.PlayerName : localizer?["sa_unknown"] ?? "Unknown"; + string targetSteamId = target != null ? new SteamID(target.SteamID).SteamId2.ToString() : localizer?["sa_unknown"] ?? "Unknown"; + + string time = duration != 0 ? ConvertMinutesToTime(duration) : localizer?["sa_permanent"] ?? "Permanent"; + + string[] fieldNames = [ + localizer?["sa_player"] ?? "Player:", + localizer?["sa_steamid"] ?? "SteamID:", + localizer?["sa_duration"] ?? "Duration:", + localizer?["sa_reason"] ?? "Reason:", + localizer?["sa_admin"] ?? "Admin:"]; + string[] fieldValues = [$"[{targetName}]({targetcommunityUrl})", targetSteamId, time, reason, $"[{callerName}]({callercommunityUrl})"]; + bool[] inlineFlags = [true, true, true, false, false]; + + string? hostname = ConVar.Find("hostname")!.StringValue ?? localizer?["sa_unknown"] ?? "Unknown"; + + var embed = new EmbedBuilder + { + Title = penalty switch + { + PenaltyType.Ban => localizer?["sa_discord_penalty_ban"] ?? "Ban registrered", + PenaltyType.Mute => localizer?["sa_discord_penalty_mute"] ?? "Mute registrered", + PenaltyType.Gag => localizer?["sa_discord_penalty_gag"] ?? "Gag registrered", + PenaltyType.Silence => localizer?["sa_discord_penalty_silence"] ?? "Silence registrered", + _ => localizer?["sa_discord_penalty_unknown"] ?? "Unknown registrered", + }, + + Color = penalty switch + { + PenaltyType.Ban => Color.Red, + PenaltyType.Mute => Color.Blue, + PenaltyType.Gag => Color.Gold, + PenaltyType.Silence => Color.Green, + _ => Color.Default, + }, + + Description = $"{hostname}", + + Timestamp = DateTimeOffset.UtcNow + }; + + for (int i = 0; i < fieldNames.Length; i++) + { + embed.AddField(fieldNames[i], fieldValues[i], inlineFlags[i]); + } + + discordWebhookClientPenalty.SendMessageAsync(embeds: [embed.Build()]); + } + } + public static string GenerateMessageDiscord(string message) { string? hostname = ConVar.Find("hostname")!.StringValue ?? CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; diff --git a/lang/ar.json b/lang/ar.json index 2564212..02e81ce 100644 --- a/lang/ar.json +++ b/lang/ar.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "مجهول", + "sa_player": "اللاعب", + "sa_steamid": "معرف البخار", + "sa_duration": "المدة", + "sa_reason": "السبب", + "sa_admin": "المشرف", + "sa_permanent": "دائم", + + "sa_discord_penalty_ban": "الحظر مسجل", + "sa_discord_penalty_mute": "الكتم مسجل", + "sa_discord_penalty_gag": "الصمت مسجل", + "sa_discord_penalty_silence": "الصمت مسجل", + "sa_discord_penalty_unknown": "غير معروف مسجل", + "sa_player_ban_message_time": "تم حظرك لمدة {lightred}{0}{default} لمدة {lightred}{1}{default} دقيقة من قبل {lightred}{2}{default}!", "sa_player_ban_message_perm": "تم حظرك بشكل دائم لمدة {lightred}{0}{default} من قبل {lightred}{1}{default}!", "sa_player_kick_message": "تم طردك لمدة {lightred}{0}{default} من قبل {lightred}{1}{default}!", diff --git a/lang/en.json b/lang/en.json index dfb7116..a2d39ce 100644 --- a/lang/en.json +++ b/lang/en.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "Unknown", + "sa_player": "Player", + "sa_steamid": "SteamID", + "sa_duration": "Duration", + "sa_reason": "Reason", + "sa_admin": "Admin", + "sa_permanent": "Permanent", + + "sa_discord_penalty_ban": "Ban registrered", + "sa_discord_penalty_mute": "Mute registrered", + "sa_discord_penalty_gag": "Gag registrered", + "sa_discord_penalty_silence": "Silence registrered", + "sa_discord_penalty_unknown": "Unknown registrered", + "sa_player_ban_message_time": "You have been banned for {lightred}{0}{default} for {lightred}{1}{default} minutes by {lightred}{2}{default}!", "sa_player_ban_message_perm": "You have been banned permanently for {lightred}{0}{default} by {lightred}{1}{default}!", "sa_player_kick_message": "You have been kicked for {lightred}{0}{default} by {lightred}{1}{default}!", diff --git a/lang/es.json b/lang/es.json index 4c8cc39..cd1c49c 100644 --- a/lang/es.json +++ b/lang/es.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "Desconocido", + "sa_player": "Jugador", + "sa_steamid": "ID de Steam", + "sa_duration": "Duración", + "sa_reason": "Motivo", + "sa_admin": "Admin", + "sa_permanent": "Permanente", + + "sa_discord_penalty_ban": "Ban registrado", + "sa_discord_penalty_mute": "Silencio registrado", + "sa_discord_penalty_gag": "Mordaza registrada", + "sa_discord_penalty_silence": "Silencio registrado", + "sa_discord_penalty_unknown": "Registro desconocido", + "sa_player_ban_message_time": "Has sido baneado por {lightred}{0}{default} durante {lightred}{1}{default} minutos por {lightred}{2}{default}!", "sa_player_ban_message_perm": "Has sido baneado permanentemente por {lightred}{0}{default} por {lightred}{1}{default}!", "sa_player_kick_message": "Has sido expulsado por {lightred}{0}{default} durante {lightred}{1}{default}!", diff --git a/lang/fa.json b/lang/fa.json index 5c200bc..1c057ba 100644 --- a/lang/fa.json +++ b/lang/fa.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "ناشناخته", + "sa_player": "بازیکن", + "sa_steamid": "شناسه استیم", + "sa_duration": "مدت زمان", + "sa_reason": "دلیل", + "sa_admin": "مدیر", + "sa_permanent": "دائمی", + + "sa_discord_penalty_ban": "بن انجام شده", + "sa_discord_penalty_mute": "سکوت انجام شده", + "sa_discord_penalty_gag": "بند زدن انجام شده", + "sa_discord_penalty_silence": "سکوت انجام شده", + "sa_discord_penalty_unknown": "ناشناخته انجام شده", + "sa_player_ban_message_time": "شما توسط {lightred}{2}{default} برای {lightred}{1}{default} دقیقه به دلیل {lightred}{0}{default} مسدود شده‌اید!", "sa_player_ban_message_perm": "شما توسط {lightred}{1}{default} به دلیل {lightred}{0}{default} برای همیشه مسدود شده‌اید!", "sa_player_kick_message": "شما توسط {lightred}{1}{default} به دلیل {lightred}{0}{default} اخراج شده‌اید!", diff --git a/lang/fr.json b/lang/fr.json index c4c0ff2..27797e7 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "Inconnu", + "sa_player": "Joueur", + "sa_steamid": "ID Steam", + "sa_duration": "Durée", + "sa_reason": "Raison", + "sa_admin": "Admin", + "sa_permanent": "Permanent", + + "sa_discord_penalty_ban": "Bannissement enregistré", + "sa_discord_penalty_mute": "Mute enregistré", + "sa_discord_penalty_gag": "Gag enregistré", + "sa_discord_penalty_silence": "Silence enregistré", + "sa_discord_penalty_unknown": "Inconnu enregistré", + "sa_player_ban_message_time": "Vous avez été banni pour {lightred}{0}{default} pendant {lightred}{1}{default} minutes par {lightred}{2}{default}!", "sa_player_ban_message_perm": "Vous avez été banni définitivement pour {lightred}{0}{default} par {lightred}{1}{default}!", "sa_player_kick_message": "Vous avez été expulsé pour {lightred}{0}{default} par {lightred}{1}{default}!", diff --git a/lang/lv.json b/lang/lv.json index fe09668..f8e2ea1 100644 --- a/lang/lv.json +++ b/lang/lv.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "Nezināms", + "sa_player": "Spēlētājs", + "sa_steamid": "Steam ID", + "sa_duration": "Ilgums", + "sa_reason": "Iemesls", + "sa_admin": "Admins", + "sa_permanent": "Pastāvīgs", + + "sa_discord_penalty_ban": "Bans reģistrēts", + "sa_discord_penalty_mute": "Mute reģistrēts", + "sa_discord_penalty_gag": "Gag reģistrēts", + "sa_discord_penalty_silence": "Klusums reģistrēts", + "sa_discord_penalty_unknown": "Nezināms reģistrēts", + "sa_player_ban_message_time": "Tu esi nobanots uz {lightred}{0}{default} uz {lightred}{1}{default} minūtēm, iemesls: {lightred}{2}{default}!", "sa_player_ban_message_perm": "Tevis bans ir uz mūžu, iemesls: {lightred}{0}{default}, Admins: {lightred}{1}{default}!", "sa_player_kick_message": "Tu esi izmests, iemesls: {lightred}{0}{default}, Admins: {lightred}{1}{default}!", diff --git a/lang/pl.json b/lang/pl.json index 1746cb8..2ddddd7 100644 --- a/lang/pl.json +++ b/lang/pl.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "Brak", + "sa_player": "Gracz", + "sa_steamid": "SteamID", + "sa_duration": "Czas trwania", + "sa_reason": "Powód", + "sa_admin": "Administrator", + "sa_permanent": "Na zawsze", + + "sa_discord_penalty_ban": "Nowy ban", + "sa_discord_penalty_mute": "Nowe wyciszenie", + "sa_discord_penalty_gag": "Nowe zakneblowanie", + "sa_discord_penalty_silence": "Nowe uciszenie", + "sa_discord_penalty_unknown": "Nowa nieznana blokada", + "sa_player_ban_message_time": "Zostałeś zbanowany za {lightred}{0}{default} na {lightred}{1}{default} minut przez {lightred}{2}{default}!", "sa_player_ban_message_perm": "Zostałeś zbanowany na zawsze za {lightred}{0}{default} przez {lightred}{1}{default}!", "sa_player_kick_message": "Zostałeś wyrzucony za {lightred}{0}{default} przez {lightred}{1}{default}!", diff --git a/lang/pt-BR.json b/lang/pt-BR.json index 36518a2..b8a987d 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "Desconhecido", + "sa_player": "Jogador", + "sa_steamid": "SteamID", + "sa_duration": "Duração", + "sa_reason": "Motivo", + "sa_admin": "Admin", + "sa_permanent": "Permanente", + + "sa_discord_penalty_ban": "Banimento registrado", + "sa_discord_penalty_mute": "Mute registrado", + "sa_discord_penalty_gag": "Gag registrado", + "sa_discord_penalty_silence": "Silêncio registrado", + "sa_discord_penalty_unknown": "Desconhecido registrado", + "sa_player_ban_message_time": "Você foi banido por {lightred}{0}{default} por {lightred}{1}{default} minutos por {lightred}{2}{default}!", "sa_player_ban_message_perm": "Você foi banido permanentemente por {lightred}{0}{default} por {lightred}{1}{default}!", "sa_player_kick_message": "Você foi expulso por {lightred}{0}{default} por {lightred}{1}{default}!", diff --git a/lang/ru.json b/lang/ru.json index 46a49ee..6b30dd0 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "Неизвестный", + "sa_player": "Игрок", + "sa_steamid": "SteamID", + "sa_duration": "Продолжительность", + "sa_reason": "Причина", + "sa_admin": "Администратор", + "sa_permanent": "Постоянный", + + "sa_discord_penalty_ban": "Бан зарегистрирован", + "sa_discord_penalty_mute": "Мут зарегистрирован", + "sa_discord_penalty_gag": "Запрет зарегистрирован", + "sa_discord_penalty_silence": "Молчание зарегистрировано", + "sa_discord_penalty_unknown": "Неизвестно зарегистрировано", + "sa_player_ban_message_time": "Вы были забанены по причине {lightred}{0}{default} на {lightred}{1}{default} минут(ы) администратором {lightred}{2}{default}!", "sa_player_ban_message_perm": "Вас забанили навсегда по причине {lightred}{0}{default} администратором {lightred}{1}{default}!", "sa_player_kick_message": "Вы были выгнаны {lightred}{0}{default} администратором {lightred}{1}{default}!", diff --git a/lang/tr.json b/lang/tr.json index a4df1ea..b337b6d 100644 --- a/lang/tr.json +++ b/lang/tr.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "Bilinmeyen", + "sa_player": "Oyuncu", + "sa_steamid": "SteamID", + "sa_duration": "Süre", + "sa_reason": "Neden", + "sa_admin": "Yönetici", + "sa_permanent": "Kalıcı", + + "sa_discord_penalty_ban": "Yasak kaydedildi", + "sa_discord_penalty_mute": "Susturma kaydedildi", + "sa_discord_penalty_gag": "Susturma kaydedildi", + "sa_discord_penalty_silence": "Sessizlik kaydedildi", + "sa_discord_penalty_unknown": "Bilinmeyen kaydedildi", + "sa_player_ban_message_time": "Senaryo nedeniyle {lightred}{0}{default} dakika boyunca {lightred}{1}{default} tarafından yasaklandınız!", "sa_player_ban_message_perm": "Senaryo nedeniyle kalıcı olarak {lightred}{0}{default} tarafından yasaklandınız!", "sa_player_kick_message": "Senaryo nedeniyle {lightred}{0}{default} tarafından atıldınız!", diff --git a/lang/zh-Hans.json b/lang/zh-Hans.json index a8dc380..895c242 100644 --- a/lang/zh-Hans.json +++ b/lang/zh-Hans.json @@ -2,6 +2,19 @@ "sa_prefix": "{lightred}[SA] {default}", "sa_unknown": "未知", + "sa_player": "玩家", + "sa_steamid": "SteamID", + "sa_duration": "持续时间", + "sa_reason": "原因", + "sa_admin": "管理员", + "sa_permanent": "永久", + + "sa_discord_penalty_ban": "封禁已记录", + "sa_discord_penalty_mute": "禁言已记录", + "sa_discord_penalty_gag": "禁言已记录", + "sa_discord_penalty_silence": "禁声已记录", + "sa_discord_penalty_unknown": "未知已记录", + "sa_player_ban_message_time": "你因为{lightred}{0}{default}的原因被{lightred}{1}{default}禁止{lightred}{2}{default}分钟!", "sa_player_ban_message_perm": "你因为{lightred}{0}{default}的原因被{lightred}{1}{default}永久禁止!", "sa_player_kick_message": "你因为{lightred}{0}{default}的原因被{lightred}{1}{default}踢出!",