Merge pull request #94 from dollannn/main

Feature: Penalty embed
This commit is contained in:
Dawid Bepierszcz
2024-04-02 19:57:22 +02:00
committed by GitHub
21 changed files with 509 additions and 332 deletions

View File

@@ -38,7 +38,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin"; public override string ModuleName => "CS2-SimpleAdmin";
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)"; public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy & Dliix66"; 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(); public CS2_SimpleAdminConfig Config { get; set; } = new();

View File

@@ -1,10 +1,9 @@
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Core.Translations;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Commands.Targeting; using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Entities;
using System.Text; using System.Text;
namespace CS2_SimpleAdmin namespace CS2_SimpleAdmin
@@ -20,7 +19,7 @@ namespace CS2_SimpleAdmin
if (command.ArgCount < 2) if (command.ArgCount < 2)
return; return;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; string reason = _localizer?["sa_unknown"] ?? "Unknown";
TargetResult? targets = GetTarget(command); TargetResult? targets = GetTarget(command);
if (targets == null) return; if (targets == null) return;
@@ -31,8 +30,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
Database database = new Database(dbConnectionString); Database database = new(dbConnectionString);
BanManager _banManager = new(database, Config); BanManager _banManager = new(database, Config);
int.TryParse(command.GetArg(2), out int time); int.TryParse(command.GetArg(2), out int time);
@@ -44,12 +42,12 @@ namespace CS2_SimpleAdmin
{ {
if (caller!.CanTarget(player)) 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; if (_database == null) return;
@@ -74,10 +72,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0] IpAddress = caller?.IpAddress?.Split(":")[0]
}; };
string commandName = $"css_ban {player.SteamID} {time} {reason}";
Helper.LogCommand(caller, commandName);
Helper.TryLogCommandOnDiscord(caller, commandName);
Task.Run(async () => Task.Run(async () =>
{ {
banManager ??= new BanManager(_database, Config); 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")] [ConsoleCommand("css_addban")]
@@ -154,16 +155,9 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null) string reason = _localizer?["sa_unknown"] ?? "Unknown";
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_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);
Database database = new(dbConnectionString);
BanManager _banManager = new(database, Config); BanManager _banManager = new(database, Config);
int.TryParse(command.GetArg(2), out int time); int.TryParse(command.GetArg(2), out int time);
@@ -178,8 +172,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0] IpAddress = caller?.IpAddress?.Split(":")[0]
}; };
Helper.LogCommand(caller, command);
List<CCSPlayerController> matches = Helper.GetPlayerFromSteamid64(steamid); List<CCSPlayerController> matches = Helper.GetPlayerFromSteamid64(steamid);
if (matches.Count == 1) 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 () => Task.Run(async () =>
@@ -246,7 +240,14 @@ namespace CS2_SimpleAdmin
await _banManager.AddBanBySteamid(steamid, adminInfo, reason, time); 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")] [ConsoleCommand("css_banip")]
@@ -269,13 +270,9 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; string reason = _localizer?["sa_unknown"] ?? "Unknown";
PlayerInfo adminInfo = new PlayerInfo PlayerInfo adminInfo = new PlayerInfo
{ {
@@ -284,8 +281,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0] IpAddress = caller?.IpAddress?.Split(":")[0]
}; };
Helper.LogCommand(caller, command);
int.TryParse(command.GetArg(2), out int time); int.TryParse(command.GetArg(2), out int time);
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0) if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
@@ -348,8 +343,14 @@ namespace CS2_SimpleAdmin
} }
if (player.UserId.HasValue) 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 () => Task.Run(async () =>
@@ -358,7 +359,13 @@ namespace CS2_SimpleAdmin
await _banManager.AddBanByIp(ipAddress, adminInfo, reason, time); 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")] [ConsoleCommand("css_unban")]
@@ -375,19 +382,14 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null)
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command);
string pattern = command.GetArg(1); string pattern = command.GetArg(1);
BanManager _banManager = new BanManager(_database, Config); BanManager _banManager = new(_database, Config);
Task.Run(async () => await _banManager.UnbanPlayer(pattern)); Task.Run(async () => await _banManager.UnbanPlayer(pattern));
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
command.ReplyToCommand($"Unbanned player with pattern {pattern}."); command.ReplyToCommand($"Unbanned player with pattern {pattern}.");
} }
} }

