mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-24 12:19:17 +00:00
Made slap menu
This commit is contained in:
@@ -1486,18 +1486,23 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
player!.Pawn.Value!.Slap(damage);
|
Slap(caller, player, damage);
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
|
||||||
|
|
||||||
if (caller == null || caller != null && caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
|
|
||||||
{
|
|
||||||
sb.Append(_localizer["sa_admin_slap_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
|
|
||||||
Server.PrintToChatAll(sb.ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Slap(CCSPlayerController? caller, CCSPlayerController player, int damage)
|
||||||
|
{
|
||||||
|
player.Pawn.Value!.Slap(damage);
|
||||||
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
|
|
||||||
|
if (caller == null || caller.UserId != null && !silentPlayers.Contains((ushort)caller.UserId))
|
||||||
|
{
|
||||||
|
sb.Append(_localizer["sa_admin_slap_message", caller == null ? "Console" : caller.PlayerName, player.PlayerName]);
|
||||||
|
Server.PrintToChatAll(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)]
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ namespace CS2_SimpleAdmin.Menus
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//bool xpRights = AdminManager.PlayerHasPermissions(admin, "@wcs/xp");
|
|
||||||
|
|
||||||
CenterHtmlMenu menu = new CenterHtmlMenu("Manage Players");
|
CenterHtmlMenu menu = new CenterHtmlMenu("Manage Players");
|
||||||
List<ChatMenuOptionData> options = new();
|
List<ChatMenuOptionData> options = new();
|
||||||
|
|
||||||
@@ -69,88 +67,111 @@ namespace CS2_SimpleAdmin.Menus
|
|||||||
MenuManager.OpenCenterHtmlMenu(CS2_SimpleAdmin.Instance, admin, menu);
|
MenuManager.OpenCenterHtmlMenu(CS2_SimpleAdmin.Instance, admin, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WhoIs(CCSPlayerController admin, CCSPlayerController player)
|
private static void WhoIs(CCSPlayerController admin, CCSPlayerController player)
|
||||||
{
|
{
|
||||||
BanManager banManager = new(CS2_SimpleAdmin.Instance.dbConnectionString, CS2_SimpleAdmin.Instance.Config);
|
BanManager banManager = new(CS2_SimpleAdmin.Instance.dbConnectionString, CS2_SimpleAdmin.Instance.Config);
|
||||||
MuteManager muteManager = new(CS2_SimpleAdmin.Instance.dbConnectionString);
|
MuteManager muteManager = new(CS2_SimpleAdmin.Instance.dbConnectionString);
|
||||||
|
|
||||||
PlayerInfo playerInfo = new PlayerInfo
|
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(() =>
|
||||||
{
|
{
|
||||||
UserId = player.UserId,
|
Action<string> printMethod = admin == null ? Server.PrintToConsole : admin.PrintToConsole;
|
||||||
Index = (int)player.Index,
|
printMethod($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
|
||||||
SteamId = player?.AuthorizedSteamID?.SteamId64.ToString(),
|
|
||||||
Name = player?.PlayerName,
|
|
||||||
IpAddress = player?.IpAddress?.Split(":")[0]
|
|
||||||
};
|
|
||||||
|
|
||||||
Task.Run(async () =>
|
printMethod($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
|
||||||
{
|
printMethod($"• UserID: \"{playerInfo.UserId}\"");
|
||||||
int totalBans = 0;
|
if (playerInfo.SteamId != null)
|
||||||
int totalMutes = 0;
|
printMethod($"• SteamID64: \"{playerInfo.SteamId}\"");
|
||||||
|
if (player.AuthorizedSteamID != null)
|
||||||
totalBans = await banManager.GetPlayerBans(playerInfo);
|
|
||||||
totalMutes = await muteManager.GetPlayerMutes(playerInfo.SteamId!);
|
|
||||||
|
|
||||||
Server.NextFrame(() =>
|
|
||||||
{
|
{
|
||||||
Action<string> printMethod = admin == null ? Server.PrintToConsole : admin.PrintToConsole;
|
printMethod($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
|
||||||
printMethod($"--------- INFO ABOUT \"{playerInfo.Name}\" ---------");
|
printMethod($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
|
||||||
|
}
|
||||||
|
|
||||||
printMethod($"• Clan: \"{player!.Clan}\" Name: \"{playerInfo.Name}\"");
|
if (playerInfo.IpAddress != null)
|
||||||
printMethod($"• UserID: \"{playerInfo.UserId}\"");
|
printMethod($"• IP Address: \"{playerInfo.IpAddress}\"");
|
||||||
if (playerInfo.SteamId != null)
|
printMethod($"• Ping: \"{player.Ping}\"");
|
||||||
printMethod($"• SteamID64: \"{playerInfo.SteamId}\"");
|
if (player.AuthorizedSteamID != null)
|
||||||
if (player.AuthorizedSteamID != null)
|
{
|
||||||
{
|
printMethod($"• Total Bans: \"{totalBans}\"");
|
||||||
printMethod($"• SteamID2: \"{player.AuthorizedSteamID.SteamId2}\"");
|
printMethod($"• Total Mutes: \"{totalMutes}\"");
|
||||||
printMethod($"• Community link: \"{player.AuthorizedSteamID.ToCommunityUrl()}\"");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (playerInfo.IpAddress != null)
|
printMethod($"--------- END INFO ABOUT \"{player.PlayerName}\" ---------");
|
||||||
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}\" ---------");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SlapMenu(CCSPlayerController admin, CCSPlayerController player)
|
private static void SlapMenu(CCSPlayerController admin, CCSPlayerController player)
|
||||||
{
|
{
|
||||||
// TODO: Slap
|
CenterHtmlMenu menu = new CenterHtmlMenu($"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);
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuManager.OpenCenterHtmlMenu(CS2_SimpleAdmin.Instance, admin, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Slay(CCSPlayerController admin, CCSPlayerController player)
|
private static void ApplySlapAndKeepMenu(CCSPlayerController admin, CCSPlayerController player, int i)
|
||||||
|
{
|
||||||
|
CS2_SimpleAdmin.Instance.Slap(admin, player, i);
|
||||||
|
SlapMenu(admin, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Slay(CCSPlayerController admin, CCSPlayerController player)
|
||||||
{
|
{
|
||||||
// TODO: Slay
|
// TODO: Slay
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Kick(CCSPlayerController admin, CCSPlayerController player)
|
private static void Kick(CCSPlayerController admin, CCSPlayerController player)
|
||||||
{
|
{
|
||||||
// TODO: Kick
|
// TODO: Kick
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Ban(CCSPlayerController admin, CCSPlayerController player, int duration)
|
private static void Ban(CCSPlayerController admin, CCSPlayerController player, int duration)
|
||||||
{
|
{
|
||||||
// TODO: Ban
|
// TODO: Ban
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Gag(CCSPlayerController admin, CCSPlayerController player, int duration)
|
private static void Gag(CCSPlayerController admin, CCSPlayerController player, int duration)
|
||||||
{
|
{
|
||||||
// TODO: Gag
|
// TODO: Gag
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Mute(CCSPlayerController admin, CCSPlayerController player, int duration)
|
private static void Mute(CCSPlayerController admin, CCSPlayerController player, int duration)
|
||||||
{
|
{
|
||||||
// TODO: Mute
|
// TODO: Mute
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ForceTeam(CCSPlayerController admin, CCSPlayerController player)
|
private static void ForceTeam(CCSPlayerController admin, CCSPlayerController player)
|
||||||
{
|
{
|
||||||
// TODO: ForceTeam
|
// TODO: ForceTeam
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user