Revert "Small changes"

This reverts commit 9acab82f86.
This commit is contained in:
Dawid Bepierszcz
2024-02-01 00:01:57 +01:00
parent 9acab82f86
commit 13d36dca12

View File

@@ -8,7 +8,6 @@ using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Cvars;
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Menu;
using CounterStrikeSharp.API.Modules.Utils;
using Microsoft.Extensions.Localization;
@@ -16,12 +15,15 @@ using Microsoft.Extensions.Logging;
using MySqlConnector;
using System.Collections.Concurrent;
using System.Text;
using CS2_SimpleAdmin.Menus;
namespace CS2_SimpleAdmin;
[MinimumApiVersion(159)]
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
{
public static CS2_SimpleAdmin Instance { get; private set; } = null;
public static IStringLocalizer? _localizer;
public static ConcurrentBag<string> gaggedPlayers = new ConcurrentBag<string>();
//public static ConcurrentBag<int> mutedPlayers = new ConcurrentBag<int>();
@@ -37,22 +39,20 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin";
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy";
public override string ModuleVersion => "1.2.9a";
private MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>? CBasePlayerController_SetPawnFunc;
public override string ModuleVersion => "1.3.0";
public CS2_SimpleAdminConfig Config { get; set; } = new();
public override void Load(bool hotReload)
{
Instance = this;
registerEvents();
if (hotReload)
{
OnMapStart(string.Empty);
}
CBasePlayerController_SetPawnFunc = new MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>(@"\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x41\x54\x49\x89\xFC\x53\x48\x89\xF3\x48\x81\xEC\xC8\x00\x00\x00");
}
public void OnConfigParsed(CS2_SimpleAdminConfig config)
@@ -157,9 +157,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
_localizer = Localizer;
}
[ConsoleCommand("css_admin")]
[ConsoleCommand("css_adminhelp")]
[RequiresPermissions("@css/generic")]
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)
public void OnAdminHelpCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null || !caller.IsValid) return;
@@ -171,6 +171,16 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
}
}
[ConsoleCommand("css_admin")]
[RequiresPermissions("@css/generic")]
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null || caller.IsValid == false)
return;
AdminMenu.OpenMenu(caller);
}
[ConsoleCommand("css_addadmin")]
[CommandHelper(minArgs: 4, usage: "<steamid> <name> <flags/groups> <immunity> <duration>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
[RequiresPermissions("@css/root")]
@@ -265,44 +275,39 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
command.ReplyToCommand("Reloaded sql admins");
}
[ConsoleCommand("css_stealth")]
[ConsoleCommand("css_hide")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
[ConsoleCommand("css_silentmode")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
[RequiresPermissions("@css/kick")]
public void OnHideCommand(CCSPlayerController? caller, CommandInfo command)
public void OnSilentModeCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null || caller.UserId == null) return;
if (silentPlayers.Contains((ushort)caller.UserId))
{
silentPlayers.Remove((ushort)caller.UserId);
caller.ChangeTeam(CsTeam.Spectator);
caller.PrintToChat($"You aren't hidden now!");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"{caller.PlayerName} isn't hidden now.");
command.ReplyToCommand("SilentMode Deactivated");
}
else
{
silentPlayers.Add((ushort)caller.UserId);
Server.ExecuteCommand("sv_disable_teamselect_menu 1");
Server.NextFrame(() =>
{
if (caller.PlayerPawn.Value != null && caller.PawnIsAlive)
caller.PlayerPawn.Value.CommitSuicide(true, false);
AddTimer(1.0f, () => { caller.ChangeTeam(CsTeam.Spectator); });
AddTimer(1.1f, () => { caller.ChangeTeam(CsTeam.None); });
caller.PrintToChat($"You are hidden now!");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"{caller.PlayerName} is hidden now.");
});
Server.NextFrame(() =>
{
AddTimer(1.25f, () => { Server.ExecuteCommand("sv_disable_teamselect_menu 0"); });
});
command.ReplyToCommand("SilentMode Activated");
}
}
[ConsoleCommand("css_hide")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
[RequiresPermissions("@css/kick")]
public void OnHideCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null) return;
caller.PlayerPawn.Value!.CommitSuicide(true, false);
caller.ChangeTeam(CsTeam.Spectator);
AddTimer(1.0f, () => { caller.ChangeTeam(CsTeam.None); });
command.ReplyToCommand("You are hidden now");
}
[ConsoleCommand("css_who")]
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
[RequiresPermissions("@css/generic")]
@@ -312,13 +317,23 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
if (targets == null) return;
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => caller!.CanTarget(player) && player != null && player.IsValid && !player.IsBot && !player.IsHLTV).ToList();
BanManager _banManager = new(dbConnectionString, Config);
MuteManager _muteManager = new(dbConnectionString);
BanManager banManager = new(dbConnectionString, Config);
MuteManager muteManager = new(dbConnectionString);
playersToTarget.ForEach(player =>
{
if (caller!.CanTarget(player))
{
Who(caller, player, banManager, muteManager);
}
});
}
public void Who(CCSPlayerController? caller, CCSPlayerController player, BanManager banManager = null, MuteManager muteManager = null)
{
banManager ??= new(dbConnectionString, Config);
muteManager ??= new(dbConnectionString);
PlayerInfo playerInfo = new PlayerInfo
{
UserId = player.UserId,
@@ -333,64 +348,37 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
int totalBans = 0;
int totalMutes = 0;
totalBans = await _banManager.GetPlayerBans(playerInfo);
totalMutes = await _muteManager.GetPlayerMutes(playerInfo.SteamId!);
totalBans = await banManager.GetPlayerBans(playerInfo);
totalMutes = await muteManager.GetPlayerMutes(playerInfo.SteamId!);
Server.NextFrame(() =>
{
if (caller != null)
{
caller!.PrintToConsole($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
Action<string> printMethod = caller == null ? Server.PrintToConsole : caller.PrintToConsole;
printMethod($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
caller!.PrintToConsole($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
caller!.PrintToConsole($"• UserID: \"{playerInfo.UserId}\"");
printMethod($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
printMethod($"• UserID: \"{playerInfo.UserId}\"");
if (playerInfo.SteamId != null)
caller!.PrintToConsole($"• SteamID64: \"{playerInfo.SteamId}\"");
printMethod($"• SteamID64: \"{playerInfo.SteamId}\"");
if (player.AuthorizedSteamID != null)
{
caller!.PrintToConsole($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
caller!.PrintToConsole($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
printMethod($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
printMethod($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
}
if (playerInfo.IpAddress != null)
caller!.PrintToConsole($"• IP Address: \"{playerInfo.IpAddress}\"");
caller!.PrintToConsole($"• Ping: \"{player.Ping}\"");
printMethod($"• IP Address: \"{playerInfo.IpAddress}\"");
printMethod($"• Ping: \"{player.Ping}\"");
if (player.AuthorizedSteamID != null)
{
caller!.PrintToConsole($"• Total Bans: \"{totalBans}\"");
caller!.PrintToConsole($"• Total Mutes: \"{totalMutes}\"");
printMethod($"• Total Bans: \"{totalBans}\"");
printMethod($"• Total Mutes: \"{totalMutes}\"");
}
caller!.PrintToConsole($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
}
else
{
Server.PrintToConsole($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
Server.PrintToConsole($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
Server.PrintToConsole($"• UserID: \"{playerInfo.UserId}\"");
if (playerInfo.SteamId != null)
Server.PrintToConsole($"• SteamID64: \"{playerInfo.SteamId}\"");
if (player.AuthorizedSteamID != null)
{
Server.PrintToConsole($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
Server.PrintToConsole($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
}
if (playerInfo.IpAddress != null)
Server.PrintToConsole($"• IP Address: \"{playerInfo.IpAddress}\"");
Server.PrintToConsole($"• Ping: \"{player.Ping}\"");
if (player.AuthorizedSteamID != null)
{
Server.PrintToConsole($"• Total Bans: \"{totalBans}\"");
Server.PrintToConsole($"• Total Mutes: \"{totalMutes}\"");
}
Server.PrintToConsole($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
}
printMethod($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
});
});
}
});
}
[ConsoleCommand("css_players")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
@@ -426,7 +414,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name> [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnKickCommand(CCSPlayerController? caller, CommandInfo command)
{
string reason = "Unknown";
string reason = null;
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@@ -443,6 +431,13 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
targets.Players.ForEach(player =>
{
if (caller!.CanTarget(player))
{
Kick(caller, player, reason);
}
});
}
public void Kick(CCSPlayerController? caller, CCSPlayerController player, string reason = null)
{
if (player.PawnIsAlive)
{
@@ -450,7 +445,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
player.CommitSuicide(true, true);
}
if (command.ArgCount >= 2)
if (string.IsNullOrEmpty(reason) == false)
{
player.PrintToCenter(_localizer!["sa_player_kick_message", reason, caller == null ? "Console" : caller.PlayerName]);
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player.UserId!, reason));
@@ -466,14 +461,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
sb.Append(_localizer["sa_admin_kick_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
}
if (Config.DiscordWebhook.Length > 0 && _localizer != null)
{
LocalizedString localizedMessage = _localizer["sa_admin_kick_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
[ConsoleCommand("css_gag")]
@@ -482,7 +469,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public void OnGagCommand(CCSPlayerController? caller, CommandInfo command)
{
int time = 0;
string reason = "Unknown";
string reason = null;
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@@ -504,6 +491,16 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Gag(caller, player, time, reason, _muteManager);
}
});
}
public void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason = null, MuteManager muteManager = null)
{
reason ??= "Unknown";
muteManager ??= new(dbConnectionString);
PlayerInfo playerInfo = new PlayerInfo
{
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
@@ -520,7 +517,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
Task.Run(async () =>
{
await _muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
});
if (TagsDetected)
@@ -560,11 +557,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_gag_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -576,16 +568,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_gag_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
});
}
[ConsoleCommand("css_addgag")]
[RequiresPermissions("@css/chat")]
@@ -642,11 +627,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_gag_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -658,11 +638,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_gag_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
@@ -798,8 +773,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
});
command.ReplyToCommand($"Ungaged player with pattern {pattern}.");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"Ungaged player with pattern {pattern}.");
return;
}
}
@@ -810,7 +783,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public void OnMuteCommand(CCSPlayerController? caller, CommandInfo command)
{
int time = 0;
string reason = "Unknown";
string reason = null;
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@@ -832,6 +805,16 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Mute(caller, player, time, reason, _muteManager);
}
});
}
public void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason = null, MuteManager muteManager = null)
{
reason ??= "Unknown";
muteManager ??= new(dbConnectionString);
PlayerInfo playerInfo = new PlayerInfo
{
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
@@ -853,17 +836,15 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
player!.VoiceFlags = VoiceFlags.Muted;
Task.Run(async () =>
{
await _muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 1);
});
Task.Run(async () => { await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 1); });
if (time > 0 && time <= 30)
{
AddTimer(time * 60, () =>
{
if (player == null || !player.IsValid || player.AuthorizedSteamID == null) return;
if (player == null || !player.IsValid || player.AuthorizedSteamID == null)
return;
//MuteManager _muteManager = new(dbConnectionString);
//_ = _muteManager.UnmutePlayer(player.AuthorizedSteamID.SteamId64.ToString(), 1);
@@ -891,11 +872,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_mute_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -907,16 +883,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_mute_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
});
}
[ConsoleCommand("css_addmute")]
[RequiresPermissions("@css/chat")]
@@ -973,11 +942,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_mute_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -989,11 +953,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_mute_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
@@ -1128,8 +1087,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
});
command.ReplyToCommand($"Unmuted player with pattern {pattern}.");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"Unmuted player with pattern {pattern}.");
return;
}
}
@@ -1165,6 +1122,16 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Ban(caller, player, time, reason, _banManager);
}
});
}
public void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason = null, BanManager banManager = null)
{
reason ??= "Unknown";
banManager ??= new(dbConnectionString, Config);
if (player.PawnIsAlive)
{
player.Pawn.Value!.Freeze();
@@ -1187,7 +1154,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
Task.Run(async () =>
{
await _banManager.BanPlayer(playerInfo, adminInfo, reason, time);
await banManager.BanPlayer(playerInfo, adminInfo, reason, time);
});
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player!.UserId!));
@@ -1201,11 +1168,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -1217,16 +1179,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
});
}
[ConsoleCommand("css_addban")]
[RequiresPermissions("@css/ban")]
@@ -1286,11 +1241,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -1302,11 +1252,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
@@ -1376,11 +1321,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_perm", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
else
@@ -1392,11 +1332,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_ban_message_time", caller == null ? "Console" : caller.PlayerName, player.PlayerName, reason, time];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
@@ -1430,8 +1365,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
_ = _banManager.UnbanPlayer(pattern);
command.ReplyToCommand($"Unbanned player with pattern {pattern}.");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"Unbanned player with pattern {pattern}.");
}
[ConsoleCommand("css_slay")]
@@ -1444,6 +1377,12 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => caller!.CanTarget(player) && player != null && player.IsValid && player.PawnIsAlive).ToList();
playersToTarget.ForEach(player =>
{
Slay(caller, player);
});
}
public void Slay(CCSPlayerController? caller, CCSPlayerController player)
{
player.CommitSuicide(false, true);
@@ -1452,14 +1391,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_slay_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_slay_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
[ConsoleCommand("css_give")]
[RequiresPermissions("@css/cheats")]
@@ -1505,11 +1438,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_give_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, weaponName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_give_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, weaponName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
@@ -1535,11 +1463,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
sb.Append(_localizer["sa_admin_strip_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_strip_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -1569,11 +1492,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
sb.Append(_localizer["sa_admin_hp_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_hp_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -1607,11 +1525,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
sb.Append(_localizer["sa_admin_speed_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_speed_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -1643,11 +1556,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
sb.Append(_localizer["sa_admin_god_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_god_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
}
@@ -1674,22 +1582,22 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
player!.Pawn.Value!.Slap(damage);
Slap(caller, player, damage);
}
});
}
public void Slap(CCSPlayerController? caller, CCSPlayerController player, int damage)
{
player.Pawn.Value!.Slap(damage);
StringBuilder sb = new(_localizer!["sa_prefix"]);
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
if (caller == null || caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
{
sb.Append(_localizer["sa_admin_slap_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_slap_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
}
[ConsoleCommand("css_team")]
[RequiresPermissions("@css/kick")]
@@ -1729,11 +1637,19 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
break;
}
bool kill = command.GetArg(3)?.ToLower().Equals("-k") ?? false;
playersToTarget.ForEach(player =>
{
ChangeTeam(caller, player, _teamName, teamNum, kill);
});
}
public void ChangeTeam(CCSPlayerController? caller, CCSPlayerController player, string teamName, CsTeam teamNum, bool kill)
{
if (!teamName.Equals("swap"))
{
if (player.PawnIsAlive && teamNum != CsTeam.Spectator && !command.GetArg(3).ToLower().Equals("-k"))
if (player.PawnIsAlive && teamNum != CsTeam.Spectator && !kill)
player.SwitchTeam(teamNum);
else
player.ChangeTeam(teamNum);
@@ -1742,9 +1658,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (player.TeamNum != (byte)CsTeam.Spectator)
{
CsTeam teamNum = (CsTeam)player.TeamNum == CsTeam.Terrorist ? CsTeam.CounterTerrorist : CsTeam.Terrorist;
_teamName = teamNum == CsTeam.Terrorist ? "TT" : "CT";
if (player.PawnIsAlive && !command.GetArg(3).ToLower().Equals("-k"))
teamNum = (CsTeam)player.TeamNum == CsTeam.Terrorist ? CsTeam.CounterTerrorist : CsTeam.Terrorist;
teamName = teamNum == CsTeam.Terrorist ? "TT" : "CT";
if (player.PawnIsAlive && !kill)
{
player.SwitchTeam(teamNum);
}
@@ -1758,16 +1674,10 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_team_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, _teamName]);
sb.Append(_localizer["sa_admin_team_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, teamName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_team_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName, _teamName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
[ConsoleCommand("css_vote")]
[RequiresPermissions("@css/generic")]
@@ -1796,11 +1706,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
voteInProgress = true;
@@ -1816,22 +1721,12 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_vote_message_results", question]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_vote_message_results", question];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
foreach (KeyValuePair<string, int> kvp in voteAnswers)
{
sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_vote_message_results_answer", kvp.Key, kvp.Value]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_vote_message_results_answer", kvp.Key, kvp.Value];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
voteAnswers.Clear();
voteInProgress = false;
@@ -1877,11 +1772,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
if (!map.StartsWith("ws:"))
@@ -1917,11 +1807,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_changemap_message", caller == null ? "Console" : caller.PlayerName, map];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
AddTimer(2.0f, () =>
@@ -1942,11 +1827,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new();
sb.Append(_localizer!["sa_adminchat_template_admin", caller == null ? "Console" : caller.PlayerName, utf8String]);
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_adminchat_template_admin", caller == null ? "Console" : caller.PlayerName, utf8String];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
foreach (var p in Utilities.GetPlayers().Where(p => p.IsValid && !p.IsBot && !p.IsHLTV && AdminManager.PlayerHasPermissions(p, "@css/chat")))
{
@@ -1967,11 +1847,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new();
sb.Append(_localizer!["sa_adminsay_prefix", utf8String]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_adminsay_prefix", utf8String];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
[ConsoleCommand("css_psay", "Private message a player.")]
@@ -1992,8 +1867,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
playersToTarget.ForEach(player =>
{
player.PrintToChat(Helper.ReplaceTags($"({caller!.PlayerName}) {utf8String}"));
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"PSAY: {caller!.PlayerName} --> {player!.PlayerName}: {utf8String}");
});
command.ReplyToCommand(Helper.ReplaceTags($" Private message sent!"));
@@ -2008,8 +1881,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
Helper.PrintToCenterAll(Helper.ReplaceTags(utf8String));
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"CSAY: {caller!.PlayerName}: {utf8String}");
}
[ConsoleCommand("css_hsay", "Say to all players (in hud).")]
@@ -2024,9 +1895,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
HudDestination.Alert,
Helper.ReplaceTags(utf8String),
0, 0, 0, 0);
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"HSAY: {caller!.PlayerName}: {utf8String}");
}
[ConsoleCommand("css_noclip", "Noclip a player.")]
@@ -2048,11 +1916,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_noclip_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_noclip_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -2083,11 +1946,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_freeze_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_freeze_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
}
});
@@ -2110,11 +1968,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_unfreeze_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
if (Config.DiscordWebhook.Length > 0)
{
LocalizedString localizedMessage = _localizer["sa_admin_unfreeze_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
@@ -2131,12 +1984,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
if (CBasePlayerController_SetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return;
var playerPawn = player.PlayerPawn.Value;
CBasePlayerController_SetPawnFunc.Invoke(player, playerPawn, true, false);
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
player!.Respawn();
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
{
@@ -2144,12 +1992,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
sb.Append(_localizer["sa_admin_respawn_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
Server.PrintToChatAll(sb.ToString());
}
if (Config.DiscordWebhook.Length > 0 && _localizer != null)
{
LocalizedString localizedMessage = _localizer["sa_admin_respawn_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName];
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
}
}
});
}
@@ -2180,8 +2022,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
command.ReplyToCommand($"{playerName} changed cvar {cvar.Name} to {value}.");
Logger.LogInformation($"{playerName} changed cvar {cvar.Name} to {value}.");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"{playerName} changed cvar {cvar.Name} to {value}.");
}
[ConsoleCommand("css_rcon", "Run a server console command.")]
@@ -2193,8 +2033,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
Server.ExecuteCommand(command.ArgString);
command.ReplyToCommand($"{playerName} executed command {command.ArgString}.");
Logger.LogInformation($"{playerName} executed command ({command.ArgString}).");
if (Config.DiscordWebhook.Length > 0)
_ = SendWebhookMessage($"{playerName} executed command ({command.ArgString}).");
}
private static TargetResult? GetTarget(CommandInfo command)
@@ -2215,21 +2053,22 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
command.ReplyToCommand($"Multiple targets found for \"{command.GetArg(1)}\".");
return null;
/*
var matches = Helper.GetTarget(command.GetArg(1), out player);
switch (matches)
{
case TargetResult.None:
command.ReplyToCommand($"Target {command.GetArg(1)} not found.");
return false;
case TargetResult.Multiple:
command.ReplyToCommand($"Multiple targets found for \"{command.GetArg(1)}\".");
return false;
}
public async Task SendWebhookMessage(string message)
{
using (var httpClient = new HttpClient())
{
var payload = new
{
content = message
};
var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload);
var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
var response = await httpClient.PostAsync(Config.DiscordWebhook, content);
}
return true;
*/
}
}