View File

@@ -4,7 +4,6 @@ using CounterStrikeSharp.API.Core.Translations;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Commands.Targeting; using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using System.Text; using System.Text;
@@ -21,12 +20,7 @@ namespace CS2_SimpleAdmin
if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return; if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return;
string callerName = caller == null ? "Console" : caller.PlayerName; string callerName = caller == null ? "Console" : caller.PlayerName;
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); 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(' ')..]); byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString); string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
foreach (CCSPlayerController _player in Helper.GetValidPlayers()) foreach (CCSPlayerController _player in Helper.GetValidPlayers())
@@ -84,7 +73,7 @@ namespace CS2_SimpleAdmin
if (targets == null) return; if (targets == null) return;
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList(); List<CCSPlayerController> 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; int range = command.GetArg(0).Length + command.GetArg(1).Length + 2;
string message = command.GetCommandString[range..]; string message = command.GetCommandString[range..];
@@ -109,12 +98,7 @@ namespace CS2_SimpleAdmin
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString); string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.PrintToCenterAll(StringExtensions.ReplaceColorTags(utf8String)); Helper.PrintToCenterAll(StringExtensions.ReplaceColorTags(utf8String));
@@ -129,12 +113,7 @@ namespace CS2_SimpleAdmin
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString); string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
VirtualFunctions.ClientPrintAll( VirtualFunctions.ClientPrintAll(

View File

@@ -1,4 +1,4 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Core.Translations;
@@ -131,7 +131,7 @@ namespace CS2_SimpleAdmin
int time = 0; int time = 0;
int.TryParse(command.GetArg(5), out time); 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) 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); AdminSQLManager _adminManager = new(_database);
_ = _adminManager.AddAdminBySteamId(steamid, name, flags, immunity, time, globalAdmin); _ = _adminManager.AddAdminBySteamId(steamid, name, flags, immunity, time, globalAdmin);
string commandName = $"css_addadmin {steamid} {name} {flags} {immunity} {time}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, $"css_addadmin {steamid} {name} {flags} {immunity} {time}");
string msg = $"Added '{flags}' flags to '{name}' ({steamid})"; string msg = $"Added '{flags}' flags to '{name}' ({steamid})";
if (command != null) if (command != null)
@@ -170,7 +170,7 @@ namespace CS2_SimpleAdmin
string steamid = command.GetArg(1); string steamid = command.GetArg(1);
bool globalDelete = command.GetArg(2).ToLower().Equals("-g"); 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) 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); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
string commandName = $"css_deladmin {steamid}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, $"css_deladmin {steamid}");
string msg = $"Removed flags from '{steamid}'"; string msg = $"Removed flags from '{steamid}'";
if (command != null) if (command != null)
@@ -222,9 +222,6 @@ namespace CS2_SimpleAdmin
{ {
if (_database == null) return; if (_database == null) return;
string commandName = "css_reladmin";
Helper.TryLogCommandOnDiscord(caller, commandName);
foreach (SteamID steamId in AdminSQLManager._adminCache.Keys.ToList()) foreach (SteamID steamId in AdminSQLManager._adminCache.Keys.ToList())
{ {
if (AdminSQLManager._adminCache.TryRemove(steamId, out _)) if (AdminSQLManager._adminCache.TryRemove(steamId, out _))
@@ -280,11 +277,8 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command); TargetResult? targets = GetTarget(command);
if (targets == null) return; if (targets == null) return;
if (_discordWebhookClientLog != null && _localizer != null) Helper.LogCommand(caller, command);
{ //Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList(); List<CCSPlayerController> 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) public void OnKickCommand(CCSPlayerController? caller, CommandInfo command)
{ {
string callerName = caller == null ? "Console" : caller.PlayerName; 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); TargetResult? targets = GetTarget(command);
@@ -402,12 +396,12 @@ namespace CS2_SimpleAdmin
if (caller!.CanTarget(player)) 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; callerName ??= caller == null ? "Console" : caller.PlayerName;
if (player.PawnIsAlive) if (player.PawnIsAlive)
@@ -415,11 +409,11 @@ namespace CS2_SimpleAdmin
player.Pawn.Value!.Freeze(); player.Pawn.Value!.Freeze();
} }
reason = reason ?? CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; reason = reason ?? _localizer?["sa_unknown"] ?? "Unknown";
string commandName = $"css_kick {player.PlayerName} {reason}"; if (command != null)
Helper.LogCommand(caller, commandName); Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.TryLogCommandOnDiscord(caller, commandName); Helper.LogCommand(caller, $"css_kick {player.PlayerName} {reason}");
if (string.IsNullOrEmpty(reason) == false) if (string.IsNullOrEmpty(reason) == false)
{ {
@@ -479,12 +473,7 @@ namespace CS2_SimpleAdmin
_command = $"ds_workshop_changelevel {map.Replace("ws:", "")}"; _command = $"ds_workshop_changelevel {map.Replace("ws:", "")}";
} }
string commandName = command?.GetCommandString ?? $"css_changewsmap {map}"; AddTimer(3.0f, () =>
Helper.TryLogCommandOnDiscord(caller, commandName);
if (command is not null)
Helper.LogCommand(caller, command);
AddTimer(2.0f, () =>
{ {
Server.ExecuteCommand(_command); Server.ExecuteCommand(_command);
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
@@ -502,6 +491,11 @@ namespace CS2_SimpleAdmin
Server.PrintToConsole(msg); Server.PrintToConsole(msg);
return; 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)) 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.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.TryLogCommandOnDiscord(caller, commandName); Helper.LogCommand(caller, command);
AddTimer(2.0f, () =>
{
Server.ExecuteCommand($"changelevel {map}");
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
} }
} }
@@ -569,15 +558,16 @@ namespace CS2_SimpleAdmin
} }
} }
string commandName = command?.GetCommandString ?? $"css_changewsmap {map}"; AddTimer(3.0f, () =>
Helper.TryLogCommandOnDiscord(caller, commandName);
if (command is not null)
Helper.LogCommand(caller, command);
AddTimer(2.0f, () =>
{ {
Server.ExecuteCommand(_command); Server.ExecuteCommand(_command);
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, 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.")] [ConsoleCommand("css_cvar", "Change a cvar.")]
@@ -600,12 +590,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
var value = command.GetArg(2); var value = command.GetArg(2);
@@ -623,12 +608,7 @@ namespace CS2_SimpleAdmin
{ {
string callerName = caller == null ? "Console" : caller.PlayerName; string callerName = caller == null ? "Console" : caller.PlayerName;
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Server.ExecuteCommand(command.ArgString); Server.ExecuteCommand(command.ArgString);
@@ -649,13 +629,10 @@ namespace CS2_SimpleAdmin
public static void RestartGame(CCSPlayerController? admin) public static void RestartGame(CCSPlayerController? admin)
{ {
Helper.LogCommand(admin, "css_restartgame");
// TODO: Localize // TODO: Localize
string name = admin == null ? "Console" : admin.PlayerName; var name = admin == null ? "Console" : admin.PlayerName;
string commandName = "css_restartgame";
Helper.TryLogCommandOnDiscord(admin, commandName);
Helper.LogCommand(admin, commandName);
Server.PrintToChatAll($"[SA] {name}: Restarting game..."); Server.PrintToChatAll($"[SA] {name}: Restarting game...");
Server.ExecuteCommand("mp_restartgame 2"); Server.ExecuteCommand("mp_restartgame 2");
} }

View File

@@ -1,11 +1,10 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Core.Translations;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Commands.Targeting; using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Entities;
using System.Text; using System.Text;
namespace CS2_SimpleAdmin namespace CS2_SimpleAdmin
@@ -21,7 +20,7 @@ namespace CS2_SimpleAdmin
string callerName = caller == null ? "Console" : caller.PlayerName; string callerName = caller == null ? "Console" : caller.PlayerName;
int time = 0; int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; string reason = _localizer?["sa_unknown"] ?? "Unknown";
TargetResult? targets = GetTarget(command); TargetResult? targets = GetTarget(command);
if (targets == null) return; if (targets == null) return;
@@ -44,12 +43,12 @@ namespace CS2_SimpleAdmin
{ {
if (caller!.CanTarget(player)) 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; if (_database == null) return;
callerName ??= caller == null ? "Console" : caller.PlayerName; callerName ??= caller == null ? "Console" : caller.PlayerName;
@@ -70,10 +69,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0] IpAddress = caller?.IpAddress?.Split(":")[0]
}; };
string commandName = $"css_gag {player?.SteamID} {time} {reason}";
Helper.LogCommand(caller, commandName);
Helper.TryLogCommandOnDiscord(caller, commandName);
Task.Run(async () => Task.Run(async () =>
{ {
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time); await muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
@@ -83,7 +78,6 @@ namespace CS2_SimpleAdmin
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}"); Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time); playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time);
if (time == 0) if (time == 0)
{ {
if (!player!.IsBot && !player.IsHLTV) 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")] [ConsoleCommand("css_addgag")]
@@ -153,14 +154,8 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null)
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
int time = 0; int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; string reason = _localizer?["sa_unknown"] ?? "Unknown";
MuteManager _muteManager = new(_database); MuteManager _muteManager = new(_database);
PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager(); PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager();
@@ -177,8 +172,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0] IpAddress = caller?.IpAddress?.Split(":")[0]
}; };
Helper.LogCommand(caller, command);
List<CCSPlayerController> matches = Helper.GetPlayerFromSteamid64(steamid); List<CCSPlayerController> matches = Helper.GetPlayerFromSteamid64(steamid);
if (matches.Count == 1) if (matches.Count == 1)
{ {
@@ -239,6 +232,8 @@ namespace CS2_SimpleAdmin
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time); 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 () => Task.Run(async () =>
@@ -246,7 +241,13 @@ namespace CS2_SimpleAdmin
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 0); 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")] [ConsoleCommand("css_ungag")]
@@ -265,12 +266,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
bool found = false; bool found = false;
@@ -372,7 +368,7 @@ namespace CS2_SimpleAdmin
string callerName = caller == null ? "Console" : caller.PlayerName; string callerName = caller == null ? "Console" : caller.PlayerName;
int time = 0; int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; string reason = _localizer?["sa_unknown"] ?? "Unknown";
TargetResult? targets = GetTarget(command); TargetResult? targets = GetTarget(command);
if (targets == null) return; if (targets == null) return;
@@ -395,12 +391,12 @@ namespace CS2_SimpleAdmin
{ {
if (caller!.CanTarget(player)) 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; if (_database == null) return;
callerName ??= caller == null ? "Console" : caller.PlayerName; callerName ??= caller == null ? "Console" : caller.PlayerName;
@@ -421,10 +417,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0] 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; player!.VoiceFlags = VoiceFlags.Muted;
Task.Run(async () => Task.Run(async () =>
@@ -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")] [ConsoleCommand("css_addmute")]
@@ -497,16 +496,8 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null)
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command);
int time = 0; int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; string reason = _localizer?["sa_unknown"] ?? "Unknown";
MuteManager _muteManager = new(_database); MuteManager _muteManager = new(_database);
PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager(); 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 () => Task.Run(async () =>
@@ -585,7 +578,13 @@ namespace CS2_SimpleAdmin
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 1); 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")] [ConsoleCommand("css_unmute")]
@@ -604,12 +603,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
string pattern = command.GetArg(1); string pattern = command.GetArg(1);
@@ -720,12 +714,12 @@ namespace CS2_SimpleAdmin
{ {
if (caller!.CanTarget(player)) 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; if (_database == null) return;
callerName ??= caller == null ? "Console" : caller.PlayerName; callerName ??= caller == null ? "Console" : caller.PlayerName;
@@ -746,10 +740,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0] IpAddress = caller?.IpAddress?.Split(":")[0]
}; };
string commandName = $"css_silence {player?.SteamID} {time} {reason}";
Helper.LogCommand(caller, commandName);
Helper.TryLogCommandOnDiscord(caller, commandName);
Task.Run(async () => Task.Run(async () =>
{ {
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2); await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2);
@@ -759,7 +749,6 @@ namespace CS2_SimpleAdmin
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}"); Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
player!.VoiceFlags = VoiceFlags.Muted; player!.VoiceFlags = VoiceFlags.Muted;
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time); playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time);
if (time == 0) 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")] [ConsoleCommand("css_addsilence")]
@@ -830,14 +826,6 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null)
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command);
int time = 0; int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; 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 () => Task.Run(async () =>
@@ -920,7 +910,13 @@ namespace CS2_SimpleAdmin
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 2); 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")] [ConsoleCommand("css_unsilence")]
@@ -939,12 +935,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
string pattern = command.GetArg(1); string pattern = command.GetArg(1);

View File

@@ -3,7 +3,6 @@ using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Core.Translations;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Menu; using CounterStrikeSharp.API.Modules.Menu;
using System.Text; using System.Text;
@@ -20,12 +19,7 @@ namespace CS2_SimpleAdmin
if (command.GetArg(1) == null || command.GetArg(1).Length < 0 || command.ArgCount < 2) if (command.GetArg(1) == null || command.GetArg(1).Length < 0 || command.ArgCount < 2)
return; return;
if (_discordWebhookClientLog != null && _localizer != null) Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
voteAnswers.Clear(); voteAnswers.Clear();

View File

@@ -1,10 +1,9 @@
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Core.Translations;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Commands.Targeting; using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Entities;
using System.Text; using System.Text;
namespace CS2_SimpleAdmin namespace CS2_SimpleAdmin
@@ -21,6 +20,8 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command); TargetResult? targets = GetTarget(command);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && player.PawnIsAlive && !player.IsHLTV).ToList(); List<CCSPlayerController> 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 => playersToTarget.ForEach(player =>
{ {
if (caller!.CanTarget(player)) if (caller!.CanTarget(player))
@@ -35,9 +36,7 @@ namespace CS2_SimpleAdmin
callerName ??= caller == null ? "Console" : caller.PlayerName; callerName ??= caller == null ? "Console" : caller.PlayerName;
player!.Pawn.Value!.ToggleNoclip(); player!.Pawn.Value!.ToggleNoclip();
string commandName = $"css_noclip {player.PlayerName}"; Helper.LogCommand(caller, $"css_noclip {player.PlayerName}");
Helper.TryLogCommandOnDiscord(caller, commandName);
Helper.LogCommand(caller, commandName);
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -64,6 +63,8 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command); TargetResult? targets = GetTarget(command);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList(); List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
{ {
if (!player.IsBot && player.SteamID.ToString().Length != 17) if (!player.IsBot && player.SteamID.ToString().Length != 17)
@@ -82,9 +83,7 @@ namespace CS2_SimpleAdmin
player.Pawn.Value!.Freeze(); player.Pawn.Value!.Freeze();
string commandName = $"css_freeze {player.PlayerName}"; Helper.LogCommand(caller, $"css_freeze {player.PlayerName}");
Helper.TryLogCommandOnDiscord(caller, commandName);
Helper.LogCommand(caller, commandName);
if (time > 0) if (time > 0)
AddTimer(time, () => player.Pawn.Value!.Unfreeze(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); 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) if (!player.IsBot && player.SteamID.ToString().Length != 17)
return; 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; callerName ??= caller == null ? "Console" : caller.PlayerName;
player!.Pawn.Value!.Unfreeze(); player!.Pawn.Value!.Unfreeze();
string commandName = $"css_unfreeze {player.PlayerName}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); {
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {

View File

@@ -1,10 +1,9 @@
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Core.Translations; using CounterStrikeSharp.API.Core.Translations;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Commands.Targeting; using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
@@ -27,11 +26,11 @@ namespace CS2_SimpleAdmin
playersToTarget.ForEach(player => 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) if (!player.IsBot && player.SteamID.ToString().Length != 17)
return; return;
@@ -40,9 +39,11 @@ namespace CS2_SimpleAdmin
player.CommitSuicide(false, true); player.CommitSuicide(false, true);
string commandName = $"css_slay {player.PlayerName}"; if (command != null)
Helper.LogCommand(caller, commandName); {
Helper.TryLogCommandOnDiscord(caller, commandName); Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -99,7 +100,7 @@ namespace CS2_SimpleAdmin
if (!player.IsBot && player.SteamID.ToString().Length != 17) if (!player.IsBot && player.SteamID.ToString().Length != 17)
return; 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); 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); player?.GiveNamedItem(weaponName);
SubGiveWeapon(caller, player!, weaponName, callerName); SubGiveWeapon(caller, player!, weaponName, callerName);
@@ -123,10 +128,6 @@ namespace CS2_SimpleAdmin
{ {
callerName ??= caller == null ? "Console" : caller.PlayerName; 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)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
foreach (CCSPlayerController _player in Helper.GetValidPlayers()) foreach (CCSPlayerController _player in Helper.GetValidPlayers())
@@ -156,12 +157,12 @@ namespace CS2_SimpleAdmin
{ {
if (caller!.CanTarget(player)) 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; callerName ??= caller == null ? "Console" : caller.PlayerName;
@@ -170,9 +171,11 @@ namespace CS2_SimpleAdmin
player.RemoveWeapons(); player.RemoveWeapons();
string commandName = $"css_strip {player.PlayerName}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); {
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -206,12 +209,12 @@ namespace CS2_SimpleAdmin
{ {
if (caller!.CanTarget(player)) 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) if (!player.IsBot && player.SteamID.ToString().Length != 17)
return; return;
@@ -220,9 +223,11 @@ namespace CS2_SimpleAdmin
player.SetHp(health); player.SetHp(health);
string commandName = $"css_hp {player.PlayerName} {health}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); {
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -259,20 +264,22 @@ namespace CS2_SimpleAdmin
if (caller!.CanTarget(player)) 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; callerName ??= caller == null ? "Console" : caller.PlayerName;
player.SetSpeed((float)speed); player.SetSpeed((float)speed);
string commandName = $"css_speed {player?.PlayerName} {speed}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); {
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -300,6 +307,8 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command); TargetResult? targets = GetTarget(command);
if (targets == null) return; if (targets == null) return;
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList(); List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
@@ -309,20 +318,22 @@ namespace CS2_SimpleAdmin
if (caller!.CanTarget(player)) 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; callerName ??= caller == null ? "Console" : caller.PlayerName;
player.SetGravity((float)gravity); player.SetGravity((float)gravity);
string commandName = $"css_gravity {player?.PlayerName} {gravity}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); {
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -359,20 +370,22 @@ namespace CS2_SimpleAdmin
if (caller!.CanTarget(player)) 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; callerName ??= caller == null ? "Console" : caller.PlayerName;
player.SetMoney(money); player.SetMoney(money);
string commandName = $"css_money {player?.PlayerName} {money}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); {
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -406,40 +419,42 @@ namespace CS2_SimpleAdmin
if (caller!.CanTarget(player)) 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; callerName ??= caller == null ? "Console" : caller.PlayerName;
if (player == null || player.IsValid == false) if (player != null)
return;
string commandName = $"css_god {player.PlayerName}";
Helper.TryLogCommandOnDiscord(caller, commandName);
Helper.LogCommand(caller, callerName);
if (!godPlayers.Contains(player.Slot))
{ {
godPlayers.Add(player.Slot); if (command != null)
}
else
{
RemoveFromConcurrentBag(godPlayers, player.Slot);
}
if (caller == null || !silentPlayers.Contains(caller.Slot))
{
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
{ {
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"]); using (new WithTemporaryCulture(_player.GetLanguage()))
sb.Append(_localizer["sa_admin_god_message", callerName, player.PlayerName]); {
_player.PrintToChat(sb.ToString()); 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)) 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); player!.Pawn.Value!.Slap(damage);
string commandName = $"css_slap {player.PlayerName} {damage}"; if (command != null)
Helper.LogCommand(caller, callerName); {
Helper.TryLogCommandOnDiscord(caller, commandName); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -540,23 +557,18 @@ namespace CS2_SimpleAdmin
bool kill = command.GetArg(3).ToLower().Equals("-k"); bool kill = command.GetArg(3).ToLower().Equals("-k");
Helper.LogCommand(caller, command);
playersToTarget.ForEach(player => 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) if (!player.IsBot && player.SteamID.ToString().Length != 17)
return; return;
callerName ??= caller == null ? "Console" : caller.PlayerName; 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")) 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.")] [ConsoleCommand("css_rename", "Rename a player.")]
@@ -610,13 +628,8 @@ namespace CS2_SimpleAdmin
TargetResult? targets = GetTarget(command); TargetResult? targets = GetTarget(command);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList(); List<CCSPlayerController> 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() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
{ {
@@ -625,7 +638,6 @@ namespace CS2_SimpleAdmin
if (caller!.CanTarget(player)) if (caller!.CanTarget(player))
{ {
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
foreach (CCSPlayerController _player in Helper.GetValidPlayers()) foreach (CCSPlayerController _player in Helper.GetValidPlayers())
@@ -661,25 +673,27 @@ namespace CS2_SimpleAdmin
if (caller!.CanTarget(player)) 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; callerName ??= caller == null ? "Console" : caller.PlayerName;
if (CBasePlayerController_SetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return; 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); CBasePlayerController_SetPawnFunc.Invoke(player, playerPawn, true, false);
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle, VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
GameData.GetOffset("CCSPlayerController_Respawn"))(player); GameData.GetOffset("CCSPlayerController_Respawn"))(player);
string commandName = $"css_respawn {player.PlayerName}"; if (command != null)
Helper.TryLogCommandOnDiscord(caller, commandName); {
Helper.LogCommand(caller, commandName); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
}
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot)) if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
{ {
@@ -713,13 +727,8 @@ namespace CS2_SimpleAdmin
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList(); List<CCSPlayerController> 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() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
{ {
@@ -769,14 +778,8 @@ namespace CS2_SimpleAdmin
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList(); List<CCSPlayerController> 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() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
{ {

View File

@@ -87,7 +87,6 @@ public partial class CS2_SimpleAdmin
} }
} }
[GameEventHandler] [GameEventHandler]
public HookResult OnPlayerFullConnect(EventPlayerConnectFull @event, GameEventInfo info) public HookResult OnPlayerFullConnect(EventPlayerConnectFull @event, GameEventInfo info)
{ {
@@ -226,10 +225,13 @@ public partial class CS2_SimpleAdmin
public HookResult OnCommandSay(CCSPlayerController? player, CommandInfo info) 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) || info.GetArg(1).StartsWith("!") && info.GetArg(1).Length >= 12)
return HookResult.Continue; return HookResult.Continue;
if (info.GetArg(1).Length == 0)
return HookResult.Handled;
PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager(); PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager();
if (playerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag) || playerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Silence)) 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) 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) || info.GetArg(1).StartsWith("!") && info.GetArg(1).Length >= 12)
return HookResult.Continue; return HookResult.Continue;
if (info.GetArg(1).Length == 0)
return HookResult.Handled;
PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager(); PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager();
if (playerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag) || playerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Silence)) 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, () => AddTimer(61.0f, () =>
{ {
#if DEBUG #if DEBUG
Logger.LogCritical("[OnMapStart] Expired check"); Logger.LogCritical("[OnMapStart] Expired check");
#endif #endif
@@ -407,7 +411,6 @@ public partial class CS2_SimpleAdmin
await _adminManager.GiveAllFlags(); await _adminManager.GiveAllFlags();
}); });
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
AddTimer(3.0f, () => AddTimer(3.0f, () =>

View File

@@ -7,6 +7,8 @@ using CounterStrikeSharp.API.Modules.Entities;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Menu; using CounterStrikeSharp.API.Modules.Menu;
using Discord; using Discord;
using Discord.Webhook;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@@ -196,6 +198,88 @@ namespace CS2_SimpleAdmin
return new List<Embed> { embed.Build() }; return new List<Embed> { 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() + ">" : "<https://steamcommunity.com/profiles/0>";
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() + ">" : "<https://steamcommunity.com/profiles/0>";
string targetcommunityUrl = target != null ? "<" + new SteamID(target.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
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) public static string GenerateMessageDiscord(string message)
{ {
string? hostname = ConVar.Find("hostname")!.StringValue ?? CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown"; string? hostname = ConVar.Find("hostname")!.StringValue ?? CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "مجهول", "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_time": "تم حظرك لمدة {lightred}{0}{default} لمدة {lightred}{1}{default} دقيقة من قبل {lightred}{2}{default}!",
"sa_player_ban_message_perm": "تم حظرك بشكل دائم لمدة {lightred}{0}{default} من قبل {lightred}{1}{default}!", "sa_player_ban_message_perm": "تم حظرك بشكل دائم لمدة {lightred}{0}{default} من قبل {lightred}{1}{default}!",
"sa_player_kick_message": "تم طردك لمدة {lightred}{0}{default} من قبل {lightred}{1}{default}!", "sa_player_kick_message": "تم طردك لمدة {lightred}{0}{default} من قبل {lightred}{1}{default}!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "Unknown", "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_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_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}!", "sa_player_kick_message": "You have been kicked for {lightred}{0}{default} by {lightred}{1}{default}!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "Desconocido", "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_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_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}!", "sa_player_kick_message": "Has sido expulsado por {lightred}{0}{default} durante {lightred}{1}{default}!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "ناشناخته", "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_time": "شما توسط {lightred}{2}{default} برای {lightred}{1}{default} دقیقه به دلیل {lightred}{0}{default} مسدود شده‌اید!",
"sa_player_ban_message_perm": "شما توسط {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} اخراج شده‌اید!", "sa_player_kick_message": "شما توسط {lightred}{1}{default} به دلیل {lightred}{0}{default} اخراج شده‌اید!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "Inconnu", "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_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_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}!", "sa_player_kick_message": "Vous avez été expulsé pour {lightred}{0}{default} par {lightred}{1}{default}!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "Nezināms", "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_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_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}!", "sa_player_kick_message": "Tu esi izmests, iemesls: {lightred}{0}{default}, Admins: {lightred}{1}{default}!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "Brak", "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_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_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}!", "sa_player_kick_message": "Zostałeś wyrzucony za {lightred}{0}{default} przez {lightred}{1}{default}!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "Desconhecido", "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_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_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}!", "sa_player_kick_message": "Você foi expulso por {lightred}{0}{default} por {lightred}{1}{default}!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "Неизвестный", "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_time": "Вы были забанены по причине {lightred}{0}{default} на {lightred}{1}{default} минут(ы) администратором {lightred}{2}{default}!",
"sa_player_ban_message_perm": "Вас забанили навсегда по причине {lightred}{0}{default} администратором {lightred}{1}{default}!", "sa_player_ban_message_perm": "Вас забанили навсегда по причине {lightred}{0}{default} администратором {lightred}{1}{default}!",
"sa_player_kick_message": "Вы были выгнаны {lightred}{0}{default} администратором {lightred}{1}{default}!", "sa_player_kick_message": "Вы были выгнаны {lightred}{0}{default} администратором {lightred}{1}{default}!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "Bilinmeyen", "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_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_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!", "sa_player_kick_message": "Senaryo nedeniyle {lightred}{0}{default} tarafından atıldınız!",

View File

@@ -2,6 +2,19 @@
"sa_prefix": "{lightred}[SA] {default}", "sa_prefix": "{lightred}[SA] {default}",
"sa_unknown": "未知", "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_time": "你因为{lightred}{0}{default}的原因被{lightred}{1}{default}禁止{lightred}{2}{default}分钟!",
"sa_player_ban_message_perm": "你因为{lightred}{0}{default}的原因被{lightred}{1}{default}永久禁止!", "sa_player_ban_message_perm": "你因为{lightred}{0}{default}的原因被{lightred}{1}{default}永久禁止!",
"sa_player_kick_message": "你因为{lightred}{0}{default}的原因被{lightred}{1}{default}踢出!", "sa_player_kick_message": "你因为{lightred}{0}{default}的原因被{lightred}{1}{default}踢出!",