Fix? for messages

This commit is contained in:
Dawid Bepierszcz 2024-02-12 14:11:34 +01:00
parent b1e497ea3f
commit d8e8073dd6
7 changed files with 118 additions and 118 deletions

View file

@ -16,7 +16,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnBanCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.ArgCount < 2)
return;
@ -34,7 +34,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Database database = new Database(dbConnectionString);
@ -96,7 +96,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_ban_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -116,7 +116,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_ban_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -131,7 +131,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<steamid> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnAddBanCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.ArgCount < 2)
return;
if (string.IsNullOrEmpty(command.GetArg(1))) return;
@ -147,7 +147,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
string reason = "Unknown";
@ -197,7 +197,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_ban_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -218,7 +218,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_ban_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -243,7 +243,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<ip> [time in minutes/0 perm] [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnBanIp(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.ArgCount < 2)
return;
@ -260,7 +260,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
string reason = "Unknown";
@ -306,7 +306,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_ban_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -326,7 +326,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_ban_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_ban_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -353,7 +353,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<steamid or name or ip>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnUnbanCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.GetArg(1).Length <= 1)
{
command.ReplyToCommand($"Too short pattern to search.");
@ -363,7 +363,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
string pattern = command.GetArg(1);

View file

@ -19,12 +19,12 @@ namespace CS2_SimpleAdmin
public void OnAdminToAdminSayCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName= caller == null ? "Console" : caller.PlayerName;
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
@ -48,14 +48,14 @@ namespace CS2_SimpleAdmin
{
if (command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName= caller == null ? "Console" : caller.PlayerName;
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null)
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
@ -97,14 +97,14 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/chat")]
public void OnAdminCenterSayCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName= caller == null ? "Console" : caller.PlayerName;
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null)
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Helper.PrintToCenterAll(Helper.ReplaceTags(utf8String));
@ -115,14 +115,14 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/chat")]
public void OnAdminHudSayCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName= caller == null ? "Console" : caller.PlayerName;
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
if (_discordWebhookClientLog != null && _localizer != null)
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
VirtualFunctions.ClientPrintAll(

View file

@ -66,7 +66,7 @@ namespace CS2_SimpleAdmin
public void OnAddAdminCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (!Helper.IsValidSteamID64(command.GetArg(1)))
{
@ -87,7 +87,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
string steamid = command.GetArg(1);
@ -111,7 +111,7 @@ namespace CS2_SimpleAdmin
public void OnDelAdminCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (!Helper.IsValidSteamID64(command.GetArg(1)))
{
@ -122,7 +122,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
string steamid = command.GetArg(1);
@ -207,7 +207,7 @@ namespace CS2_SimpleAdmin
public void OnWhoCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@ -215,7 +215,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_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();
@ -333,7 +333,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name> [reason]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnKickCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
string reason = "Unknown";
TargetResult? targets = GetTarget(command);
@ -351,7 +351,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
if (command.ArgCount >= 2 && command.GetArg(2).Length > 0)
@ -390,7 +390,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_kick_message", playerName, reason]);
sb.Append(_localizer["sa_admin_kick_message", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -405,7 +405,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<mapname>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnMapCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
string _command = string.Empty;
string? map = command.GetCommandString.Split(" ")[1];
@ -423,7 +423,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
AddTimer(2.0f, () =>
@ -469,7 +469,7 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/changemap")]
public void OnWorkshopMapCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
string _command = string.Empty;
string? map = command.GetArg(1);
@ -498,7 +498,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
AddTimer(2.0f, () =>
@ -513,7 +513,7 @@ namespace CS2_SimpleAdmin
public void OnCvarCommand(CCSPlayerController? caller, CommandInfo command)
{
var cvar = ConVar.Find(command.GetArg(1));
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (cvar == null)
{
@ -530,15 +530,15 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
var value = command.GetArg(2);
Server.ExecuteCommand($"{cvar.Name} {value}");
command.ReplyToCommand($"{playerName} changed cvar {cvar.Name} to {value}.");
Logger.LogInformation($"{playerName} changed cvar {cvar.Name} to {value}.");
command.ReplyToCommand($"{callerName} changed cvar {cvar.Name} to {value}.");
Logger.LogInformation($"{callerName} changed cvar {cvar.Name} to {value}.");
}
[ConsoleCommand("css_rcon", "Run a server console command.")]
@ -546,17 +546,17 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/rcon")]
public void OnRconCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
Server.ExecuteCommand(command.ArgString);
command.ReplyToCommand($"{playerName} executed command {command.ArgString}.");
Logger.LogInformation($"{playerName} executed command ({command.ArgString}).");
command.ReplyToCommand($"{callerName} executed command {command.ArgString}.");
Logger.LogInformation($"{callerName} executed command ({command.ArgString}).");
}
}
}

View file

@ -18,7 +18,7 @@ namespace CS2_SimpleAdmin
public void OnGagCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
int time = 0;
string reason = "Unknown";
@ -35,7 +35,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
int.TryParse(command.GetArg(2), out time);
@ -91,7 +91,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_gag_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -114,7 +114,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_gag_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -130,7 +130,7 @@ namespace CS2_SimpleAdmin
public void OnAddGagCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.ArgCount < 2)
return;
@ -148,7 +148,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
int time = 0;
@ -196,7 +196,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_gag_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -217,7 +217,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_gag_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_gag_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -240,7 +240,7 @@ namespace CS2_SimpleAdmin
public void OnUngagCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.GetArg(1).Length <= 1)
{
@ -251,7 +251,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
bool found = false;
@ -337,7 +337,7 @@ namespace CS2_SimpleAdmin
public void OnMuteCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
int time = 0;
string reason = "Unknown";
@ -354,7 +354,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
int.TryParse(command.GetArg(2), out time);
@ -407,7 +407,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_mute_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -427,7 +427,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_mute_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -443,7 +443,7 @@ namespace CS2_SimpleAdmin
public void OnAddMuteCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.ArgCount < 2)
return;
@ -460,7 +460,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
int time = 0;
@ -509,7 +509,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_mute_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -529,7 +529,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_mute_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_mute_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -547,7 +547,7 @@ namespace CS2_SimpleAdmin
public void OnUnmuteCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.GetArg(1).Length <= 1)
{
@ -558,7 +558,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
string pattern = command.GetArg(1);
@ -633,7 +633,7 @@ namespace CS2_SimpleAdmin
public void OnSilenceCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
int time = 0;
string reason = "Unknown";
@ -650,7 +650,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
int.TryParse(command.GetArg(2), out time);
@ -706,7 +706,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_silence_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_silence_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -729,7 +729,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_silence_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_silence_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -745,7 +745,7 @@ namespace CS2_SimpleAdmin
public void OnAddSilenceCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.ArgCount < 2)
return;
@ -762,7 +762,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
int time = 0;
@ -814,7 +814,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_silence_message_perm", playerName, reason]);
sb.Append(_localizer["sa_admin_silence_message_perm", callerName, player.PlayerName, reason]);
_player.PrintToChat(sb.ToString());
}
}
@ -834,7 +834,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_silence_message_time", playerName, reason, time]);
sb.Append(_localizer["sa_admin_silence_message_time", callerName, player.PlayerName, reason, time]);
_player.PrintToChat(sb.ToString());
}
}
@ -852,7 +852,7 @@ namespace CS2_SimpleAdmin
public void OnUnsilenceCommand(CCSPlayerController? caller, CommandInfo command)
{
if (_database == null) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
if (command.GetArg(1).Length <= 1)
{
@ -863,7 +863,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
string pattern = command.GetArg(1);

View file

@ -16,14 +16,14 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 2, usage: "<question> [... options ...]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnVoteCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName= caller == null ? "Console" : caller.PlayerName;
if (command.GetArg(1) == null || command.GetArg(1).Length < 0 || command.ArgCount < 2)
return;
if (_discordWebhookClientLog != null && _localizer != null)
{
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
voteAnswers.Clear();

View file

@ -16,7 +16,7 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/cheats")]
public void OnNoclipCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
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();
@ -24,7 +24,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
playersToTarget.ForEach(player =>
@ -40,7 +40,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_noclip_message", playerName]);
sb.Append(_localizer["sa_admin_noclip_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -54,7 +54,7 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/slay")]
public void OnFreezeCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
int.TryParse(command.GetArg(2), out int time);
TargetResult? targets = GetTarget(command);
@ -63,7 +63,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
playersToTarget.ForEach(player =>
@ -85,7 +85,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_freeze_message", playerName]);
sb.Append(_localizer["sa_admin_freeze_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -99,7 +99,7 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/slay")]
public void OnUnfreezeCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.PawnIsAlive && !player.IsHLTV).ToList();
@ -107,7 +107,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
playersToTarget.ForEach(player =>
@ -124,7 +124,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_unfreeze_message", playerName]);
sb.Append(_localizer["sa_admin_unfreeze_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}

View file

@ -19,14 +19,14 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnSlayCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
if (targets == null) 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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_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.PawnIsAlive && !player.IsHLTV).ToList();
@ -46,7 +46,7 @@ namespace CS2_SimpleAdmin
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_slay_message", playerName]);
sb.Append(_localizer["sa_admin_slay_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -59,7 +59,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 2, usage: "<#userid or name> <weapon>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnGiveCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@ -93,7 +93,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
playersToTarget.ForEach(player =>
@ -110,7 +110,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_give_message", playerName, weaponName]);
sb.Append(_localizer["sa_admin_give_message", callerName, player.PlayerName, weaponName]);
_player.PrintToChat(sb.ToString());
}
}
@ -123,14 +123,14 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnStripCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
if (targets == null) 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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_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.PawnIsAlive && !player.IsHLTV).ToList();
@ -151,7 +151,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_strip_message", playerName]);
sb.Append(_localizer["sa_admin_strip_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -165,7 +165,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name> <health>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnHpCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
int health = 100;
int.TryParse(command.GetArg(2), out health);
@ -175,7 +175,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_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.PawnIsAlive && !player.IsHLTV).ToList();
@ -196,7 +196,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_hp_message", playerName]);
sb.Append(_localizer["sa_admin_hp_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -210,7 +210,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name> <speed>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnSpeedCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
double speed = 1.0;
double.TryParse(command.GetArg(2), out speed);
@ -220,7 +220,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_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.PawnIsAlive && !player.IsHLTV).ToList();
@ -246,7 +246,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_speed_message", playerName]);
sb.Append(_localizer["sa_admin_speed_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -260,14 +260,14 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnGodCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
if (targets == null) 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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_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.PawnIsAlive && !player.IsHLTV).ToList();
@ -298,7 +298,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_god_message", playerName]);
sb.Append(_localizer["sa_admin_god_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -313,7 +313,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 1, usage: "<#userid or name> [damage]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnSlapCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
int damage = 0;
TargetResult? targets = GetTarget(command);
@ -322,7 +322,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_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.PawnIsAlive && !player.IsHLTV).ToList();
@ -348,7 +348,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_slap_message", playerName]);
sb.Append(_localizer["sa_admin_slap_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -362,7 +362,7 @@ namespace CS2_SimpleAdmin
[CommandHelper(minArgs: 2, usage: "<#userid or name> [<ct/tt/spec>] [-k]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnTeamCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
string teamName = command.GetArg(2).ToLower();
string _teamName;
CsTeam teamNum = CsTeam.Spectator;
@ -373,7 +373,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_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.IsHLTV).ToList();
@ -439,7 +439,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_team_message", playerName, _teamName]);
sb.Append(_localizer["sa_admin_team_message", callerName, player.PlayerName, _teamName]);
_player.PrintToChat(sb.ToString());
}
}
@ -452,7 +452,7 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/kick")]
public void OnRenameCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
string? newName = command.GetArg(2);
if (string.IsNullOrEmpty(newName))
@ -464,7 +464,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
playersToTarget.ForEach(player =>
@ -483,7 +483,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_rename_message", playerName]);
sb.Append(_localizer["sa_admin_rename_message", callerName, player.PlayerName, newName]);
_player.PrintToChat(sb.ToString());
}
}
@ -497,7 +497,7 @@ namespace CS2_SimpleAdmin
[RequiresPermissions("@css/cheats")]
public void OnRespawnCommand(CCSPlayerController? caller, CommandInfo command)
{
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
@ -505,7 +505,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
playersToTarget.ForEach(player =>
@ -529,7 +529,7 @@ namespace CS2_SimpleAdmin
using (new WithTemporaryCulture(_player.GetLanguage()))
{
StringBuilder sb = new(_localizer!["sa_prefix"]);
sb.Append(_localizer["sa_admin_respawn_message", playerName]);
sb.Append(_localizer["sa_admin_respawn_message", callerName, player.PlayerName]);
_player.PrintToChat(sb.ToString());
}
}
@ -548,7 +548,7 @@ namespace CS2_SimpleAdmin
{
if (caller == null || !caller.PawnIsAlive) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
@ -560,7 +560,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
playersToTarget.ForEach(player =>
@ -602,7 +602,7 @@ namespace CS2_SimpleAdmin
{
if (caller == null || !caller.PawnIsAlive) return;
string playerName = caller == null ? "Console" : caller.PlayerName;
string callerName = caller == null ? "Console" : caller.PlayerName;
TargetResult? targets = GetTarget(command);
@ -614,7 +614,7 @@ namespace CS2_SimpleAdmin
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", $"[{playerName}]({communityUrl})", command.GetCommandString]));
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
}
playersToTarget.ForEach(player =>