mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-03-04 14:44:55 +00:00
Merge pull request #49 from Dliix66/feature/menu
Changed css_admin command to open the admin menu
This commit is contained in:
@@ -15,7 +15,8 @@ namespace CS2_SimpleAdmin;
|
|||||||
[MinimumApiVersion(163)]
|
[MinimumApiVersion(163)]
|
||||||
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
|
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
|
||||||
{
|
{
|
||||||
public static BasePlugin? _plugin = null;
|
public static CS2_SimpleAdmin Instance { get; private set; } = new();
|
||||||
|
|
||||||
public static IStringLocalizer? _localizer;
|
public static IStringLocalizer? _localizer;
|
||||||
public static Dictionary<string, int> voteAnswers = new Dictionary<string, int>();
|
public static Dictionary<string, int> voteAnswers = new Dictionary<string, int>();
|
||||||
public static HashSet<int> votePlayers = new HashSet<int>();
|
public static HashSet<int> votePlayers = new HashSet<int>();
|
||||||
@@ -26,25 +27,25 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
public static bool voteInProgress = false;
|
public static bool voteInProgress = false;
|
||||||
public static int? ServerId = null;
|
public static int? ServerId = null;
|
||||||
|
|
||||||
|
public static DiscordWebhookClient? _discordWebhookClientLog;
|
||||||
|
public static DiscordWebhookClient? _discordWebhookClientPenalty;
|
||||||
|
|
||||||
internal string dbConnectionString = string.Empty;
|
internal string dbConnectionString = string.Empty;
|
||||||
internal static Database? _database;
|
internal static Database? _database;
|
||||||
|
|
||||||
internal static ILogger? _logger;
|
internal static ILogger? _logger;
|
||||||
public static DiscordWebhookClient? _discordWebhookClientLog;
|
|
||||||
public static DiscordWebhookClient? _discordWebhookClientPenalty;
|
|
||||||
|
|
||||||
public static MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>? CBasePlayerController_SetPawnFunc = null;
|
public static MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>? CBasePlayerController_SetPawnFunc = null;
|
||||||
public override string ModuleName => "CS2-SimpleAdmin";
|
public override string ModuleName => "CS2-SimpleAdmin";
|
||||||
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
|
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
|
||||||
public override string ModuleAuthor => "daffyy";
|
public override string ModuleAuthor => "daffyy & Dliix66";
|
||||||
public override string ModuleVersion => "1.3.1a";
|
public override string ModuleVersion => "1.3.2a";
|
||||||
|
|
||||||
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
||||||
|
|
||||||
public override void Load(bool hotReload)
|
public override void Load(bool hotReload)
|
||||||
{
|
{
|
||||||
registerEvents();
|
registerEvents();
|
||||||
_plugin = this;
|
|
||||||
|
|
||||||
if (hotReload)
|
if (hotReload)
|
||||||
{
|
{
|
||||||
@@ -69,7 +70,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
UserID = config.DatabaseUser,
|
UserID = config.DatabaseUser,
|
||||||
Password = config.DatabasePassword,
|
Password = config.DatabasePassword,
|
||||||
Port = (uint)config.DatabasePort,
|
Port = (uint)config.DatabasePort,
|
||||||
Pooling = true,
|
Pooling = true
|
||||||
};
|
};
|
||||||
|
|
||||||
dbConnectionString = builder.ConnectionString;
|
dbConnectionString = builder.ConnectionString;
|
||||||
@@ -79,9 +80,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var connection = await _database.GetConnectionAsync())
|
using (MySqlConnection connection = await _database.GetConnectionAsync())
|
||||||
{
|
{
|
||||||
using var transaction = await connection.BeginTransactionAsync();
|
using MySqlTransaction transaction = await connection.BeginTransactionAsync();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -138,7 +139,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
|
|
||||||
public static void RemoveFromConcurrentBag(ConcurrentBag<int> bag, int playerSlot)
|
public static void RemoveFromConcurrentBag(ConcurrentBag<int> bag, int playerSlot)
|
||||||
{
|
{
|
||||||
var tempList = new List<int>();
|
List<int> tempList = new List<int>();
|
||||||
while (!bag.IsEmpty)
|
while (!bag.IsEmpty)
|
||||||
{
|
{
|
||||||
if (bag.TryTake(out int item) && item != playerSlot)
|
if (bag.TryTake(out int item) && item != playerSlot)
|
||||||
@@ -146,10 +147,10 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
tempList.Add(item);
|
tempList.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var item in tempList)
|
|
||||||
|
foreach (int item in tempList)
|
||||||
{
|
{
|
||||||
bag.Add(item);
|
bag.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.166" />
|
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.166" />
|
||||||
<PackageReference Include="Dapper" Version="*" />
|
<PackageReference Include="Dapper" Version="*" />
|
||||||
<PackageReference Include="Discord.Net.Webhook" Version="3.13.0" />
|
<PackageReference Include="Discord.Net.Webhook" Version="3.13.1" />
|
||||||
<PackageReference Include="MySqlConnector" Version="2.3.5" />
|
<PackageReference Include="MySqlConnector" Version="2.3.5" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="*" />
|
<PackageReference Include="Newtonsoft.Json" Version="*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -50,80 +50,89 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (player.PawnIsAlive)
|
Ban(caller, player, time, reason, callerName, _banManager);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, BanManager? banManager = null)
|
||||||
|
{
|
||||||
|
if (_database == null) return;
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
banManager ??= new BanManager(_database, Config);
|
||||||
|
|
||||||
|
if (player.PawnIsAlive)
|
||||||
|
{
|
||||||
|
player.Pawn.Value!.Freeze();
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
SteamId = player?.SteamID.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
PlayerInfo adminInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
SteamId = caller?.SteamID.ToString(),
|
||||||
|
Name = caller?.PlayerName,
|
||||||
|
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await banManager.BanPlayer(playerInfo, adminInfo, reason, time);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player!.UserId!), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||||
|
|
||||||
|
if (playerInfo.IpAddress != null && !bannedPlayers.Contains(playerInfo.IpAddress))
|
||||||
|
bannedPlayers.Add(playerInfo.IpAddress);
|
||||||
|
if (!bannedPlayers.Contains(player!.SteamID.ToString()))
|
||||||
|
bannedPlayers.Add(player.SteamID.ToString());
|
||||||
|
|
||||||
|
if (time == 0)
|
||||||
|
{
|
||||||
|
if (!player.IsBot && !player.IsHLTV)
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
{
|
{
|
||||||
player.Pawn.Value!.Freeze();
|
player!.PrintToCenter(_localizer!["sa_player_ban_message_perm", reason, caller == null ? "Console" : caller.PlayerName]);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerInfo playerInfo = new PlayerInfo
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
{
|
{
|
||||||
SteamId = player?.SteamID.ToString(),
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
Name = player?.PlayerName,
|
|
||||||
IpAddress = player?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
PlayerInfo adminInfo = new PlayerInfo
|
|
||||||
{
|
|
||||||
SteamId = caller?.SteamID.ToString(),
|
|
||||||
Name = caller?.PlayerName,
|
|
||||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
|
||||||
await _banManager.BanPlayer(playerInfo, adminInfo, reason, time);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player!.UserId!), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
|
||||||
|
|
||||||
if (playerInfo.IpAddress != null && !bannedPlayers.Contains(playerInfo.IpAddress))
|
|
||||||
bannedPlayers.Add(playerInfo.IpAddress);
|
|
||||||
if (!bannedPlayers.Contains(player!.SteamID.ToString()))
|
|
||||||
bannedPlayers.Add(player.SteamID.ToString());
|
|
||||||
|
|
||||||
if (time == 0)
|
|
||||||
{
|
|
||||||
if (!player.IsBot && !player.IsHLTV)
|
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player!.PrintToCenter(_localizer!["sa_player_ban_message_perm", reason, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
{
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
{
|
sb.Append(_localizer["sa_admin_ban_message_perm", callerName, player.PlayerName, reason]);
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
_player.PrintToChat(sb.ToString());
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_ban_message_perm", callerName, player.PlayerName, reason]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!player.IsBot && !player.IsHLTV)
|
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player!.PrintToCenter(_localizer!["sa_player_ban_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_ban_message_time", callerName, player.PlayerName, reason, time]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!player.IsBot && !player.IsHLTV)
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
|
{
|
||||||
|
player!.PrintToCenter(_localizer!["sa_player_ban_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]);
|
||||||
|
}
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_ban_message_time", callerName, player.PlayerName, reason, time]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_addban")]
|
[ConsoleCommand("css_addban")]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
|||||||
using CounterStrikeSharp.API.Modules.Cvars;
|
using CounterStrikeSharp.API.Modules.Cvars;
|
||||||
using CounterStrikeSharp.API.Modules.Entities;
|
using CounterStrikeSharp.API.Modules.Entities;
|
||||||
using CounterStrikeSharp.API.Modules.Utils;
|
using CounterStrikeSharp.API.Modules.Utils;
|
||||||
|
using CS2_SimpleAdmin.Menus;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -25,27 +26,34 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var connection = await _database.GetConnectionAsync())
|
using var connection = await _database.GetConnectionAsync();
|
||||||
{
|
var commandText = "ALTER TABLE `sa_mutes` CHANGE `type` `type` ENUM('GAG','MUTE', 'SILENCE', '') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'GAG';";
|
||||||
var commandText = "ALTER TABLE `sa_mutes` CHANGE `type` `type` ENUM('GAG','MUTE', 'SILENCE', '') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'GAG';";
|
|
||||||
|
|
||||||
using (var command = connection.CreateCommand())
|
using var command = connection.CreateCommand();
|
||||||
{
|
command.CommandText = commandText;
|
||||||
command.CommandText = commandText;
|
await command.ExecuteNonQueryAsync();
|
||||||
await command.ExecuteNonQueryAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.LogError($"{ex.Message}");
|
Logger.LogError(ex.Message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_admin")]
|
[ConsoleCommand("css_admin")]
|
||||||
[RequiresPermissions("@css/generic")]
|
[RequiresPermissions("@css/generic")]
|
||||||
|
[CommandHelper(minArgs: 0, usage: "", whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||||
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)
|
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)
|
||||||
|
{
|
||||||
|
if (caller == null || caller.IsValid == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(caller);
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConsoleCommand("css_adminhelp")]
|
||||||
|
[RequiresPermissions("@css/generic")]
|
||||||
|
public void OnAdminHelpCommand(CCSPlayerController? caller, CommandInfo command)
|
||||||
{
|
{
|
||||||
if (caller == null || !caller.IsValid) return;
|
if (caller == null || !caller.IsValid) return;
|
||||||
|
|
||||||
@@ -99,10 +107,22 @@ namespace CS2_SimpleAdmin
|
|||||||
int time = 0;
|
int time = 0;
|
||||||
int.TryParse(command.GetArg(5), out time);
|
int.TryParse(command.GetArg(5), out time);
|
||||||
|
|
||||||
|
AddAdmin(caller, steamid, name, flags, immunity, time, globalAdmin);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddAdmin(CCSPlayerController? caller, string steamid, string name, string flags, int immunity, int time = 0, bool globalAdmin = false, CommandInfo? command = null)
|
||||||
|
{
|
||||||
|
if (_database == null) return;
|
||||||
AdminSQLManager _adminManager = new(_database);
|
AdminSQLManager _adminManager = new(_database);
|
||||||
_ = _adminManager.AddAdminBySteamId(steamid, name, flags, immunity, time, globalAdmin);
|
_ = _adminManager.AddAdminBySteamId(steamid, name, flags, immunity, time, globalAdmin);
|
||||||
|
|
||||||
command.ReplyToCommand($"Added '{flags}' flags to '{name}' ({steamid})");
|
string msg = $"Added '{flags}' flags to '{name}' ({steamid})";
|
||||||
|
if (command != null)
|
||||||
|
command.ReplyToCommand(msg);
|
||||||
|
else if (caller != null && caller.IsValid)
|
||||||
|
caller.PrintToChat(msg);
|
||||||
|
else
|
||||||
|
Server.PrintToConsole(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_deladmin")]
|
[ConsoleCommand("css_deladmin")]
|
||||||
@@ -128,6 +148,12 @@ namespace CS2_SimpleAdmin
|
|||||||
string steamid = command.GetArg(1);
|
string steamid = command.GetArg(1);
|
||||||
bool globalDelete = command.GetArg(2).ToLower().Equals("-g");
|
bool globalDelete = command.GetArg(2).ToLower().Equals("-g");
|
||||||
|
|
||||||
|
RemoveAdmin(caller, steamid, globalDelete);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveAdmin(CCSPlayerController? caller, string steamid, bool globalDelete = false, CommandInfo? command = null)
|
||||||
|
{
|
||||||
|
if (_database == null) return;
|
||||||
AdminSQLManager _adminManager = new(_database);
|
AdminSQLManager _adminManager = new(_database);
|
||||||
_ = _adminManager.DeleteAdminBySteamId(steamid, globalDelete);
|
_ = _adminManager.DeleteAdminBySteamId(steamid, globalDelete);
|
||||||
|
|
||||||
@@ -145,7 +171,13 @@ namespace CS2_SimpleAdmin
|
|||||||
}
|
}
|
||||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||||
|
|
||||||
command.ReplyToCommand($"Removed flags from '{steamid}'");
|
string msg = $"Removed flags from '{steamid}'";
|
||||||
|
if (command != null)
|
||||||
|
command.ReplyToCommand(msg);
|
||||||
|
else if (caller != null && caller.IsValid)
|
||||||
|
caller.PrintToChat(msg);
|
||||||
|
else
|
||||||
|
Server.PrintToConsole(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_reladmin")]
|
[ConsoleCommand("css_reladmin")]
|
||||||
@@ -155,6 +187,14 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (_database == null) return;
|
if (_database == null) return;
|
||||||
|
|
||||||
|
ReloadAdmins();
|
||||||
|
|
||||||
|
command.ReplyToCommand("Reloaded sql admins");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReloadAdmins()
|
||||||
|
{
|
||||||
|
if (_database == null) return;
|
||||||
foreach (SteamID steamId in AdminSQLManager._adminCache.Keys.ToList())
|
foreach (SteamID steamId in AdminSQLManager._adminCache.Keys.ToList())
|
||||||
{
|
{
|
||||||
if (AdminSQLManager._adminCache.TryRemove(steamId, out _))
|
if (AdminSQLManager._adminCache.TryRemove(steamId, out _))
|
||||||
@@ -166,8 +206,6 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
AdminSQLManager _adminManager = new(_database);
|
AdminSQLManager _adminManager = new(_database);
|
||||||
_ = _adminManager.GiveAllFlags();
|
_ = _adminManager.GiveAllFlags();
|
||||||
|
|
||||||
command.ReplyToCommand("Reloaded sql admins");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_stealth")]
|
[ConsoleCommand("css_stealth")]
|
||||||
@@ -220,7 +258,7 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList();
|
List<CCSPlayerController> playersToTarget = targets!.Players.Where(player => player != null && player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList();
|
||||||
|
|
||||||
Database database = new Database(dbConnectionString);
|
Database database = new(dbConnectionString);
|
||||||
BanManager _banManager = new(database, Config);
|
BanManager _banManager = new(database, Config);
|
||||||
MuteManager _muteManager = new(_database);
|
MuteManager _muteManager = new(_database);
|
||||||
|
|
||||||
@@ -228,7 +266,7 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
PlayerInfo playerInfo = new PlayerInfo
|
PlayerInfo playerInfo = new()
|
||||||
{
|
{
|
||||||
UserId = player.UserId,
|
UserId = player.UserId,
|
||||||
Index = (int)player.Index,
|
Index = (int)player.Index,
|
||||||
@@ -247,54 +285,29 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
Server.NextFrame(() =>
|
Server.NextFrame(() =>
|
||||||
{
|
{
|
||||||
if (caller != null)
|
Action<string> printMethod = caller == null ? Server.PrintToConsole : caller.PrintToConsole;
|
||||||
|
|
||||||
|
printMethod($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
|
||||||
|
|
||||||
|
printMethod($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
|
||||||
|
printMethod($"• UserID: \"{playerInfo.UserId}\"");
|
||||||
|
if (playerInfo.SteamId != null)
|
||||||
|
printMethod($"• SteamID64: \"{playerInfo.SteamId}\"");
|
||||||
|
if (player.SteamID.ToString().Length == 17)
|
||||||
{
|
{
|
||||||
caller!.PrintToConsole($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
|
printMethod($"• SteamID2: \"{player.SteamID}\"");
|
||||||
|
printMethod($"• Community link: \"{new SteamID(player.SteamID).ToCommunityUrl()}\"");
|
||||||
caller!.PrintToConsole($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
|
|
||||||
caller!.PrintToConsole($"• UserID: \"{playerInfo.UserId}\"");
|
|
||||||
if (playerInfo.SteamId != null)
|
|
||||||
caller!.PrintToConsole($"• SteamID64: \"{playerInfo.SteamId}\"");
|
|
||||||
if (player.SteamID.ToString().Length == 17)
|
|
||||||
{
|
|
||||||
caller!.PrintToConsole($"• SteamID2: \"{player.SteamID}\"");
|
|
||||||
caller!.PrintToConsole($"• Community link: \"{new SteamID(player.SteamID).ToCommunityUrl()}\"");
|
|
||||||
}
|
|
||||||
if (playerInfo.IpAddress != null)
|
|
||||||
caller!.PrintToConsole($"• IP Address: \"{playerInfo.IpAddress}\"");
|
|
||||||
caller!.PrintToConsole($"• Ping: \"{player.Ping}\"");
|
|
||||||
if (player.SteamID.ToString().Length == 17)
|
|
||||||
{
|
|
||||||
caller!.PrintToConsole($"• Total Bans: \"{totalBans}\"");
|
|
||||||
caller!.PrintToConsole($"• Total Mutes: \"{totalMutes}\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
caller!.PrintToConsole($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
|
|
||||||
}
|
}
|
||||||
else
|
if (playerInfo.IpAddress != null)
|
||||||
|
printMethod($"• IP Address: \"{playerInfo.IpAddress}\"");
|
||||||
|
printMethod($"• Ping: \"{player.Ping}\"");
|
||||||
|
if (player.SteamID.ToString().Length == 17)
|
||||||
{
|
{
|
||||||
Server.PrintToConsole($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
|
printMethod($"• Total Bans: \"{totalBans}\"");
|
||||||
|
printMethod($"• Total Mutes: \"{totalMutes}\"");
|
||||||
Server.PrintToConsole($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
|
|
||||||
Server.PrintToConsole($"• UserID: \"{playerInfo.UserId}\"");
|
|
||||||
if (playerInfo.SteamId != null)
|
|
||||||
Server.PrintToConsole($"• SteamID64: \"{playerInfo.SteamId}\"");
|
|
||||||
if (player.SteamID.ToString().Length == 17)
|
|
||||||
{
|
|
||||||
Server.PrintToConsole($"• SteamID2: \"{player.SteamID}\"");
|
|
||||||
Server.PrintToConsole($"• Community link: \"{new SteamID(player.SteamID).ToCommunityUrl()}\"");
|
|
||||||
}
|
|
||||||
if (playerInfo.IpAddress != null)
|
|
||||||
Server.PrintToConsole($"• IP Address: \"{playerInfo.IpAddress}\"");
|
|
||||||
Server.PrintToConsole($"• Ping: \"{player.Ping}\"");
|
|
||||||
if (player.SteamID.ToString().Length == 17)
|
|
||||||
{
|
|
||||||
Server.PrintToConsole($"• Total Bans: \"{totalBans}\"");
|
|
||||||
Server.PrintToConsole($"• Total Mutes: \"{totalMutes}\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
Server.PrintToConsole($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printMethod($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -357,57 +370,68 @@ namespace CS2_SimpleAdmin
|
|||||||
if (command.ArgCount >= 2 && command.GetArg(2).Length > 0)
|
if (command.ArgCount >= 2 && command.GetArg(2).Length > 0)
|
||||||
reason = command.GetArg(2);
|
reason = command.GetArg(2);
|
||||||
|
|
||||||
targets.Players.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (player.PawnIsAlive)
|
Kick(caller, player, reason, callerName);
|
||||||
{
|
|
||||||
player.Pawn.Value!.Freeze();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (command.ArgCount >= 2)
|
|
||||||
{
|
|
||||||
if (!player.IsBot && !player.IsHLTV)
|
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player.PrintToCenter(_localizer!["sa_player_kick_message", reason, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player.UserId!, reason), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player.UserId!), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_kick_message", callerName, player.PlayerName, reason]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Kick(CCSPlayerController? caller, CCSPlayerController player, string reason = "Unknown", string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
if (player.PawnIsAlive)
|
||||||
|
{
|
||||||
|
player.Pawn.Value!.Freeze();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(reason) == false)
|
||||||
|
{
|
||||||
|
if (!player.IsBot && !player.IsHLTV)
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
|
{
|
||||||
|
player.PrintToCenter(_localizer!["sa_player_kick_message", reason, caller == null ? "Console" : caller.PlayerName]);
|
||||||
|
}
|
||||||
|
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player.UserId!, reason), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddTimer(Config.KickTime, () => Helper.KickPlayer((ushort)player.UserId!), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_kick_message", callerName, player.PlayerName, reason]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_changemap")]
|
[ConsoleCommand("css_changemap")]
|
||||||
[ConsoleCommand("css_map")]
|
[ConsoleCommand("css_map")]
|
||||||
[RequiresPermissions("@css/changemap")]
|
[RequiresPermissions("@css/changemap")]
|
||||||
[CommandHelper(minArgs: 1, usage: "<mapname>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 1, usage: "<mapname>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
public void OnMapCommand(CCSPlayerController? caller, CommandInfo command)
|
public void OnMapCommand(CCSPlayerController? caller, CommandInfo command)
|
||||||
|
{
|
||||||
|
string? map = command.GetCommandString.Split(" ")[1];
|
||||||
|
ChangeMap(caller, map, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeMap(CCSPlayerController? caller, string map, CommandInfo? command = null)
|
||||||
{
|
{
|
||||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||||
string _command = string.Empty;
|
string _command = string.Empty;
|
||||||
string? map = command.GetCommandString.Split(" ")[1];
|
|
||||||
|
|
||||||
if (map.StartsWith("ws:"))
|
if (map.StartsWith("ws:"))
|
||||||
{
|
{
|
||||||
@@ -423,7 +447,8 @@ namespace CS2_SimpleAdmin
|
|||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
if (_discordWebhookClientLog != null && _localizer != null)
|
||||||
{
|
{
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
string commandName = command?.GetCommandString ?? "css_changemap";
|
||||||
|
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", commandName]));
|
||||||
}
|
}
|
||||||
|
|
||||||
AddTimer(2.0f, () =>
|
AddTimer(2.0f, () =>
|
||||||
@@ -435,7 +460,13 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (!Server.IsMapValid(map))
|
if (!Server.IsMapValid(map))
|
||||||
{
|
{
|
||||||
command.ReplyToCommand($"Map {map} not found.");
|
string msg = $"Map {map} not found.";
|
||||||
|
if (command != null)
|
||||||
|
command.ReplyToCommand(msg);
|
||||||
|
else if (caller != null && caller.IsValid)
|
||||||
|
caller.PrintToChat(msg);
|
||||||
|
else
|
||||||
|
Server.PrintToConsole(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,10 +499,15 @@ namespace CS2_SimpleAdmin
|
|||||||
[CommandHelper(1, "<name or id>")]
|
[CommandHelper(1, "<name or id>")]
|
||||||
[RequiresPermissions("@css/changemap")]
|
[RequiresPermissions("@css/changemap")]
|
||||||
public void OnWorkshopMapCommand(CCSPlayerController? caller, CommandInfo command)
|
public void OnWorkshopMapCommand(CCSPlayerController? caller, CommandInfo command)
|
||||||
|
{
|
||||||
|
string? map = command.GetArg(1);
|
||||||
|
ChangeWorkshopMap(caller, map, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ChangeWorkshopMap(CCSPlayerController? caller, string map, CommandInfo? command = null)
|
||||||
{
|
{
|
||||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||||
string _command = string.Empty;
|
string _command = string.Empty;
|
||||||
string? map = command.GetArg(1);
|
|
||||||
|
|
||||||
if (long.TryParse(map, out long mapId))
|
if (long.TryParse(map, out long mapId))
|
||||||
{
|
{
|
||||||
@@ -498,7 +534,8 @@ namespace CS2_SimpleAdmin
|
|||||||
if (_discordWebhookClientLog != null && _localizer != null)
|
if (_discordWebhookClientLog != null && _localizer != null)
|
||||||
{
|
{
|
||||||
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
string communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl().ToString() + ">" : "<https://steamcommunity.com/profiles/0>";
|
||||||
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", command.GetCommandString]));
|
string commandName = command?.GetCommandString ?? "css_changewsmap";
|
||||||
|
_discordWebhookClientLog.SendMessageAsync(Helper.GenerateMessageDiscord(_localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", commandName]));
|
||||||
}
|
}
|
||||||
|
|
||||||
AddTimer(2.0f, () =>
|
AddTimer(2.0f, () =>
|
||||||
@@ -558,5 +595,24 @@ namespace CS2_SimpleAdmin
|
|||||||
command.ReplyToCommand($"{callerName} executed command {command.ArgString}.");
|
command.ReplyToCommand($"{callerName} executed command {command.ArgString}.");
|
||||||
Logger.LogInformation($"{callerName} executed command ({command.ArgString}).");
|
Logger.LogInformation($"{callerName} executed command ({command.ArgString}).");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ConsoleCommand("css_rr")]
|
||||||
|
[ConsoleCommand("css_rg")]
|
||||||
|
[ConsoleCommand("css_restart")]
|
||||||
|
[ConsoleCommand("css_restartgame")]
|
||||||
|
[RequiresPermissions("@css/generic")]
|
||||||
|
[CommandHelper(minArgs: 0, usage: "", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
|
public void OnRestartCommand(CCSPlayerController? caller, CommandInfo command)
|
||||||
|
{
|
||||||
|
RestartGame(caller);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RestartGame(CCSPlayerController? admin)
|
||||||
|
{
|
||||||
|
// TODO: Localize
|
||||||
|
var name = admin == null ? "Console" : admin.PlayerName;
|
||||||
|
Server.PrintToChatAll($"[SimpleAdmin] {name}: Restarting game...");
|
||||||
|
Server.ExecuteCommand("mp_restartgame 2");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,78 +50,88 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
PlayerInfo playerInfo = new PlayerInfo
|
Gag(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
|
||||||
|
{
|
||||||
|
if (_database == null) return;
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
muteManager ??= new MuteManager(_database);
|
||||||
|
playerPenaltyManager ??= new PlayerPenaltyManager();
|
||||||
|
|
||||||
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
SteamId = player?.SteamID.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
PlayerInfo adminInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
SteamId = caller?.SteamID.ToString(),
|
||||||
|
Name = caller?.PlayerName,
|
||||||
|
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (TagsDetected)
|
||||||
|
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
|
||||||
|
|
||||||
|
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time);
|
||||||
|
|
||||||
|
if (time == 0)
|
||||||
|
{
|
||||||
|
if (!player!.IsBot && !player.IsHLTV)
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
{
|
{
|
||||||
SteamId = player?.SteamID.ToString(),
|
player.PrintToCenter(_localizer!["sa_player_gag_message_perm", reason, caller == null ? "Console" : caller.PlayerName]);
|
||||||
Name = player?.PlayerName,
|
|
||||||
IpAddress = player?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
PlayerInfo adminInfo = new PlayerInfo
|
|
||||||
{
|
|
||||||
SteamId = caller?.SteamID.ToString(),
|
|
||||||
Name = caller?.PlayerName,
|
|
||||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
|
||||||
await _muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (TagsDetected)
|
|
||||||
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
|
|
||||||
|
|
||||||
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time);
|
|
||||||
|
|
||||||
if (time == 0)
|
|
||||||
{
|
|
||||||
if (!player!.IsBot && !player.IsHLTV)
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player.PrintToCenter(_localizer!["sa_player_gag_message_perm", reason, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_gag_message_perm", callerName, player.PlayerName, reason]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
if (!player!.IsBot && !player.IsHLTV)
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player!.PrintToCenter(_localizer!["sa_player_gag_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller == null || caller != null && caller != null && !silentPlayers.Contains(caller.Slot))
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
{
|
sb.Append(_localizer["sa_admin_gag_message_perm", callerName, player.PlayerName, reason]);
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
_player.PrintToChat(sb.ToString());
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_gag_message_time", callerName, player.PlayerName, reason, time]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!player!.IsBot && !player.IsHLTV)
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
|
{
|
||||||
|
player!.PrintToCenter(_localizer!["sa_player_gag_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (caller == null || caller != null && caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_gag_message_time", callerName, player.PlayerName, reason, time]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_addgag")]
|
[ConsoleCommand("css_addgag")]
|
||||||
@@ -369,72 +379,82 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
PlayerInfo playerInfo = new PlayerInfo
|
Mute(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
|
||||||
|
{
|
||||||
|
if (_database == null) return;
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
muteManager ??= new MuteManager(_database);
|
||||||
|
playerPenaltyManager ??= new PlayerPenaltyManager();
|
||||||
|
|
||||||
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
SteamId = player?.SteamID.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
PlayerInfo adminInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
SteamId = caller?.SteamID.ToString(),
|
||||||
|
Name = caller?.PlayerName,
|
||||||
|
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
player!.VoiceFlags = VoiceFlags.Muted;
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 1);
|
||||||
|
});
|
||||||
|
|
||||||
|
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Mute, DateTime.Now.AddMinutes(time), time);
|
||||||
|
|
||||||
|
if (time == 0)
|
||||||
|
{
|
||||||
|
if (!player.IsBot && !player.IsHLTV)
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
{
|
{
|
||||||
SteamId = player?.SteamID.ToString(),
|
player!.PrintToCenter(_localizer!["sa_player_mute_message_perm", reason, caller == null ? "Console" : caller.PlayerName]);
|
||||||
Name = player?.PlayerName,
|
|
||||||
IpAddress = player?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
PlayerInfo adminInfo = new PlayerInfo
|
|
||||||
{
|
|
||||||
SteamId = caller?.SteamID.ToString(),
|
|
||||||
Name = caller?.PlayerName,
|
|
||||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
player!.VoiceFlags = VoiceFlags.Muted;
|
|
||||||
|
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
|
||||||
await _muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Mute, DateTime.Now.AddMinutes(time), time);
|
|
||||||
|
|
||||||
if (time == 0)
|
|
||||||
{
|
|
||||||
if (!player.IsBot && !player.IsHLTV)
|
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player!.PrintToCenter(_localizer!["sa_player_mute_message_perm", reason, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_mute_message_perm", callerName, player.PlayerName, reason]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
{
|
{
|
||||||
if (!player.IsBot && !player.IsHLTV)
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player!.PrintToCenter(_localizer!["sa_player_mute_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
{
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
{
|
sb.Append(_localizer["sa_admin_mute_message_perm", callerName, player.PlayerName, reason]);
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
_player.PrintToChat(sb.ToString());
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_mute_message_time", callerName, player.PlayerName, reason, time]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!player.IsBot && !player.IsHLTV)
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
|
{
|
||||||
|
player!.PrintToCenter(_localizer!["sa_player_mute_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]);
|
||||||
|
}
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_mute_message_time", callerName, player.PlayerName, reason, time]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_addmute")]
|
[ConsoleCommand("css_addmute")]
|
||||||
@@ -665,78 +685,90 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
PlayerInfo playerInfo = new PlayerInfo
|
Silence(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Silence(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
|
||||||
|
{
|
||||||
|
if (_database == null) return;
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
muteManager ??= new MuteManager(_database);
|
||||||
|
playerPenaltyManager ??= new PlayerPenaltyManager();
|
||||||
|
|
||||||
|
PlayerInfo playerInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
SteamId = player?.SteamID.ToString(),
|
||||||
|
Name = player?.PlayerName,
|
||||||
|
IpAddress = player?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
PlayerInfo adminInfo = new PlayerInfo
|
||||||
|
{
|
||||||
|
SteamId = caller?.SteamID.ToString(),
|
||||||
|
Name = caller?.PlayerName,
|
||||||
|
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (TagsDetected)
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
if (!player!.IsBot && !player.IsHLTV)
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
{
|
{
|
||||||
SteamId = player?.SteamID.ToString(),
|
player.PrintToCenter(_localizer!["sa_player_silence_message_perm", reason, caller == null ? "Console" : caller.PlayerName]);
|
||||||
Name = player?.PlayerName,
|
|
||||||
IpAddress = player?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
PlayerInfo adminInfo = new PlayerInfo
|
|
||||||
{
|
|
||||||
SteamId = caller?.SteamID.ToString(),
|
|
||||||
Name = caller?.PlayerName,
|
|
||||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
|
||||||
await _muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (TagsDetected)
|
|
||||||
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
|
|
||||||
|
|
||||||
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time);
|
|
||||||
|
|
||||||
if (time == 0)
|
|
||||||
{
|
|
||||||
if (!player!.IsBot && !player.IsHLTV)
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player.PrintToCenter(_localizer!["sa_player_silence_message_perm", reason, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_silence_message_perm", callerName, player.PlayerName, reason]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
if (!player!.IsBot && !player.IsHLTV)
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(player.GetLanguage()))
|
|
||||||
{
|
|
||||||
player!.PrintToCenter(_localizer!["sa_player_silence_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller == null || caller != null && caller != null && !silentPlayers.Contains(caller.Slot))
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
{
|
sb.Append(_localizer["sa_admin_silence_message_perm", callerName, player.PlayerName, reason]);
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
_player.PrintToChat(sb.ToString());
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_silence_message_time", callerName, player.PlayerName, reason, time]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!player!.IsBot && !player.IsHLTV)
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(player.GetLanguage()))
|
||||||
|
{
|
||||||
|
player!.PrintToCenter(_localizer!["sa_player_silence_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (caller == null || caller != null && caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_silence_message_time", callerName, player.PlayerName, reason, time]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_addsilence")]
|
[ConsoleCommand("css_addsilence")]
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace CS2_SimpleAdmin
|
|||||||
[CommandHelper(minArgs: 2, usage: "<question> [... options ...]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 2, usage: "<question> [... options ...]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
public void OnVoteCommand(CCSPlayerController? caller, CommandInfo command)
|
public void OnVoteCommand(CCSPlayerController? caller, CommandInfo command)
|
||||||
{
|
{
|
||||||
string callerName= 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)
|
if (command.GetArg(1) == null || command.GetArg(1).Length < 0 || command.ArgCount < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ namespace CS2_SimpleAdmin
|
|||||||
for (int i = 2; i <= answersCount - 1; i++)
|
for (int i = 2; i <= answersCount - 1; i++)
|
||||||
{
|
{
|
||||||
voteAnswers.Add(command.GetArg(i), 0);
|
voteAnswers.Add(command.GetArg(i), 0);
|
||||||
voteMenu.AddMenuOption(command.GetArg(i), Helper.handleVotes);
|
voteMenu.AddMenuOption(command.GetArg(i), Helper.HandleVotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
|||||||
@@ -31,24 +31,30 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
player!.Pawn.Value!.ToggleNoclip();
|
NoClip(caller, player, callerName);
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_noclip_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void NoClip(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
player!.Pawn.Value!.ToggleNoclip();
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_noclip_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_freeze", "Freeze a player.")]
|
[ConsoleCommand("css_freeze", "Freeze a player.")]
|
||||||
[CommandHelper(1, "<#userid or name> [duration]")]
|
[CommandHelper(1, "<#userid or name> [duration]")]
|
||||||
[RequiresPermissions("@css/slay")]
|
[RequiresPermissions("@css/slay")]
|
||||||
@@ -73,27 +79,34 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
player!.Pawn.Value!.Freeze();
|
Freeze(caller, player, time, callerName);
|
||||||
|
|
||||||
if (time > 0)
|
|
||||||
AddTimer(time, () => player.Pawn.Value!.Unfreeze(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_freeze_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Freeze(CCSPlayerController? caller, CCSPlayerController player, int time, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
player!.Pawn.Value!.Freeze();
|
||||||
|
|
||||||
|
if (time > 0)
|
||||||
|
AddTimer(time, () => player.Pawn.Value!.Unfreeze(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_freeze_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_unfreeze", "Unfreeze a player.")]
|
[ConsoleCommand("css_unfreeze", "Unfreeze a player.")]
|
||||||
[CommandHelper(1, "<#userid or name>")]
|
[CommandHelper(1, "<#userid or name>")]
|
||||||
[RequiresPermissions("@css/slay")]
|
[RequiresPermissions("@css/slay")]
|
||||||
@@ -115,21 +128,28 @@ namespace CS2_SimpleAdmin
|
|||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player!.Pawn.Value!.Unfreeze();
|
Unfreeze(caller, player, callerName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
public void Unfreeze(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
player!.Pawn.Value!.Unfreeze();
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
{
|
{
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
{
|
sb.Append(_localizer["sa_admin_unfreeze_message", callerName, player.PlayerName]);
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
_player.PrintToChat(sb.ToString());
|
||||||
sb.Append(_localizer["sa_admin_unfreeze_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using CounterStrikeSharp.API.Modules.Admin;
|
|||||||
using CounterStrikeSharp.API.Modules.Commands;
|
using CounterStrikeSharp.API.Modules.Commands;
|
||||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||||
using CounterStrikeSharp.API.Modules.Entities;
|
using CounterStrikeSharp.API.Modules.Entities;
|
||||||
|
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||||
using CounterStrikeSharp.API.Modules.Memory;
|
using CounterStrikeSharp.API.Modules.Memory;
|
||||||
using CounterStrikeSharp.API.Modules.Utils;
|
using CounterStrikeSharp.API.Modules.Utils;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
@@ -33,25 +34,32 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
Slay(caller, player, callerName);
|
||||||
return;
|
});
|
||||||
|
}
|
||||||
|
|
||||||
player.CommitSuicide(false, true);
|
public void Slay(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||||
|
{
|
||||||
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
|
return;
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
player.CommitSuicide(false, true);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
{
|
{
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
sb.Append(_localizer["sa_admin_slay_message", callerName, player.PlayerName]);
|
sb.Append(_localizer["sa_admin_slay_message", callerName, player.PlayerName]);
|
||||||
_player.PrintToChat(sb.ToString());
|
_player.PrintToChat(sb.ToString());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_give")]
|
[ConsoleCommand("css_give")]
|
||||||
@@ -101,21 +109,36 @@ namespace CS2_SimpleAdmin
|
|||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.GiveNamedItem(weaponName);
|
GiveWeapon(caller, player, weaponName, callerName);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, CsItem weapon, string? callerName = null)
|
||||||
|
{
|
||||||
|
player.GiveNamedItem(weapon);
|
||||||
|
SubGiveWeapon(caller, player, weapon.ToString(), callerName);
|
||||||
|
}
|
||||||
|
public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null)
|
||||||
|
{
|
||||||
|
player.GiveNamedItem(weaponName);
|
||||||
|
SubGiveWeapon(caller, player, weaponName, callerName);
|
||||||
|
}
|
||||||
|
public void SubGiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
{
|
{
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
{
|
sb.Append(_localizer["sa_admin_give_message", callerName, player.PlayerName, weaponName]);
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
_player.PrintToChat(sb.ToString());
|
||||||
sb.Append(_localizer["sa_admin_give_message", callerName, player.PlayerName, weaponName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_strip")]
|
[ConsoleCommand("css_strip")]
|
||||||
@@ -139,27 +162,34 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
StripWeapons(caller, player, callerName);
|
||||||
return;
|
|
||||||
|
|
||||||
player.RemoveWeapons();
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_strip_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void StripWeapons(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
|
return;
|
||||||
|
|
||||||
|
player.RemoveWeapons();
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_strip_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_hp")]
|
[ConsoleCommand("css_hp")]
|
||||||
[RequiresPermissions("@css/slay")]
|
[RequiresPermissions("@css/slay")]
|
||||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> <health>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 1, usage: "<#userid or name> <health>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
@@ -184,27 +214,34 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
SetHp(caller, player, health, callerName);
|
||||||
return;
|
|
||||||
|
|
||||||
player.SetHp(health);
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_hp_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetHp(CCSPlayerController? caller, CCSPlayerController player, int health, string? callerName = null)
|
||||||
|
{
|
||||||
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
|
return;
|
||||||
|
|
||||||
|
callerName = caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
player.SetHp(health);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_hp_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_speed")]
|
[ConsoleCommand("css_speed")]
|
||||||
[RequiresPermissions("@css/slay")]
|
[RequiresPermissions("@css/slay")]
|
||||||
[CommandHelper(minArgs: 1, usage: "<#userid or name> <speed>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 1, usage: "<#userid or name> <speed>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
@@ -232,29 +269,31 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
/*
|
SetSpeed(caller, player, speed, callerName);
|
||||||
player.Speed = (float)speed;
|
|
||||||
player.PlayerPawn.Value!.Speed = (float)speed;
|
|
||||||
*/
|
|
||||||
player.SetSpeed((float)speed);
|
|
||||||
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_speed_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetSpeed(CCSPlayerController? caller, CCSPlayerController player, double speed, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
player.SetSpeed((float)speed);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_speed_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_god")]
|
[ConsoleCommand("css_god")]
|
||||||
[RequiresPermissions("@css/cheats")]
|
[RequiresPermissions("@css/cheats")]
|
||||||
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
@@ -279,33 +318,40 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (player != null)
|
God(caller, player, callerName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void God(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
if (!godPlayers.Contains(player.Slot))
|
||||||
|
{
|
||||||
|
godPlayers.Add(player.Slot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
godPlayers = new ConcurrentBag<int>(godPlayers.Where(item => item != player.Slot));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
{
|
{
|
||||||
if (!godPlayers.Contains(player.Slot))
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
godPlayers.Add(player.Slot);
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
}
|
sb.Append(_localizer["sa_admin_god_message", callerName, player.PlayerName]);
|
||||||
else
|
_player.PrintToChat(sb.ToString());
|
||||||
{
|
|
||||||
godPlayers = new ConcurrentBag<int>(godPlayers.Where(item => item != player.Slot));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_god_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_slap")]
|
[ConsoleCommand("css_slap")]
|
||||||
@@ -339,24 +385,30 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
player!.Pawn.Value!.Slap(damage);
|
Slap(caller, player, damage);
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_slap_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Slap(CCSPlayerController? caller, CCSPlayerController player, int damage, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
player!.Pawn.Value!.Slap(damage);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_slap_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_team")]
|
[ConsoleCommand("css_team")]
|
||||||
[RequiresPermissions("@css/kick")]
|
[RequiresPermissions("@css/kick")]
|
||||||
[CommandHelper(minArgs: 2, usage: "<#userid or name> [<ct/tt/spec>] [-k]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 2, usage: "<#userid or name> [<ct/tt/spec>] [-k]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
@@ -364,7 +416,7 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
string callerName = caller == null ? "Console" : caller.PlayerName;
|
string callerName = caller == null ? "Console" : caller.PlayerName;
|
||||||
string teamName = command.GetArg(2).ToLower();
|
string teamName = command.GetArg(2).ToLower();
|
||||||
string _teamName;
|
string _teamName = "SPEC";
|
||||||
CsTeam teamNum = CsTeam.Spectator;
|
CsTeam teamNum = CsTeam.Spectator;
|
||||||
|
|
||||||
TargetResult? targets = GetTarget(command);
|
TargetResult? targets = GetTarget(command);
|
||||||
@@ -403,50 +455,58 @@ namespace CS2_SimpleAdmin
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool kill = command.GetArg(3).ToLower().Equals("-k");
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
ChangeTeam(caller, player, _teamName.ToLower(), teamNum, kill, callerName);
|
||||||
return;
|
|
||||||
|
|
||||||
if (!teamName.Equals("swap"))
|
|
||||||
{
|
|
||||||
if (player.PawnIsAlive && teamNum != CsTeam.Spectator && !command.GetArg(3).ToLower().Equals("-k") && Config.TeamSwitchType == 1)
|
|
||||||
player.SwitchTeam(teamNum);
|
|
||||||
else
|
|
||||||
player.ChangeTeam(teamNum);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (player.TeamNum != (byte)CsTeam.Spectator)
|
|
||||||
{
|
|
||||||
CsTeam teamNum = (CsTeam)player.TeamNum == CsTeam.Terrorist ? CsTeam.CounterTerrorist : CsTeam.Terrorist;
|
|
||||||
_teamName = teamNum == CsTeam.Terrorist ? "TT" : "CT";
|
|
||||||
if (player.PawnIsAlive && !command.GetArg(3).ToLower().Equals("-k") && Config.TeamSwitchType == 1)
|
|
||||||
{
|
|
||||||
player.SwitchTeam(teamNum);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player.ChangeTeam(teamNum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_team_message", callerName, player.PlayerName, _teamName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangeTeam(CCSPlayerController? caller, CCSPlayerController player, string teamName, CsTeam teamNum, bool kill, string? callerName = null)
|
||||||
|
{
|
||||||
|
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
||||||
|
return;
|
||||||
|
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
if (!teamName.Equals("swap"))
|
||||||
|
{
|
||||||
|
if (player.PawnIsAlive && teamNum != CsTeam.Spectator && !kill && Config.TeamSwitchType == 1)
|
||||||
|
player.SwitchTeam(teamNum);
|
||||||
|
else
|
||||||
|
player.ChangeTeam(teamNum);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (player.TeamNum != (byte)CsTeam.Spectator)
|
||||||
|
{
|
||||||
|
CsTeam _teamNum = (CsTeam)player.TeamNum == CsTeam.Terrorist ? CsTeam.CounterTerrorist : CsTeam.Terrorist;
|
||||||
|
teamName = _teamNum == CsTeam.Terrorist ? "TT" : "CT";
|
||||||
|
if (player.PawnIsAlive && !kill && Config.TeamSwitchType == 1)
|
||||||
|
{
|
||||||
|
player.SwitchTeam(_teamNum);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.ChangeTeam(_teamNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_team_message", callerName, player.PlayerName, teamName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_rename", "Rename a player.")]
|
[ConsoleCommand("css_rename", "Rename a player.")]
|
||||||
[CommandHelper(1, "<#userid or name> <new name>")]
|
[CommandHelper(1, "<#userid or name> <new name>")]
|
||||||
[RequiresPermissions("@css/kick")]
|
[RequiresPermissions("@css/kick")]
|
||||||
@@ -515,30 +575,37 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
if (CBasePlayerController_SetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return;
|
Respawn(caller, player, callerName);
|
||||||
|
|
||||||
var playerPawn = player.PlayerPawn.Value;
|
|
||||||
CBasePlayerController_SetPawnFunc.Invoke(player, playerPawn, true, false);
|
|
||||||
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
|
|
||||||
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
|
|
||||||
|
|
||||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
|
||||||
{
|
|
||||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
|
||||||
{
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
|
||||||
{
|
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
sb.Append(_localizer["sa_admin_respawn_message", callerName, player.PlayerName]);
|
|
||||||
_player.PrintToChat(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Respawn(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null)
|
||||||
|
{
|
||||||
|
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|
||||||
|
if (CBasePlayerController_SetPawnFunc == null || player.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return;
|
||||||
|
|
||||||
|
var playerPawn = player.PlayerPawn.Value;
|
||||||
|
CBasePlayerController_SetPawnFunc.Invoke(player, playerPawn, true, false);
|
||||||
|
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
|
||||||
|
GameData.GetOffset("CCSPlayerController_Respawn"))(player);
|
||||||
|
|
||||||
|
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||||
|
{
|
||||||
|
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||||
|
{
|
||||||
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
|
{
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
sb.Append(_localizer["sa_admin_respawn_message", callerName, player.PlayerName]);
|
||||||
|
_player.PrintToChat(sb.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[ConsoleCommand("css_tp", "Teleport to a player.")]
|
[ConsoleCommand("css_tp", "Teleport to a player.")]
|
||||||
[ConsoleCommand("css_tpto", "Teleport to a player.")]
|
[ConsoleCommand("css_tpto", "Teleport to a player.")]
|
||||||
[ConsoleCommand("css_goto", "Teleport to a player.")]
|
[ConsoleCommand("css_goto", "Teleport to a player.")]
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ namespace CS2_SimpleAdmin
|
|||||||
[JsonPropertyName("DatabaseName")]
|
[JsonPropertyName("DatabaseName")]
|
||||||
public string DatabaseName { get; set; } = "";
|
public string DatabaseName { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonPropertyName("UseChatMenu")]
|
||||||
|
public bool UseChatMenu { get; set; } = false;
|
||||||
|
|
||||||
[JsonPropertyName("KickTime")]
|
[JsonPropertyName("KickTime")]
|
||||||
public int KickTime { get; set; } = 5;
|
public int KickTime { get; set; } = 5;
|
||||||
|
|
||||||
@@ -44,5 +47,11 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
[JsonPropertyName("Discord")]
|
[JsonPropertyName("Discord")]
|
||||||
public Discord Discord { get; set; } = new Discord();
|
public Discord Discord { get; set; } = new Discord();
|
||||||
|
|
||||||
|
[JsonPropertyName("DefaultMaps")]
|
||||||
|
public List<string> DefaultMaps { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
[JsonPropertyName("WorkshopMaps")]
|
||||||
|
public List<string> WorkshopMaps { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -41,29 +41,15 @@ public static class PlayerExtensions
|
|||||||
public static void SetHp(this CCSPlayerController controller, int health = 100)
|
public static void SetHp(this CCSPlayerController controller, int health = 100)
|
||||||
{
|
{
|
||||||
if (health <= 0 || !controller.PawnIsAlive || controller.PlayerPawn.Value == null) return;
|
if (health <= 0 || !controller.PawnIsAlive || controller.PlayerPawn.Value == null) return;
|
||||||
|
|
||||||
controller.Health = health;
|
|
||||||
controller.PlayerPawn.Value.Health = health;
|
controller.PlayerPawn.Value.Health = health;
|
||||||
|
|
||||||
if (health > 100)
|
if (health > 100)
|
||||||
{
|
{
|
||||||
controller.MaxHealth = health;
|
|
||||||
controller.PlayerPawn.Value.MaxHealth = health;
|
controller.PlayerPawn.Value.MaxHealth = health;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlayer_WeaponServices? weaponServices = controller.PlayerPawn.Value!.WeaponServices;
|
Utilities.SetStateChanged(controller.PlayerPawn.Value, "CBaseEntity", "m_iHealth");
|
||||||
if (weaponServices == null) return;
|
|
||||||
|
|
||||||
controller.GiveNamedItem("weapon_healthshot");
|
|
||||||
|
|
||||||
foreach (var weapon in weaponServices.MyWeapons)
|
|
||||||
{
|
|
||||||
if (weapon != null && weapon.IsValid && weapon.Value!.DesignerName == "weapon_healthshot")
|
|
||||||
{
|
|
||||||
weapon.Value.Remove();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Bury(this CBasePlayerPawn pawn, float depth = 10f)
|
public static void Bury(this CBasePlayerPawn pawn, float depth = 10f)
|
||||||
@@ -114,24 +100,24 @@ public static class PlayerExtensions
|
|||||||
|
|
||||||
public static void Rename(this CCSPlayerController controller, string newName = "Unknown")
|
public static void Rename(this CCSPlayerController controller, string newName = "Unknown")
|
||||||
{
|
{
|
||||||
if (CS2_SimpleAdmin._plugin == null)
|
if (CS2_SimpleAdmin.Instance == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SchemaString<CBasePlayerController> playerName = new SchemaString<CBasePlayerController>(controller, "m_iszPlayerName");
|
SchemaString<CBasePlayerController> playerName = new SchemaString<CBasePlayerController>(controller, "m_iszPlayerName");
|
||||||
playerName.Set(newName + " ");
|
playerName.Set(newName + " ");
|
||||||
|
|
||||||
CS2_SimpleAdmin._plugin.AddTimer(0.25f, () =>
|
CS2_SimpleAdmin.Instance.AddTimer(0.25f, () =>
|
||||||
{
|
{
|
||||||
Utilities.SetStateChanged(controller, "CCSPlayerController", "m_szClan");
|
Utilities.SetStateChanged(controller, "CCSPlayerController", "m_szClan");
|
||||||
Utilities.SetStateChanged(controller, "CBasePlayerController", "m_iszPlayerName");
|
Utilities.SetStateChanged(controller, "CBasePlayerController", "m_iszPlayerName");
|
||||||
});
|
});
|
||||||
|
|
||||||
CS2_SimpleAdmin._plugin.AddTimer(0.3f, () =>
|
CS2_SimpleAdmin.Instance.AddTimer(0.3f, () =>
|
||||||
{
|
{
|
||||||
playerName.Set(newName);
|
playerName.Set(newName);
|
||||||
});
|
});
|
||||||
|
|
||||||
CS2_SimpleAdmin._plugin.AddTimer(0.4f, () =>
|
CS2_SimpleAdmin.Instance.AddTimer(0.4f, () =>
|
||||||
{
|
{
|
||||||
Utilities.SetStateChanged(controller, "CBasePlayerController", "m_iszPlayerName");
|
Utilities.SetStateChanged(controller, "CBasePlayerController", "m_iszPlayerName");
|
||||||
});
|
});
|
||||||
@@ -172,12 +158,15 @@ public static class PlayerExtensions
|
|||||||
vel.Y += ((random.Next(180) + 50) * ((random.Next(2) == 1) ? -1 : 1));
|
vel.Y += ((random.Next(180) + 50) * ((random.Next(2) == 1) ? -1 : 1));
|
||||||
vel.Z += random.Next(200) + 100;
|
vel.Z += random.Next(200) + 100;
|
||||||
|
|
||||||
pawn.Teleport(pawn.AbsOrigin!, pawn.AbsRotation!, vel);
|
pawn.AbsVelocity.X = vel.X;
|
||||||
|
pawn.AbsVelocity.Y = vel.Y;
|
||||||
|
pawn.AbsVelocity.Z = vel.Z;
|
||||||
|
|
||||||
if (damage <= 0)
|
if (damage <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pawn.Health -= damage;
|
pawn.Health -= damage;
|
||||||
|
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||||
|
|
||||||
if (pawn.Health <= 0)
|
if (pawn.Health <= 0)
|
||||||
pawn.CommitSuicide(true, true);
|
pawn.CommitSuicide(true, true);
|
||||||
|
|||||||
41
Helper.cs
41
Helper.cs
@@ -43,6 +43,13 @@ namespace CS2_SimpleAdmin
|
|||||||
return Utilities.GetPlayers().FindAll(p => p != null && p.IsValid && p.SteamID.ToString().Length == 17 && p.Connected == PlayerConnectedState.PlayerConnected && !p.IsBot && !p.IsHLTV);
|
return Utilities.GetPlayers().FindAll(p => p != null && p.IsValid && p.SteamID.ToString().Length == 17 && p.Connected == PlayerConnectedState.PlayerConnected && !p.IsBot && !p.IsHLTV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<CCSPlayerController> GetValidPlayersWithBots()
|
||||||
|
{
|
||||||
|
return Utilities.GetPlayers().FindAll(p =>
|
||||||
|
p != null && p.IsValid && p.SteamID.ToString().Length == 17 && p.Connected == PlayerConnectedState.PlayerConnected && !p.IsBot && !p.IsHLTV ||
|
||||||
|
p != null && p.IsValid && p.Connected == PlayerConnectedState.PlayerConnected && p.IsBot && !p.IsHLTV
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static bool IsValidSteamID64(string input)
|
public static bool IsValidSteamID64(string input)
|
||||||
{
|
{
|
||||||
@@ -64,15 +71,11 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (steamid == null || (flags == null && immunity == 0))
|
if (steamid == null || (flags == null && immunity == 0))
|
||||||
{
|
{
|
||||||
//Console.WriteLine("Invalid input: steamid is null or both flags and immunity are not provided.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Console.WriteLine($"Setting immunity for SteamID {steamid} to {immunity}");
|
|
||||||
|
|
||||||
if (flags != null)
|
if (flags != null)
|
||||||
{
|
{
|
||||||
//Console.WriteLine($"Applying flags to SteamID {steamid}:");
|
|
||||||
|
|
||||||
foreach (var flag in flags)
|
foreach (var flag in flags)
|
||||||
{
|
{
|
||||||
@@ -96,33 +99,9 @@ namespace CS2_SimpleAdmin
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
//Console.WriteLine($"An error occurred: {ex}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
public static TargetResult GetTarget(string target, out CCSPlayerController? player)
|
|
||||||
{
|
|
||||||
player = null;
|
|
||||||
|
|
||||||
if (target.StartsWith("#") && int.TryParse(target.AsSpan(1), out var userid))
|
|
||||||
{
|
|
||||||
player = Utilities.GetPlayerFromUserid(userid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var matches = GetPlayerFromName(target);
|
|
||||||
if (matches.Count > 1)
|
|
||||||
return TargetResult.Multiple;
|
|
||||||
|
|
||||||
player = matches.FirstOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
return player?.IsValid == true ? TargetResult.Single : TargetResult.None;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static void KickPlayer(ushort userId, string? reason = null)
|
public static void KickPlayer(ushort userId, string? reason = null)
|
||||||
{
|
{
|
||||||
Server.ExecuteCommand($"kickid {userId} {reason}");
|
Server.ExecuteCommand($"kickid {userId} {reason}");
|
||||||
@@ -155,7 +134,7 @@ namespace CS2_SimpleAdmin
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void handleVotes(CCSPlayerController player, ChatMenuOption option)
|
internal static void HandleVotes(CCSPlayerController player, ChatMenuOption option)
|
||||||
{
|
{
|
||||||
if (CS2_SimpleAdmin.voteInProgress && !CS2_SimpleAdmin.votePlayers.Contains(player.Slot))
|
if (CS2_SimpleAdmin.voteInProgress && !CS2_SimpleAdmin.votePlayers.Contains(player.Slot))
|
||||||
{
|
{
|
||||||
@@ -216,7 +195,7 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
public unsafe void Set(string str)
|
public unsafe void Set(string str)
|
||||||
{
|
{
|
||||||
byte[] bytes = this.GetStringBytes(str);
|
byte[] bytes = SchemaString<SchemaClass>.GetStringBytes(str);
|
||||||
|
|
||||||
for (int i = 0; i < bytes.Length; i++)
|
for (int i = 0; i < bytes.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -226,7 +205,7 @@ namespace CS2_SimpleAdmin
|
|||||||
Unsafe.Write((void*)(this.Handle.ToInt64() + bytes.Length), 0);
|
Unsafe.Write((void*)(this.Handle.ToInt64() + bytes.Length), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] GetStringBytes(string str)
|
private static byte[] GetStringBytes(string str)
|
||||||
{
|
{
|
||||||
return Encoding.ASCII.GetBytes(str);
|
return Encoding.ASCII.GetBytes(str);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
|
|
||||||
namespace CS2_SimpleAdmin
|
namespace CS2_SimpleAdmin
|
||||||
{
|
{
|
||||||
public class MuteManager
|
internal class MuteManager
|
||||||
{
|
{
|
||||||
private readonly Database _database;
|
private readonly Database _database;
|
||||||
|
|
||||||
|
|||||||
60
Menus/AdminMenu.cs
Normal file
60
Menus/AdminMenu.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Modules.Admin;
|
||||||
|
using CounterStrikeSharp.API.Modules.Menu;
|
||||||
|
|
||||||
|
namespace CS2_SimpleAdmin.Menus
|
||||||
|
{
|
||||||
|
public static class AdminMenu
|
||||||
|
{
|
||||||
|
public static BaseMenu CreateMenu(string title)
|
||||||
|
{
|
||||||
|
return CS2_SimpleAdmin.Instance.Config.UseChatMenu ? new ChatMenu(title) : new CenterHtmlMenu(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OpenMenu(CCSPlayerController player, BaseMenu menu)
|
||||||
|
{
|
||||||
|
if (menu is CenterHtmlMenu centerHtmlMenu)
|
||||||
|
{
|
||||||
|
MenuManager.OpenCenterHtmlMenu(CS2_SimpleAdmin.Instance, player, centerHtmlMenu);
|
||||||
|
}
|
||||||
|
else if (menu is ChatMenu chatMenu)
|
||||||
|
{
|
||||||
|
MenuManager.OpenChatMenu(player, chatMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OpenMenu(CCSPlayerController admin)
|
||||||
|
{
|
||||||
|
if (admin == null || admin.IsValid == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AdminManager.PlayerHasPermissions(admin, "@css/generic") == false)
|
||||||
|
{
|
||||||
|
// TODO: Localize
|
||||||
|
admin.PrintToChat("[Simple Admin] You do not have permissions to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool xpRights = AdminManager.PlayerHasPermissions(admin, "@wcs/xp");
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu("Simple Admin");
|
||||||
|
List<ChatMenuOptionData> options = new()
|
||||||
|
{
|
||||||
|
new ChatMenuOptionData("Manage Players", () => ManagePlayersMenu.OpenMenu(admin)),
|
||||||
|
new ChatMenuOptionData("Manage Server", () => ManageServerMenu.OpenMenu(admin)),
|
||||||
|
new ChatMenuOptionData("Fun actions", () => FunActionsMenu.OpenMenu(admin)),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (AdminManager.PlayerHasPermissions(admin, "@css/root"))
|
||||||
|
options.Add(new ChatMenuOptionData("Manage Admins", () => ManageAdminsMenu.OpenMenu(admin)));
|
||||||
|
|
||||||
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
{
|
||||||
|
string menuName = menuOptionData.name;
|
||||||
|
menu.AddMenuOption(menuName, (_, _) => { menuOptionData.action?.Invoke(); }, menuOptionData.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Menus/ChatMenuOptionData.cs
Normal file
23
Menus/ChatMenuOptionData.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
namespace CS2_SimpleAdmin.Menus
|
||||||
|
{
|
||||||
|
public class ChatMenuOptionData
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public Action action;
|
||||||
|
public bool disabled = true;
|
||||||
|
|
||||||
|
public ChatMenuOptionData(string name, Action action)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.action = action;
|
||||||
|
this.disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChatMenuOptionData(string name, Action action, bool disabled)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.action = action;
|
||||||
|
this.disabled = disabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Menus/DurationMenu.cs
Normal file
32
Menus/DurationMenu.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Modules.Menu;
|
||||||
|
|
||||||
|
namespace CS2_SimpleAdmin.Menus
|
||||||
|
{
|
||||||
|
public static class DurationMenu
|
||||||
|
{
|
||||||
|
// TODO: Localize
|
||||||
|
public static Tuple<string, int>[] _durations = new[]
|
||||||
|
{
|
||||||
|
new Tuple<string, int>("1 minute", 1),
|
||||||
|
new Tuple<string, int>("5 minutes", 5),
|
||||||
|
new Tuple<string, int>("15 minutes", 15),
|
||||||
|
new Tuple<string, int>("1 hour", 60),
|
||||||
|
new Tuple<string, int>("1 day", 60 * 24),
|
||||||
|
new Tuple<string, int>("Permanent", 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
public static void OpenMenu(CCSPlayerController admin, string menuName, CCSPlayerController player, Action<CCSPlayerController, CCSPlayerController, int> onSelectAction)
|
||||||
|
{
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu(menuName);
|
||||||
|
|
||||||
|
foreach (Tuple<string, int> duration in _durations)
|
||||||
|
{
|
||||||
|
string optionName = duration.Item1;
|
||||||
|
menu.AddMenuOption(optionName, (_, _) => { onSelectAction?.Invoke(admin, player, duration.Item2); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
187
Menus/FunActionsMenu.cs
Normal file
187
Menus/FunActionsMenu.cs
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Modules.Admin;
|
||||||
|
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||||
|
using CounterStrikeSharp.API.Modules.Menu;
|
||||||
|
|
||||||
|
namespace CS2_SimpleAdmin.Menus
|
||||||
|
{
|
||||||
|
public static class FunActionsMenu
|
||||||
|
{
|
||||||
|
private static Dictionary<int, CsItem>? _weaponsCache = null;
|
||||||
|
private static Dictionary<int, CsItem> GetWeaponsCache
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_weaponsCache == null)
|
||||||
|
{
|
||||||
|
Array weaponsArray = Enum.GetValues(typeof(CsItem));
|
||||||
|
|
||||||
|
// avoid duplicates in the menu
|
||||||
|
_weaponsCache = new();
|
||||||
|
foreach (CsItem item in weaponsArray)
|
||||||
|
{
|
||||||
|
if (item == CsItem.Tablet) continue;
|
||||||
|
|
||||||
|
_weaponsCache[(int)item] = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _weaponsCache;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void OpenMenu(CCSPlayerController admin)
|
||||||
|
{
|
||||||
|
if (admin == null || admin.IsValid == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AdminManager.PlayerHasPermissions(admin, "@css/generic") == false)
|
||||||
|
{
|
||||||
|
// TODO: Localize
|
||||||
|
admin.PrintToChat("[Simple Admin] You do not have permissions to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu("Fun Actions");
|
||||||
|
List<ChatMenuOptionData> options = new();
|
||||||
|
|
||||||
|
// permissions
|
||||||
|
bool hasCheats = AdminManager.PlayerHasPermissions(admin, "@css/cheats");
|
||||||
|
bool hasSlay = AdminManager.PlayerHasPermissions(admin, "@css/slay");
|
||||||
|
|
||||||
|
// TODO: Localize options
|
||||||
|
// options added in order
|
||||||
|
|
||||||
|
if (hasCheats)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData("God Mode", () => PlayersMenu.OpenAliveMenu(admin, "God Mode", GodMode)));
|
||||||
|
options.Add(new ChatMenuOptionData("No Clip", () => PlayersMenu.OpenAliveMenu(admin, "No Clip", NoClip)));
|
||||||
|
options.Add(new ChatMenuOptionData("Respawn", () => PlayersMenu.OpenAliveMenu(admin, "Respawn", Respawn)));
|
||||||
|
options.Add(new ChatMenuOptionData("Give Weapon", () => PlayersMenu.OpenAliveMenu(admin, "Give Weapon", GiveWeaponMenu)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasSlay)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData("Strip All Weapons", () => PlayersMenu.OpenAliveMenu(admin, "Strip All Weapons", StripWeapons)));
|
||||||
|
options.Add(new ChatMenuOptionData("Freeze", () => PlayersMenu.OpenAliveMenu(admin, "Freeze", Freeze)));
|
||||||
|
options.Add(new ChatMenuOptionData("HP", () => PlayersMenu.OpenAliveMenu(admin, "HP", SetHpMenu)));
|
||||||
|
options.Add(new ChatMenuOptionData("Speed", () => PlayersMenu.OpenAliveMenu(admin, "Speed", SetSpeedMenu)));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
{
|
||||||
|
string menuName = menuOptionData.name;
|
||||||
|
menu.AddMenuOption(menuName, (_, _) => { menuOptionData.action?.Invoke(); }, menuOptionData.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void GodMode(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.God(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void NoClip(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.NoClip(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Respawn(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Respawn(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GiveWeaponMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Give Weapon: {player.PlayerName}");
|
||||||
|
|
||||||
|
foreach (KeyValuePair<int, CsItem> weapon in GetWeaponsCache)
|
||||||
|
{
|
||||||
|
menu.AddMenuOption(weapon.Value.ToString(), (_, _) => { GiveWeapon(admin, player, weapon.Value); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GiveWeapon(CCSPlayerController admin, CCSPlayerController player, CsItem weaponValue)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.GiveWeapon(admin, player, weaponValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void StripWeapons(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.StripWeapons(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Freeze(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
if (!(player.PlayerPawn?.Value?.IsValid ?? false)) return;
|
||||||
|
|
||||||
|
if (player.PlayerPawn.Value.MoveType != MoveType_t.MOVETYPE_OBSOLETE)
|
||||||
|
CS2_SimpleAdmin.Instance.Freeze(admin, player, -1);
|
||||||
|
else
|
||||||
|
CS2_SimpleAdmin.Instance.Unfreeze(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetHpMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
Tuple<string, int>[] _hpArray = new[]
|
||||||
|
{
|
||||||
|
new Tuple<string, int>("1", 1),
|
||||||
|
new Tuple<string, int>("10", 10),
|
||||||
|
new Tuple<string, int>("25", 25),
|
||||||
|
new Tuple<string, int>("50", 50),
|
||||||
|
new Tuple<string, int>("100", 100),
|
||||||
|
new Tuple<string, int>("200", 200),
|
||||||
|
new Tuple<string, int>("500", 500),
|
||||||
|
new Tuple<string, int>("999", 999)
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Set HP: {player.PlayerName}");
|
||||||
|
|
||||||
|
foreach (Tuple<string, int> hpTuple in _hpArray)
|
||||||
|
{
|
||||||
|
string optionName = hpTuple.Item1;
|
||||||
|
menu.AddMenuOption(optionName, (_, _) => { SetHP(admin, player, hpTuple.Item2); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetHP(CCSPlayerController admin, CCSPlayerController player, int hp)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.SetHp(admin, player, hp);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetSpeedMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
Tuple<string, float>[] _speedArray = new[]
|
||||||
|
{
|
||||||
|
new Tuple<string, float>("0.1", .1f),
|
||||||
|
new Tuple<string, float>("0.25", .25f),
|
||||||
|
new Tuple<string, float>("0.5", .5f),
|
||||||
|
new Tuple<string, float>("0.75", .75f),
|
||||||
|
new Tuple<string, float>("1", 1),
|
||||||
|
new Tuple<string, float>("2", 2),
|
||||||
|
new Tuple<string, float>("3", 3),
|
||||||
|
new Tuple<string, float>("4", 4)
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Set Speed: {player.PlayerName}");
|
||||||
|
|
||||||
|
foreach (Tuple<string, float> speedTuple in _speedArray)
|
||||||
|
{
|
||||||
|
string optionName = speedTuple.Item1;
|
||||||
|
menu.AddMenuOption(optionName, (_, _) => { SetSpeed(admin, player, speedTuple.Item2); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetSpeed(CCSPlayerController admin, CCSPlayerController player, float speed)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.SetSpeed(admin, player, speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
85
Menus/ManageAdminsMenu.cs
Normal file
85
Menus/ManageAdminsMenu.cs
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Modules.Admin;
|
||||||
|
using CounterStrikeSharp.API.Modules.Menu;
|
||||||
|
|
||||||
|
namespace CS2_SimpleAdmin.Menus
|
||||||
|
{
|
||||||
|
public static class ManageAdminsMenu
|
||||||
|
{
|
||||||
|
public static void OpenMenu(CCSPlayerController admin)
|
||||||
|
{
|
||||||
|
if (admin == null || admin.IsValid == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AdminManager.PlayerHasPermissions(admin, "@css/generic") == false)
|
||||||
|
{
|
||||||
|
// TODO: Localize
|
||||||
|
admin.PrintToChat("[Simple Admin] You do not have permissions to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu("Manage Admins");
|
||||||
|
List<ChatMenuOptionData> options = new();
|
||||||
|
|
||||||
|
// TODO: Localize options
|
||||||
|
// options added in order
|
||||||
|
|
||||||
|
options.Add(new ChatMenuOptionData("Add Admin", () => PlayersMenu.OpenAliveMenu(admin, "Add Admin", AddAdminMenu)));
|
||||||
|
options.Add(new ChatMenuOptionData("Remove Admin", () => PlayersMenu.OpenAliveMenu(admin, "Remove Admin", RemoveAdmin, player => player != admin && admin.CanTarget(player))));
|
||||||
|
options.Add(new ChatMenuOptionData("Reload Admins", ReloadAdmins));
|
||||||
|
|
||||||
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
{
|
||||||
|
string menuName = menuOptionData.name;
|
||||||
|
menu.AddMenuOption(menuName, (_, _) => { menuOptionData.action?.Invoke(); }, menuOptionData.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddAdminMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
Tuple<string, string>[] flags = new[]
|
||||||
|
{
|
||||||
|
new Tuple<string, string>("Generic", "@css/generic"),
|
||||||
|
new Tuple<string, string>("Chat", "@css/chat"),
|
||||||
|
new Tuple<string, string>("Change Map", "@css/changemap"),
|
||||||
|
new Tuple<string, string>("Slay", "@css/slay"),
|
||||||
|
new Tuple<string, string>("Kick", "@css/kick"),
|
||||||
|
new Tuple<string, string>("Ban", "@css/ban"),
|
||||||
|
new Tuple<string, string>("Unban", "@css/unban"),
|
||||||
|
new Tuple<string, string>("Cheats", "@css/cheats"),
|
||||||
|
new Tuple<string, string>("CVAR", "@css/cvar"),
|
||||||
|
new Tuple<string, string>("RCON", "@css/rcon"),
|
||||||
|
new Tuple<string, string>("Root", "@css/root"),
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Add Admin: {player.PlayerName}");
|
||||||
|
|
||||||
|
foreach (Tuple<string, string> flagsTuple in flags)
|
||||||
|
{
|
||||||
|
string optionName = flagsTuple.Item1;
|
||||||
|
bool disabled = AdminManager.PlayerHasPermissions(player, flagsTuple.Item2);
|
||||||
|
menu.AddMenuOption(optionName, (_, _) => { AddAdmin(admin, player, flagsTuple.Item2); }, disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AddAdmin(CCSPlayerController admin, CCSPlayerController player, string flag)
|
||||||
|
{
|
||||||
|
// TODO: Change default immunity?
|
||||||
|
CS2_SimpleAdmin.Instance.AddAdmin(admin, player.SteamID.ToString(), player.PlayerName, flag, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RemoveAdmin(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.RemoveAdmin(admin, player.SteamID.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ReloadAdmins()
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.ReloadAdmins();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
262
Menus/ManagePlayersMenu.cs
Normal file
262
Menus/ManagePlayersMenu.cs
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Modules.Admin;
|
||||||
|
using CounterStrikeSharp.API.Modules.Menu;
|
||||||
|
using CounterStrikeSharp.API.Modules.Utils;
|
||||||
|
|
||||||
|
namespace CS2_SimpleAdmin.Menus
|
||||||
|
{
|
||||||
|
public static class ManagePlayersMenu
|
||||||
|
{
|
||||||
|
public static void OpenMenu(CCSPlayerController admin)
|
||||||
|
{
|
||||||
|
if (admin == null || admin.IsValid == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AdminManager.PlayerHasPermissions(admin, "@css/generic") == false)
|
||||||
|
{
|
||||||
|
// TODO: Localize
|
||||||
|
admin.PrintToChat("[Simple Admin] You do not have permissions to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu("Manage Players");
|
||||||
|
List<ChatMenuOptionData> options = new();
|
||||||
|
|
||||||
|
// permissions
|
||||||
|
bool hasSlay = AdminManager.PlayerHasPermissions(admin, "@css/slay");
|
||||||
|
bool hasKick = AdminManager.PlayerHasPermissions(admin, "@css/kick");
|
||||||
|
bool hasBan = AdminManager.PlayerHasPermissions(admin, "@css/ban");
|
||||||
|
bool hasChat = AdminManager.PlayerHasPermissions(admin, "@css/chat");
|
||||||
|
|
||||||
|
// TODO: Localize options
|
||||||
|
// options added in order
|
||||||
|
|
||||||
|
if (hasSlay)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData("Slap", () => PlayersMenu.OpenMenu(admin, "Slap", SlapMenu)));
|
||||||
|
options.Add(new ChatMenuOptionData("Slay", () => PlayersMenu.OpenMenu(admin, "Slay", Slay)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasKick)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData("Kick", () => PlayersMenu.OpenMenu(admin, "Kick", KickMenu)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasBan)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData("Ban", () => PlayersMenu.OpenMenu(admin, "Ban", (admin, player) => DurationMenu.OpenMenu(admin, $"Ban: {player.PlayerName}", player, BanMenu))));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasChat)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData("Gag", () => PlayersMenu.OpenMenu(admin, "Gag", (admin, player) => DurationMenu.OpenMenu(admin, $"Gag: {player.PlayerName}", player, GagMenu))));
|
||||||
|
options.Add(new ChatMenuOptionData("Mute", () => PlayersMenu.OpenMenu(admin, "Mute", (admin, player) => DurationMenu.OpenMenu(admin, $"Mute: {player.PlayerName}", player, MuteMenu))));
|
||||||
|
options.Add(new ChatMenuOptionData("Silence", () => PlayersMenu.OpenMenu(admin, "Silence", (admin, player) => DurationMenu.OpenMenu(admin, $"Silence: {player.PlayerName}", player, SilenceMenu))));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasKick)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData("Force Team", () => PlayersMenu.OpenMenu(admin, "Force Team", ForceTeamMenu)));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
{
|
||||||
|
string menuName = menuOptionData.name;
|
||||||
|
menu.AddMenuOption(menuName, (_, _) => { menuOptionData.action?.Invoke(); }, menuOptionData.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SlapMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Slap: {player.PlayerName}");
|
||||||
|
List<ChatMenuOptionData> options = new();
|
||||||
|
|
||||||
|
// options added in order
|
||||||
|
options.Add(new ChatMenuOptionData("0 hp", () => ApplySlapAndKeepMenu(admin, player, 0)));
|
||||||
|
options.Add(new ChatMenuOptionData("1 hp", () => ApplySlapAndKeepMenu(admin, player, 1)));
|
||||||
|
options.Add(new ChatMenuOptionData("5 hp", () => ApplySlapAndKeepMenu(admin, player, 5)));
|
||||||
|
options.Add(new ChatMenuOptionData("10 hp", () => ApplySlapAndKeepMenu(admin, player, 10)));
|
||||||
|
options.Add(new ChatMenuOptionData("50 hp", () => ApplySlapAndKeepMenu(admin, player, 50)));
|
||||||
|
options.Add(new ChatMenuOptionData("100 hp", () => ApplySlapAndKeepMenu(admin, player, 100)));
|
||||||
|
|
||||||
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
{
|
||||||
|
string menuName = menuOptionData.name;
|
||||||
|
menu.AddMenuOption(menuName, (_, _) => { menuOptionData.action?.Invoke(); }, menuOptionData.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ApplySlapAndKeepMenu(CCSPlayerController admin, CCSPlayerController player, int damage)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Slap(admin, player, damage);
|
||||||
|
SlapMenu(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Slay(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Slay(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void KickMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Kick: {player.PlayerName}");
|
||||||
|
List<string> options = new()
|
||||||
|
{
|
||||||
|
"Voice Abuse",
|
||||||
|
"Chat Abuse",
|
||||||
|
"Admin disrespect",
|
||||||
|
"Other"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (string option in options)
|
||||||
|
{
|
||||||
|
menu.AddMenuOption(option, (_, _) => { Kick(admin, player, option); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Kick(CCSPlayerController admin, CCSPlayerController player, string reason)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Kick(admin, player, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void BanMenu(CCSPlayerController admin, CCSPlayerController player, int duration)
|
||||||
|
{
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Ban: {player.PlayerName}");
|
||||||
|
List<string> options = new()
|
||||||
|
{
|
||||||
|
"Hacking",
|
||||||
|
"Voice Abuse",
|
||||||
|
"Chat Abuse",
|
||||||
|
"Admin disrespect",
|
||||||
|
"Other"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (string option in options)
|
||||||
|
{
|
||||||
|
menu.AddMenuOption(option, (_, _) => { Ban(admin, player, duration, option); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Ban(CCSPlayerController admin, CCSPlayerController player, int duration, string reason)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Ban(admin, player, duration, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GagMenu(CCSPlayerController admin, CCSPlayerController player, int duration)
|
||||||
|
{
|
||||||
|
// TODO: Localize and make options in config?
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Gag: {player.PlayerName}");
|
||||||
|
List<string> options = new()
|
||||||
|
{
|
||||||
|
"Advertising",
|
||||||
|
"Spamming",
|
||||||
|
"Spectator camera abuse",
|
||||||
|
"Hate",
|
||||||
|
"Admin disrespect",
|
||||||
|
"Other"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (string option in options)
|
||||||
|
{
|
||||||
|
menu.AddMenuOption(option, (_, _) => { Gag(admin, player, duration, option); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Gag(CCSPlayerController admin, CCSPlayerController player, int duration, string reason)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Gag(admin, player, duration, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void MuteMenu(CCSPlayerController admin, CCSPlayerController player, int duration)
|
||||||
|
{
|
||||||
|
// TODO: Localize and make options in config?
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Mute: {player.PlayerName}");
|
||||||
|
List<string> options = new()
|
||||||
|
{
|
||||||
|
"Shouting",
|
||||||
|
"Playing music",
|
||||||
|
"Advertising",
|
||||||
|
"Spamming",
|
||||||
|
"Spectator camera abuse",
|
||||||
|
"Hate",
|
||||||
|
"Admin disrespect",
|
||||||
|
"Other"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (string option in options)
|
||||||
|
{
|
||||||
|
menu.AddMenuOption(option, (_, _) => { Mute(admin, player, duration, option); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Mute(CCSPlayerController admin, CCSPlayerController player, int duration, string reason)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Mute(admin, player, duration, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SilenceMenu(CCSPlayerController admin, CCSPlayerController player, int duration)
|
||||||
|
{
|
||||||
|
// TODO: Localize and make options in config?
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Silence: {player.PlayerName}");
|
||||||
|
List<string> options = new()
|
||||||
|
{
|
||||||
|
"Shouting",
|
||||||
|
"Playing music",
|
||||||
|
"Advertising",
|
||||||
|
"Spamming",
|
||||||
|
"Spectator camera abuse",
|
||||||
|
"Hate",
|
||||||
|
"Admin disrespect",
|
||||||
|
"Other"
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (string option in options)
|
||||||
|
{
|
||||||
|
menu.AddMenuOption(option, (_, _) => { Silence(admin, player, duration, option); });
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Silence(CCSPlayerController admin, CCSPlayerController player, int duration, string reason)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Silence(admin, player, duration, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ForceTeamMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
|
{
|
||||||
|
// TODO: Localize
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Force {player.PlayerName}'s Team");
|
||||||
|
List<ChatMenuOptionData> options = new();
|
||||||
|
options.Add(new ChatMenuOptionData("CT", () => ForceTeam(admin, player, "ct", CsTeam.CounterTerrorist)));
|
||||||
|
options.Add(new ChatMenuOptionData("T", () => ForceTeam(admin, player, "t", CsTeam.Terrorist)));
|
||||||
|
options.Add(new ChatMenuOptionData("Swap", () => ForceTeam(admin, player, "swap", CsTeam.Spectator)));
|
||||||
|
options.Add(new ChatMenuOptionData("Spectator", () => ForceTeam(admin, player, "spec", CsTeam.Spectator)));
|
||||||
|
|
||||||
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
{
|
||||||
|
string menuName = menuOptionData.name;
|
||||||
|
menu.AddMenuOption(menuName, (_, _) => { menuOptionData.action?.Invoke(); }, menuOptionData.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ForceTeam(CCSPlayerController admin, CCSPlayerController player, string teamName, CsTeam teamNum)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.ChangeTeam(admin, player, teamName, teamNum, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
80
Menus/ManageServerMenu.cs
Normal file
80
Menus/ManageServerMenu.cs
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Modules.Admin;
|
||||||
|
using CounterStrikeSharp.API.Modules.Menu;
|
||||||
|
|
||||||
|
namespace CS2_SimpleAdmin.Menus
|
||||||
|
{
|
||||||
|
public static class ManageServerMenu
|
||||||
|
{
|
||||||
|
public static void OpenMenu(CCSPlayerController admin)
|
||||||
|
{
|
||||||
|
if (admin == null || admin.IsValid == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AdminManager.PlayerHasPermissions(admin, "@css/generic") == false)
|
||||||
|
{
|
||||||
|
// TODO: Localize
|
||||||
|
admin.PrintToChat("[Simple Admin] You do not have permissions to use this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu("Manage Server");
|
||||||
|
List<ChatMenuOptionData> options = new();
|
||||||
|
|
||||||
|
// permissions
|
||||||
|
bool hasMap = AdminManager.PlayerHasPermissions(admin, "@css/changemap");
|
||||||
|
|
||||||
|
// TODO: Localize options
|
||||||
|
// options added in order
|
||||||
|
|
||||||
|
if (hasMap)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData("Change Map", () => ChangeMapMenu(admin)));
|
||||||
|
}
|
||||||
|
|
||||||
|
options.Add(new ChatMenuOptionData("Restart Game", () => CS2_SimpleAdmin.RestartGame(admin)));
|
||||||
|
|
||||||
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
{
|
||||||
|
string menuName = menuOptionData.name;
|
||||||
|
menu.AddMenuOption(menuName, (_, _) => { menuOptionData.action?.Invoke(); }, menuOptionData.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ChangeMapMenu(CCSPlayerController admin)
|
||||||
|
{
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu($"Change Map");
|
||||||
|
List<ChatMenuOptionData> options = new();
|
||||||
|
|
||||||
|
List<string> maps = CS2_SimpleAdmin.Instance.Config.DefaultMaps;//Server.GetMapList();
|
||||||
|
foreach (string map in maps)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData(map, () => ExecuteChangeMap(admin, map, false)));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> wsMaps = CS2_SimpleAdmin.Instance.Config.WorkshopMaps;
|
||||||
|
foreach (string map in wsMaps)
|
||||||
|
{
|
||||||
|
options.Add(new ChatMenuOptionData($"{map} (WS)", () => ExecuteChangeMap(admin, map, true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
{
|
||||||
|
string menuName = menuOptionData.name;
|
||||||
|
menu.AddMenuOption(menuName, (_, _) => { menuOptionData.action?.Invoke(); }, menuOptionData.disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void ExecuteChangeMap(CCSPlayerController admin, string mapName, bool workshop)
|
||||||
|
{
|
||||||
|
if (workshop)
|
||||||
|
CS2_SimpleAdmin.Instance.ChangeWorkshopMap(admin, mapName);
|
||||||
|
else
|
||||||
|
CS2_SimpleAdmin.Instance.ChangeMap(admin, mapName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Menus/PlayersMenu.cs
Normal file
30
Menus/PlayersMenu.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
|
using CounterStrikeSharp.API.Modules.Menu;
|
||||||
|
|
||||||
|
namespace CS2_SimpleAdmin.Menus
|
||||||
|
{
|
||||||
|
public static class PlayersMenu
|
||||||
|
{
|
||||||
|
public static void OpenAliveMenu(CCSPlayerController admin, string menuName, Action<CCSPlayerController, CCSPlayerController> onSelectAction, Func<CCSPlayerController, bool>? enableFilter = null)
|
||||||
|
{
|
||||||
|
OpenMenu(admin, menuName, onSelectAction, p => p.PawnIsAlive);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OpenMenu(CCSPlayerController admin, string menuName, Action<CCSPlayerController, CCSPlayerController> onSelectAction, Func<CCSPlayerController, bool>? enableFilter = null)
|
||||||
|
{
|
||||||
|
BaseMenu menu = AdminMenu.CreateMenu(menuName);
|
||||||
|
|
||||||
|
IEnumerable<CCSPlayerController> players = Helper.GetValidPlayersWithBots();
|
||||||
|
foreach (CCSPlayerController player in players)
|
||||||
|
{
|
||||||
|
string optionName = player.PlayerName;
|
||||||
|
bool enabled = admin.CanTarget(player);
|
||||||
|
if (enableFilter != null)
|
||||||
|
enabled &= enableFilter(player);
|
||||||
|
menu.AddMenuOption(optionName, (_, _) => { onSelectAction?.Invoke(admin, player); }, enabled == false);
|
||||||
|
}
|
||||||
|
|
||||||
|
AdminMenu.OpenMenu(admin, menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,7 +62,7 @@ Manage your Counter-Strike 2 server by simple commands :)
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Requirments
|
### Requirments
|
||||||
- [CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp/) **tested on v163**
|
- [CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp/) **tested on v166**
|
||||||
- MySQL **tested on MySQL (MariaDB) Server version: 10.11.4-MariaDB-1~deb12u1 Debian 12**
|
- MySQL **tested on MySQL (MariaDB) Server version: 10.11.4-MariaDB-1~deb12u1 Debian 12**
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
48
lang/fr.json
Normal file
48
lang/fr.json
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"sa_prefix": "{lightred}[SA] {default}",
|
||||||
|
"sa_adminhelp": "{GREEN}[ AIDE CS2-SimpleAdmin ]{DEFAULT}\n- css_who <#userid ou nom> - Voir les infos d'un joueur\n- css_players - Affiche la liste des joueurs\n- css_ban <#userid ou nom> [temps en minutes/0 perm] [raison] - Bannir le joueur\n- css_addban <steamid> [temps en minutes/0 perm] [raison] - Bannir le joueur via steamid64\n- css_banip <ip> [temps en minutes/0 perm] [raison] - Bannir le joueur via Addresse IP\n- css_unban <steamid ou nom ou ip> - Débannir le joueur\n- css_kick <#userid ou nom> [raison] - Kicker le joueur\n- css_gag <#userid ou nom> [temps en minutes/0 perm] [raison] - Gagger le joueur\n- css_addgag <steamid> [temps en minutes/0 perm] [raison] - Gagger le joueur via steamid64\n- css_unmute <steamid ou nom> - Dé-Gagger le joueur\n- css_mute <#userid ou nom> [temps en minutes/0 perm] [raison] - Rendre muet le joueur\n- css_addmute <steamid> [temps en minutes/0 perm] [raison] - Rendre muet le joueur via steamid64\n- css_give <#userid ou nom> <weapon> - Donner une arme au joueur\n- css_strip <#userid ou nom> <weapon> - Prendre les armes du joueur\n- css_hp <#userid ou nom> [vie] - Changer la vie du joueur\n- css_god <#userid ou nom> - Rendre invincible\n- css_slay <#userid ou nom> - Tuer le joueur\n- css_slap <#userid ou nom> [damage] - Mettre une fessée au joueur\n- css_vote <'Question?'> ['Réponse1'] ['Réponse2'] ... - Créer un vote\n- css_map <mapname> - Changer de carte\n- css_wsmap <nom ou id> - Changer de carte du workshop\n- css_asay <message> - Parler a tous les admins\n- css_say <message> - Parler en tant qu'admin dans le chat\n- css_psay <#userid ou nom> <message> - Envoyer un message privé au joueur\n- css_csay <message> - Parler comme admin au centre de l'écran\n- css_hsay <message> - Parler en tant qu'admin sur le HUD\n- css_noclip <#userid ou nom> - Activer le NoClip\n- css_freeze <#userid ou nom> [durée] - Bloquer le joueur\n- css_unfreeze <#userid ou nom> - Débloquer le joueur\n- css_respawn <#userid ou nom> - Faire revivre le joueur\n- css_cvar <cvar> <value> - Changer la valeur d'une CVAR\n- css_rcon <command> - Executer une commande serveur",
|
||||||
|
"sa_player_ban_message_time": "Tu as été banni pour {lightred}{0}{default} pendant {lightred}{1}{default} minutes par {lightred}{2}{default} !",
|
||||||
|
"sa_player_ban_message_perm": "Tu a été banni de manière permanente pour {lightred}{0}{default} par {lightred}{1}{default} !",
|
||||||
|
"sa_player_kick_message": "Tu as été expulsé pour {lightred}{0}{default} par {lightred}{1}{default} !",
|
||||||
|
"sa_player_gag_message_time": "Tu as été bailloné pour {lightred}{0}{default} pendant {lightred}{1}{default} minutes par {lightred}{2}{default} !",
|
||||||
|
"sa_player_gag_message_perm": "Tu a été bailloné de manière permanente pour {lightred}{0}{default} par {lightred}{1}{default} !",
|
||||||
|
"sa_player_mute_message_time": "Tu a été réduit au silence pour {lightred}{0}{default} pendant {lightred}{1}{default} minutes par {lightred}{2}{default} !",
|
||||||
|
"sa_player_mute_message_perm": "Tu a été réduit au silence de manière permanente pour {lightred}{0}{default} par {lightred}{1}{default} !",
|
||||||
|
"sa_player_silence_message_time": "Tu a été réduit au silence et bailloné pour {lightred}{0}{default} pendant {lightred}{1}{default} minutes par {lightred}{2}{default} !",
|
||||||
|
"sa_player_silence_message_perm": "Tu a été réduit au silence et bailloné de manière permanente pour {lightred}{0}{default} par {lightred}{1}{default} !",
|
||||||
|
"sa_admin_ban_message_time": "Admin {lightred}{0}{default} a banni {lightred}{1}{default} pour {lightred}{2}{default} pendant {lightred}{3}{default} minutes !",
|
||||||
|
"sa_admin_ban_message_perm": "Admin {lightred}{0}{default} a banni {lightred}{1}{default} de manière permanente pour {lightred}{2}{default} !",
|
||||||
|
"sa_admin_kick_message": "Admin {lightred}{0}{default} a expulsé {lightred}{1}{default} pour {lightred}{2}{default} !",
|
||||||
|
"sa_admin_gag_message_time": "Admin {lightred}{0}{default} a bailloné {lightred}{1}{default} pour {lightred}{2}{default} pendant {lightred}{3}{default} minutes !",
|
||||||
|
"sa_admin_gag_message_perm": "Admin {lightred}{0}{default} a bailloné {lightred}{1}{default} de manière permanente pour {lightred}{2}{default} !",
|
||||||
|
"sa_admin_mute_message_time": "Admin {lightred}{0}{default} a réduit {lightred}{1}{default} au silence pour {lightred}{2}{default} pendant {lightred}{3}{default} minutes !",
|
||||||
|
"sa_admin_mute_message_perm": "Admin {lightred}{0}{default} a réduit {lightred}{1}{default} au silence de manière permanente pour {lightred}{2}{default} !",
|
||||||
|
"sa_admin_silence_message_time": "Admin {lightred}{0}{default} a bailloné et réduit {lightred}{1}{default} au silence pour {lightred}{2}{default} pendant {lightred}{3}{default} minutes !",
|
||||||
|
"sa_admin_silence_message_perm": "Admin {lightred}{0}{default} a bailloné et réduit {lightred}{1}{default} au silence de manière permanente pour {lightred}{2}{default} !",
|
||||||
|
"sa_admin_give_message": "Admin {lightred}{0}{default} a donné a {lightred}{1}{default} un(e) {lightred}{2}{default} !",
|
||||||
|
"sa_admin_strip_message": "Admin {lightred}{0}{default} a retiré les armes de {lightred}{1}{default} !",
|
||||||
|
"sa_admin_hp_message": "Admin {lightred}{0}{default} a changé la vie de {lightred}{1}{default} !",
|
||||||
|
"sa_admin_speed_message": "Admin {lightred}{0}{default} a changé la vitesse en {lightred}{1}{default} !",
|
||||||
|
"sa_admin_god_message": "Admin {lightred}{0}{default} a changé le GodMode en {lightred}{1}{default} !",
|
||||||
|
"sa_admin_slay_message": "Admin {lightred}{0}{default} a tué {lightred}{1}{default} !",
|
||||||
|
"sa_admin_slap_message": "Admin {lightred}{0}{default} a mis une fessée à {lightred}{1}{default} !",
|
||||||
|
"sa_admin_changemap_message": "Admin {lightred}{0}{default} a changé de carte pour {lightred}{1}{default} !",
|
||||||
|
"sa_admin_noclip_message": "Admin {lightred}{0}{default} a changé le NoClip pour {lightred}{1}{default} !",
|
||||||
|
|
||||||
|
"sa_admin_freeze_message": "Admin {lightred}{0}{default} a gelé {lightred}{1}{default} !",
|
||||||
|
"sa_admin_unfreeze_message": "Admin {lightred}{0}{default} a dégelé {lightred}{1}{default} !",
|
||||||
|
"sa_admin_rename_message": "Admin {lightred}{0}{default} a changé le nom de {lightred}{1}{default} en {lightred}{2}{default} !",
|
||||||
|
"sa_admin_respawn_message": "Admin {lightred}{0}{default} a fait revivre {lightred}{1}{default} !",
|
||||||
|
"sa_admin_tp_message": "Admin {lightred}{0}{default} a téléporté {lightred}{1}{default} !",
|
||||||
|
"sa_admin_bring_message": "Admin {lightred}{0}{default} a téléporté sur lui {lightred}{1}{default} !",
|
||||||
|
"sa_admin_team_message": "Admin {lightred}{0}{default} a changé {lightred}{1}{default} en {lightred}{2}{default} !",
|
||||||
|
"sa_admin_vote_menu_title": "{lime}VOTE POUR {gold}{0}",
|
||||||
|
"sa_admin_vote_message": "Admin {lightred}{0}{default} a démarré un vote pour {lightred}{1}{default}",
|
||||||
|
"sa_admin_vote_message_results": "{lime}RÉSULTATS DES VOTES POUR {gold}{0}",
|
||||||
|
"sa_admin_vote_message_results_answer": "{lime}{0} {default}- {gold}{1}",
|
||||||
|
"sa_adminsay_prefix": "{RED}ADMIN: {lightred}{0}{default}",
|
||||||
|
"sa_adminchat_template_admin": "{LIME}(ADMIN) {lightred}{0}{default}: {lightred}{1}{default}",
|
||||||
|
"sa_adminchat_template_player": "{SILVER}(PLAYER) {lightred}{0}{default}: {lightred}{1}{default}",
|
||||||
|
|
||||||
|
"sa_discord_log_command": "**{0}** a exécuté la commande `{1}` sur le serveur `HOSTNAME`"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user