mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-18 02:41:55 +00:00
Added translation
- Minor changes - Version bump - Added translation
This commit is contained in:
@@ -4,7 +4,6 @@ using CounterStrikeSharp.API.Core.Translations;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using System.Text;
|
||||
|
||||
namespace CS2_SimpleAdmin
|
||||
@@ -20,7 +19,7 @@ namespace CS2_SimpleAdmin
|
||||
if (command.ArgCount < 2)
|
||||
return;
|
||||
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
TargetResult? targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
@@ -31,10 +30,7 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Database database = new Database(dbConnectionString);
|
||||
|
||||
Database database = new(dbConnectionString);
|
||||
BanManager _banManager = new(database, Config);
|
||||
|
||||
int.TryParse(command.GetArg(2), out int time);
|
||||
@@ -46,12 +42,12 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
Ban(caller, player, time, reason, callerName, _banManager);
|
||||
Ban(caller, player, time, reason, callerName, _banManager, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
internal void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, BanManager? banManager = null)
|
||||
internal void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, BanManager? banManager = null, CommandInfo? command = null)
|
||||
{
|
||||
if (_database == null) return;
|
||||
|
||||
@@ -76,8 +72,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, $"css_ban {player.SteamID} {time} {reason}");
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
banManager ??= new BanManager(_database, Config);
|
||||
@@ -133,6 +127,12 @@ 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);
|
||||
}
|
||||
|
||||
@@ -155,12 +155,9 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
Database database = new Database(dbConnectionString);
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
Database database = new(dbConnectionString);
|
||||
BanManager _banManager = new(database, Config);
|
||||
|
||||
int.TryParse(command.GetArg(2), out int time);
|
||||
@@ -175,8 +172,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
List<CCSPlayerController> matches = Helper.GetPlayerFromSteamid64(steamid);
|
||||
if (matches.Count == 1)
|
||||
{
|
||||
@@ -235,6 +230,7 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer);
|
||||
}
|
||||
|
||||
@@ -244,7 +240,14 @@ namespace CS2_SimpleAdmin
|
||||
await _banManager.AddBanBySteamid(steamid, adminInfo, reason, time);
|
||||
});
|
||||
|
||||
command.ReplyToCommand($"Banned player with steamid {steamid}.");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
//Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer);
|
||||
|
||||
command?.ReplyToCommand($"Banned player with steamid {steamid}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_banip")]
|
||||
@@ -269,7 +272,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
PlayerInfo adminInfo = new PlayerInfo
|
||||
{
|
||||
@@ -278,8 +281,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
int.TryParse(command.GetArg(2), out int time);
|
||||
|
||||
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
|
||||
@@ -347,7 +348,6 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
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);
|
||||
@@ -359,7 +359,13 @@ namespace CS2_SimpleAdmin
|
||||
await _banManager.AddBanByIp(ipAddress, adminInfo, reason, time);
|
||||
});
|
||||
|
||||
command.ReplyToCommand($"Banned player with IP address {ipAddress}.");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
command?.ReplyToCommand($"Banned player with IP address {ipAddress}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unban")]
|
||||
@@ -376,15 +382,14 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
string pattern = command.GetArg(1);
|
||||
|
||||
BanManager _banManager = new BanManager(_database, Config);
|
||||
BanManager _banManager = new(_database, Config);
|
||||
Task.Run(async () => await _banManager.UnbanPlayer(pattern));
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
command.ReplyToCommand($"Unbanned player with pattern {pattern}.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using CounterStrikeSharp.API.Core.Translations;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Text;
|
||||
@@ -22,7 +21,6 @@ namespace CS2_SimpleAdmin
|
||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
byte[] utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
|
||||
@@ -51,7 +49,6 @@ namespace CS2_SimpleAdmin
|
||||
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -76,7 +73,7 @@ namespace CS2_SimpleAdmin
|
||||
if (targets == null) return;
|
||||
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;
|
||||
string message = command.GetCommandString[range..];
|
||||
@@ -102,7 +99,6 @@ namespace CS2_SimpleAdmin
|
||||
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
Helper.PrintToCenterAll(StringExtensions.ReplaceColorTags(utf8String));
|
||||
@@ -118,7 +114,6 @@ namespace CS2_SimpleAdmin
|
||||
string utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
VirtualFunctions.ClientPrintAll(
|
||||
|
||||
@@ -122,8 +122,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
string steamid = command.GetArg(1);
|
||||
string name = command.GetArg(2);
|
||||
string flags = command.GetArg(3);
|
||||
@@ -133,7 +131,7 @@ namespace CS2_SimpleAdmin
|
||||
int time = 0;
|
||||
int.TryParse(command.GetArg(5), out time);
|
||||
|
||||
AddAdmin(caller, steamid, name, flags, immunity, time, globalAdmin);
|
||||
AddAdmin(caller, steamid, name, flags, immunity, time, globalAdmin, command);
|
||||
}
|
||||
|
||||
public void AddAdmin(CCSPlayerController? caller, string steamid, string name, string flags, int immunity, int time = 0, bool globalAdmin = false, CommandInfo? command = null)
|
||||
@@ -142,6 +140,8 @@ namespace CS2_SimpleAdmin
|
||||
AdminSQLManager _adminManager = new(_database);
|
||||
_ = _adminManager.AddAdminBySteamId(steamid, name, flags, immunity, time, globalAdmin);
|
||||
|
||||
if (command != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_addadmin {steamid} {name} {flags} {immunity} {time}");
|
||||
|
||||
string msg = $"Added '{flags}' flags to '{name}' ({steamid})";
|
||||
@@ -167,12 +167,10 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
string steamid = command.GetArg(1);
|
||||
bool globalDelete = command.GetArg(2).ToLower().Equals("-g");
|
||||
|
||||
RemoveAdmin(caller, steamid, globalDelete);
|
||||
RemoveAdmin(caller, steamid, globalDelete, command);
|
||||
}
|
||||
|
||||
public void RemoveAdmin(CCSPlayerController? caller, string steamid, bool globalDelete = false, CommandInfo? command = null)
|
||||
@@ -195,6 +193,8 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
|
||||
if (command != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_deladmin {steamid}");
|
||||
|
||||
string msg = $"Removed flags from '{steamid}'";
|
||||
@@ -277,7 +277,8 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
//Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList();
|
||||
|
||||
@@ -371,7 +372,7 @@ namespace CS2_SimpleAdmin
|
||||
public void OnKickCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
TargetResult? targets = GetTarget(command);
|
||||
|
||||
@@ -385,8 +386,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
if (command.ArgCount >= 2 && command.GetArg(2).Length > 0)
|
||||
reason = command.GetArg(2);
|
||||
|
||||
@@ -397,12 +396,12 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
Kick(caller, player, reason, callerName);
|
||||
Kick(caller, player, reason, callerName, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void Kick(CCSPlayerController? caller, CCSPlayerController player, string reason = "Unknown", string? callerName = null)
|
||||
public void Kick(CCSPlayerController? caller, CCSPlayerController player, string reason = "Unknown", string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
if (player.PawnIsAlive)
|
||||
@@ -410,8 +409,10 @@ namespace CS2_SimpleAdmin
|
||||
player.Pawn.Value!.Freeze();
|
||||
}
|
||||
|
||||
reason = reason ?? CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
reason = reason ?? _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
if (command != null)
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, $"css_kick {player.PlayerName} {reason}");
|
||||
|
||||
if (string.IsNullOrEmpty(reason) == false)
|
||||
@@ -472,16 +473,14 @@ namespace CS2_SimpleAdmin
|
||||
_command = $"ds_workshop_changelevel {map.Replace("ws:", "")}";
|
||||
}
|
||||
|
||||
if (_discordWebhookClientLog != null && _localizer != null)
|
||||
{
|
||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
||||
string commandName = command?.GetCommandString ?? "css_changemap";
|
||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", commandName]));
|
||||
}
|
||||
if (command is not null)
|
||||
Helper.LogCommand(caller, command);
|
||||
//if (_discordWebhookClientLog != null && _localizer != null)
|
||||
//{
|
||||
// string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
||||
// string commandName = command?.GetCommandString ?? "css_changemap";
|
||||
// _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", commandName]));
|
||||
//}
|
||||
|
||||
AddTimer(2.0f, () =>
|
||||
AddTimer(3.0f, () =>
|
||||
{
|
||||
Server.ExecuteCommand(_command);
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
@@ -499,6 +498,11 @@ namespace CS2_SimpleAdmin
|
||||
Server.PrintToConsole(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
AddTimer(3.0f, () =>
|
||||
{
|
||||
Server.ExecuteCommand($"changelevel {map}");
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
@@ -514,12 +518,10 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
if (!map.StartsWith("ws:"))
|
||||
if (command != null)
|
||||
{
|
||||
AddTimer(2.0f, () =>
|
||||
{
|
||||
Server.ExecuteCommand($"changelevel {map}");
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,19 +565,25 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
if (_discordWebhookClientLog != null && _localizer != null)
|
||||
{
|
||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
||||
string commandName = command?.GetCommandString ?? "css_changewsmap";
|
||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", commandName]));
|
||||
}
|
||||
if (command is not null)
|
||||
Helper.LogCommand(caller, command);
|
||||
//if (_discordWebhookClientLog != null && _localizer != null)
|
||||
//{
|
||||
// string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
||||
// string commandName = command?.GetCommandString ?? "css_changewsmap";
|
||||
// _discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", commandName]));
|
||||
//}
|
||||
//if (command is not null)
|
||||
// Helper.LogCommand(caller, command);
|
||||
|
||||
AddTimer(2.0f, () =>
|
||||
AddTimer(3.0f, () =>
|
||||
{
|
||||
Server.ExecuteCommand(_command);
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_cvar", "Change a cvar.")]
|
||||
@@ -599,7 +607,6 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
var value = command.GetArg(2);
|
||||
@@ -618,7 +625,6 @@ namespace CS2_SimpleAdmin
|
||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
Server.ExecuteCommand(command.ArgString);
|
||||
|
||||
@@ -5,7 +5,6 @@ using CounterStrikeSharp.API.Core.Translations;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using System.Text;
|
||||
|
||||
namespace CS2_SimpleAdmin
|
||||
@@ -21,7 +20,7 @@ namespace CS2_SimpleAdmin
|
||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
int time = 0;
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
TargetResult? targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
@@ -32,10 +31,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
|
||||
|
||||
int.TryParse(command.GetArg(2), out time);
|
||||
|
||||
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
|
||||
@@ -48,13 +43,12 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
Gag(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer);
|
||||
Gag(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
internal void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
|
||||
internal void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null)
|
||||
{
|
||||
if (_database == null) return;
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
@@ -75,8 +69,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, $"css_gag {player?.SteamID} {time} {reason}");
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
|
||||
@@ -132,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")]
|
||||
@@ -155,10 +154,8 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
int time = 0;
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
MuteManager _muteManager = new(_database);
|
||||
PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager();
|
||||
@@ -175,8 +172,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
List<CCSPlayerController> matches = Helper.GetPlayerFromSteamid64(steamid);
|
||||
if (matches.Count == 1)
|
||||
{
|
||||
@@ -237,6 +232,8 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time);
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer);
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
@@ -244,7 +241,13 @@ namespace CS2_SimpleAdmin
|
||||
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 0);
|
||||
});
|
||||
|
||||
command.ReplyToCommand($"Gagged player with steamid {steamid}.");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
|
||||
command?.ReplyToCommand($"Gagged player with steamid {steamid}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_ungag")]
|
||||
@@ -264,7 +267,6 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
bool found = false;
|
||||
@@ -366,7 +368,7 @@ namespace CS2_SimpleAdmin
|
||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
int time = 0;
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
TargetResult? targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
@@ -377,8 +379,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
int.TryParse(command.GetArg(2), out time);
|
||||
|
||||
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
|
||||
@@ -391,13 +391,12 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
Mute(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer);
|
||||
Mute(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
internal void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
|
||||
internal void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null)
|
||||
{
|
||||
if (_database == null) return;
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
@@ -418,8 +417,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, $"css_mute {player?.SteamID} {time} {reason}");
|
||||
|
||||
player!.VoiceFlags = VoiceFlags.Muted;
|
||||
|
||||
Task.Run(async () =>
|
||||
@@ -470,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")]
|
||||
@@ -492,12 +496,8 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
int time = 0;
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
MuteManager _muteManager = new(_database);
|
||||
PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager();
|
||||
@@ -569,6 +569,8 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer);
|
||||
}
|
||||
|
||||
Task.Run(async () =>
|
||||
@@ -576,7 +578,13 @@ namespace CS2_SimpleAdmin
|
||||
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 1);
|
||||
});
|
||||
|
||||
command.ReplyToCommand($"Muted player with steamid {steamid}.");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
|
||||
command?.ReplyToCommand($"Muted player with steamid {steamid}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unmute")]
|
||||
@@ -596,7 +604,6 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
string pattern = command.GetArg(1);
|
||||
@@ -695,8 +702,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
int.TryParse(command.GetArg(2), out time);
|
||||
|
||||
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
|
||||
@@ -709,13 +714,12 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Silence, _discordWebhookClientPenalty, _localizer);
|
||||
Silence(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
|
||||
Silence(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
internal void Silence(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
|
||||
internal void Silence(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null)
|
||||
{
|
||||
if (_database == null) return;
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
@@ -736,8 +740,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, $"css_silence {player?.SteamID} {time} {reason}");
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2);
|
||||
@@ -747,7 +749,6 @@ namespace CS2_SimpleAdmin
|
||||
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
|
||||
|
||||
player!.VoiceFlags = VoiceFlags.Muted;
|
||||
|
||||
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time);
|
||||
|
||||
if (time == 0)
|
||||
@@ -796,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")]
|
||||
@@ -818,10 +826,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
int time = 0;
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
@@ -897,6 +901,8 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer);
|
||||
}
|
||||
}
|
||||
Task.Run(async () =>
|
||||
@@ -904,7 +910,13 @@ namespace CS2_SimpleAdmin
|
||||
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 2);
|
||||
});
|
||||
|
||||
command.ReplyToCommand($"Silenced player with steamid {steamid}.");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
|
||||
command?.ReplyToCommand($"Silenced player with steamid {steamid}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unsilence")]
|
||||
@@ -924,7 +936,6 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
string pattern = command.GetArg(1);
|
||||
|
||||
@@ -3,7 +3,6 @@ using CounterStrikeSharp.API.Core.Attributes.Registration;
|
||||
using CounterStrikeSharp.API.Core.Translations;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Menu;
|
||||
using System.Text;
|
||||
|
||||
@@ -21,7 +20,6 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
voteAnswers.Clear();
|
||||
|
||||
@@ -4,7 +4,6 @@ using CounterStrikeSharp.API.Core.Translations;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using System.Text;
|
||||
|
||||
namespace CS2_SimpleAdmin
|
||||
@@ -113,24 +112,26 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
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 =>
|
||||
{
|
||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||
return;
|
||||
|
||||
Unfreeze(caller, player, callerName);
|
||||
Unfreeze(caller, player, callerName, command);
|
||||
});
|
||||
}
|
||||
|
||||
public void Unfreeze(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||
public void Unfreeze(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
player!.Pawn.Value!.Unfreeze();
|
||||
|
||||
Helper.LogCommand(caller, $"css_unfreeze {player.PlayerName}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ using CounterStrikeSharp.API.Core.Translations;
|
||||
using CounterStrikeSharp.API.Modules.Admin;
|
||||
using CounterStrikeSharp.API.Modules.Commands;
|
||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
@@ -23,17 +22,15 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
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();
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
Slay(caller, player, callerName);
|
||||
Slay(caller, player, callerName, command);
|
||||
});
|
||||
}
|
||||
|
||||
public void Slay(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||
public void Slay(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||
return;
|
||||
@@ -42,7 +39,11 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.CommitSuicide(false, true);
|
||||
|
||||
Helper.LogCommand(caller, $"css_slay {player.PlayerName}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
@@ -94,14 +95,12 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||
return;
|
||||
|
||||
GiveWeapon(caller, player, weaponName, callerName);
|
||||
GiveWeapon(caller, player, weaponName, callerName, command);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -113,9 +112,13 @@ namespace CS2_SimpleAdmin
|
||||
SubGiveWeapon(caller, player!, weapon.ToString(), callerName);
|
||||
}
|
||||
|
||||
public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null)
|
||||
public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
Helper.LogCommand(caller, $"css_give {player?.PlayerName} {weaponName}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
player?.GiveNamedItem(weaponName);
|
||||
SubGiveWeapon(caller, player!, weaponName, callerName);
|
||||
@@ -148,20 +151,18 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
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();
|
||||
|
||||
playersToTarget.ForEach(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;
|
||||
|
||||
@@ -170,7 +171,11 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.RemoveWeapons();
|
||||
|
||||
Helper.LogCommand(caller, $"css_strip {player.PlayerName}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
@@ -198,20 +203,18 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
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();
|
||||
|
||||
playersToTarget.ForEach(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)
|
||||
return;
|
||||
@@ -220,7 +223,11 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
player.SetHp(health);
|
||||
|
||||
Helper.LogCommand(caller, $"css_hp {player.PlayerName} {health}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
@@ -248,8 +255,6 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
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();
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
@@ -259,18 +264,22 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
SetSpeed(caller, player, speed, callerName);
|
||||
SetSpeed(caller, player, speed, callerName, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void SetSpeed(CCSPlayerController? caller, CCSPlayerController player, double speed, string? callerName = null)
|
||||
public void SetSpeed(CCSPlayerController? caller, CCSPlayerController player, double speed, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
player.SetSpeed((float)speed);
|
||||
|
||||
Helper.LogCommand(caller, $"css_speed {player?.PlayerName} {speed}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
@@ -309,18 +318,22 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
SetGravity(caller, player, gravity, callerName);
|
||||
SetGravity(caller, player, gravity, callerName, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void SetGravity(CCSPlayerController? caller, CCSPlayerController player, double gravity, string? callerName = null)
|
||||
public void SetGravity(CCSPlayerController? caller, CCSPlayerController player, double gravity, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
player.SetGravity((float)gravity);
|
||||
|
||||
Helper.LogCommand(caller, $"css_gravity {player?.PlayerName} {gravity}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
@@ -348,8 +361,6 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
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();
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
@@ -359,18 +370,22 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
SetMoney(caller, player, money, callerName);
|
||||
SetMoney(caller, player, money, callerName, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void SetMoney(CCSPlayerController? caller, CCSPlayerController player, int money, string? callerName = null)
|
||||
public void SetMoney(CCSPlayerController? caller, CCSPlayerController player, int money, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
player.SetMoney(money);
|
||||
|
||||
Helper.LogCommand(caller, $"css_money {player?.PlayerName} {money}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
@@ -395,8 +410,6 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
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();
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
@@ -406,18 +419,22 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
God(caller, player, callerName);
|
||||
God(caller, player, callerName, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void God(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||
public void God(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
Helper.LogCommand(caller, $"css_god {player.PlayerName}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (!godPlayers.Contains(player.Slot))
|
||||
{
|
||||
@@ -454,8 +471,6 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
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();
|
||||
|
||||
if (command.ArgCount >= 2)
|
||||
@@ -470,17 +485,21 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
Slap(caller, player, damage);
|
||||
Slap(caller, player, damage, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void Slap(CCSPlayerController? caller, CCSPlayerController player, int damage, string? callerName = null)
|
||||
public void Slap(CCSPlayerController? caller, CCSPlayerController player, int damage, CommandInfo? command = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||
player!.Pawn.Value!.Slap(damage);
|
||||
|
||||
Helper.LogCommand(caller, $"css_slap {player.PlayerName} {damage}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
@@ -509,8 +528,6 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||
|
||||
switch (teamName)
|
||||
@@ -540,15 +557,13 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
bool kill = command.GetArg(3).ToLower().Equals("-k");
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
ChangeTeam(caller, player, _teamName, teamNum, kill, callerName);
|
||||
ChangeTeam(caller, player, _teamName, teamNum, kill, callerName, command);
|
||||
});
|
||||
}
|
||||
|
||||
public void ChangeTeam(CCSPlayerController? caller, CCSPlayerController player, string teamName, CsTeam teamNum, bool kill, string? callerName = null)
|
||||
public void ChangeTeam(CCSPlayerController? caller, CCSPlayerController player, string teamName, CsTeam teamNum, bool kill, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||
return;
|
||||
@@ -591,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.")]
|
||||
@@ -607,9 +628,8 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
@@ -618,7 +638,6 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -647,8 +666,6 @@ namespace CS2_SimpleAdmin
|
||||
TargetResult? targets = GetTarget(command);
|
||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||
@@ -656,12 +673,12 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
Respawn(caller, player, callerName);
|
||||
Respawn(caller, player, callerName, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void Respawn(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||
public void Respawn(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
|
||||
@@ -672,7 +689,11 @@ namespace CS2_SimpleAdmin
|
||||
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
|
||||
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
|
||||
|
||||
Helper.LogCommand(caller, $"css_respawn {player.PlayerName}");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
@@ -706,9 +727,8 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
@@ -758,10 +778,8 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && !player.IsHLTV).ToList();
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user