diff --git a/CS2-SimpleAdmin/Helper.cs b/CS2-SimpleAdmin/Helper.cs index eaf9696..29df5a9 100644 --- a/CS2-SimpleAdmin/Helper.cs +++ b/CS2-SimpleAdmin/Helper.cs @@ -491,7 +491,7 @@ internal static class Helper public static void SendDiscordPenaltyMessage(CCSPlayerController? caller, CCSPlayerController? target, string reason, int duration, PenaltyType penalty, IStringLocalizer? localizer) { if (localizer == null) return; - + var penaltySetting = penalty switch { PenaltyType.Ban => CS2_SimpleAdmin.Instance.Config.Discord.DiscordPenaltyBanSettings, @@ -505,7 +505,7 @@ internal static class Helper var webhookUrl = penaltySetting.FirstOrDefault(s => s.Name.Equals("Webhook"))?.Value; if (string.IsNullOrEmpty(webhookUrl)) return; - + const string defaultCommunityUrl = ""; var callerCommunityUrl = caller != null ? $"<{new SteamID(caller.SteamID).ToCommunityUrl()}>" : defaultCommunityUrl; var targetCommunityUrl = target != null ? $"<{new SteamID(target.SteamID).ToCommunityUrl()}>" : defaultCommunityUrl; @@ -585,10 +585,10 @@ internal static class Helper }); } - public static void SendDiscordPenaltyMessage(CCSPlayerController? caller, string steamId, string reason, int duration, PenaltyType penalty, IStringLocalizer? localizer) + public static void SendDiscordPenaltyMessage(CCSPlayerController? caller, string steamId, string reason, int duration, PenaltyType penalty, IStringLocalizer? localizer) { if (localizer == null) return; - + var penaltySetting = penalty switch { PenaltyType.Ban => CS2_SimpleAdmin.Instance.Config.Discord.DiscordPenaltyBanSettings, diff --git a/Modules/AntiDLL-CS2-SimpleAdmin/AntiDLL_CS2_SimpleAdmin.cs b/Modules/AntiDLL-CS2-SimpleAdmin/AntiDLL_CS2_SimpleAdmin.cs index 0d608e0..2a13f11 100644 --- a/Modules/AntiDLL-CS2-SimpleAdmin/AntiDLL_CS2_SimpleAdmin.cs +++ b/Modules/AntiDLL-CS2-SimpleAdmin/AntiDLL_CS2_SimpleAdmin.cs @@ -1,7 +1,7 @@ -using CounterStrikeSharp.API.ValveConstants.Protobuf; - -namespace AntiDLL_CS2_SimpleAdmin; +namespace AntiDLL_CS2_SimpleAdmin; +using CounterStrikeSharp.API.Core.Attributes.Registration; +using CounterStrikeSharp.API.ValveConstants.Protobuf; using System.Text.Json.Serialization; using CounterStrikeSharp.API; using CounterStrikeSharp.API.Modules.Entities; @@ -9,7 +9,6 @@ using CS2_SimpleAdminApi; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Capabilities; using Microsoft.Extensions.Logging; - using AntiDLL.API; public class PluginConfig : IBasePluginConfig @@ -23,16 +22,17 @@ public class PluginConfig : IBasePluginConfig public sealed class AntiDLL_CS2_SimpleAdmin : BasePlugin, IPluginConfig { + private int _banType; public PluginConfig Config { get; set; } = new(); private readonly HashSet _bannedPlayers = []; + private readonly HashSet _detections = []; private static PluginCapability AntiDll { get; } = new("AntiDLL"); private static PluginCapability SimpleAdminApi { get; } = new("simpleadmin:api"); - private int _banType = 0; private static ICS2_SimpleAdminApi? _simpleAdminApi; public override string ModuleName => "AntiDLL [CS2-SimpleAdmin Module]"; public override string ModuleDescription => "AntiDLL module for CS2-SimpleAdmin integration"; - public override string ModuleVersion => "1.0.0"; + public override string ModuleVersion => "1.0.1"; public override string ModuleAuthor => "daffyy"; public override void Load(bool hotReload) @@ -65,6 +65,9 @@ public sealed class AntiDLL_CS2_SimpleAdmin : BasePlugin, IPluginConfig OnDetection(player, eventName)); + if (!_detections.Add(player.Slot)) return; - } + // if (player.Connected != PlayerConnectedState.PlayerConnected) + // { + // _detections.Add(player.Slot); + // // AddTimer(3.0f, () => OnDetection(player, eventName)); + // return; + // } + + Logger.LogInformation("Detected \"{eventName}\" for \"{player}({steamid})\"", eventName, player.PlayerName, player.SteamID.ToString()); + } + + private void PunishPlayer(CCSPlayerController player) + { if (!_bannedPlayers.Add(player.Slot)) return; - + if (_banType == 1 && _simpleAdminApi != null) { _simpleAdminApi.IssuePenalty(new SteamID(player.SteamID), null, PenaltyType.Ban, Config.Reason, Config.Duration); } else if (Config.BanType == "kick") { - player.Disconnect(NetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_UNTRUSTEDACCOUNT); + player.Disconnect(NetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_VACNETABNORMALBEHAVIOR); } else { diff --git a/Modules/AntiDLL-CS2-SimpleAdmin/COMPILED/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.dll b/Modules/AntiDLL-CS2-SimpleAdmin/COMPILED/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.dll index c4d5ae0..2037b4e 100644 Binary files a/Modules/AntiDLL-CS2-SimpleAdmin/COMPILED/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.dll and b/Modules/AntiDLL-CS2-SimpleAdmin/COMPILED/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.dll differ diff --git a/Modules/AntiDLL-CS2-SimpleAdmin/COMPILED/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.pdb b/Modules/AntiDLL-CS2-SimpleAdmin/COMPILED/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.pdb index 6b3b296..a401603 100644 Binary files a/Modules/AntiDLL-CS2-SimpleAdmin/COMPILED/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.pdb and b/Modules/AntiDLL-CS2-SimpleAdmin/COMPILED/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.pdb differ diff --git a/Modules/AntiDLL-CS2-SimpleAdmin/settings.ini b/Modules/AntiDLL-CS2-SimpleAdmin/settings.ini deleted file mode 100644 index 9a0956e..0000000 --- a/Modules/AntiDLL-CS2-SimpleAdmin/settings.ini +++ /dev/null @@ -1,16 +0,0 @@ -"Config" -{ - // Доступные переменные: {userid}, {steamid}, {name} - "punish_type" "1" // 0 - kick, 1 - command(punish_command) - - "punish_command" "css_addban {steamid} 0 [AC] Cheats detected #5" // Command to execute when a player is detected with a DLL - // Команда для выполнения, когда игрок обнаружен с DLL - - "chat_message" "" // Сообщение в чат при обнаружении DLL для всех игроков, пусто - не отправлять - // Chat message when a player is detected with a DLL for all players, empty - dont send - "logs" "1" // Логировать в файл наказания? 0 - нет, 1 - да - // Log punishments to file? 0 - no, 1 - yes - - "interval" "120" // Интервал проверки игроков на наличие DLL в секундах - // Interval to check players for DLL in seconds -} \ No newline at end of file