Fixed who

This commit is contained in:
Valentin Barat
2024-01-31 17:39:03 +01:00
parent f622701f5e
commit 232f487d01
3 changed files with 58 additions and 50 deletions

View File

@@ -69,53 +69,7 @@ namespace CS2_SimpleAdmin.Menus
private static void WhoIs(CCSPlayerController admin, CCSPlayerController player)
{
BanManager banManager = new(CS2_SimpleAdmin.Instance.dbConnectionString, CS2_SimpleAdmin.Instance.Config);
MuteManager muteManager = new(CS2_SimpleAdmin.Instance.dbConnectionString);
PlayerInfo playerInfo = new PlayerInfo
{
UserId = player.UserId,
Index = (int)player.Index,
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
Name = player?.PlayerName,
IpAddress = player?.IpAddress?.Split(":")[0]
};
Task.Run(async () =>
{
int totalBans = 0;
int totalMutes = 0;
totalBans = await banManager.GetPlayerBans(playerInfo);
totalMutes = await muteManager.GetPlayerMutes(playerInfo.SteamId!);
Server.NextFrame(() =>
{
Action<string> printMethod = admin == null ? Server.PrintToConsole : admin.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.AuthorizedSteamID != null)
{
printMethod($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
printMethod($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
}
if (playerInfo.IpAddress != null)
printMethod($"• IP Address: \"{playerInfo.IpAddress}\"");
printMethod($"• Ping: \"{player.Ping}\"");
if (player.AuthorizedSteamID != null)
{
printMethod($"• Total Bans: \"{totalBans}\"");
printMethod($"• Total Mutes: \"{totalMutes}\"");
}
printMethod($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
});
});
CS2_SimpleAdmin.Instance.Who(admin, player);
}
private static void SlapMenu(CCSPlayerController admin, CCSPlayerController player)