mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-25 20:58:05 +00:00
1.3.0d
- Fixed noclip - Fixed freeze - Fixed vote
This commit is contained in:
@@ -31,6 +31,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
public static HashSet<int> votePlayers = new HashSet<int>();
|
public static HashSet<int> votePlayers = new HashSet<int>();
|
||||||
public static ConcurrentBag<int> godPlayers = new ConcurrentBag<int>();
|
public static ConcurrentBag<int> godPlayers = new ConcurrentBag<int>();
|
||||||
public static ConcurrentBag<int> gaggedPlayers = new ConcurrentBag<int>();
|
public static ConcurrentBag<int> gaggedPlayers = new ConcurrentBag<int>();
|
||||||
|
public static ConcurrentBag<int> commsPlayers = new ConcurrentBag<int>();
|
||||||
public static ConcurrentBag<int> silentPlayers = new ConcurrentBag<int>();
|
public static ConcurrentBag<int> silentPlayers = new ConcurrentBag<int>();
|
||||||
public static ConcurrentBag<string> bannedPlayers = new ConcurrentBag<string>();
|
public static ConcurrentBag<string> bannedPlayers = new ConcurrentBag<string>();
|
||||||
public static bool TagsDetected = false;
|
public static bool TagsDetected = false;
|
||||||
@@ -46,7 +47,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
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";
|
||||||
public override string ModuleVersion => "1.3.0c";
|
public override string ModuleVersion => "1.3.0d";
|
||||||
|
|
||||||
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
||||||
|
|
||||||
@@ -1885,22 +1886,21 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<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);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (CCSPlayerController _player in Utilities.GetPlayers().Where(p => p != null && p.IsValid && p.Connected == PlayerConnectedState.PlayerConnected && !p.IsBot && !p.IsHLTV))
|
foreach (CCSPlayerController _player in Utilities.GetPlayers().Where(p => p != null && p.IsValid && p.Connected == PlayerConnectedState.PlayerConnected && !p.IsBot && !p.IsHLTV))
|
||||||
{
|
{
|
||||||
|
|
||||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||||
{
|
{
|
||||||
MenuManager.OpenChatMenu(_player, voteMenu);
|
|
||||||
for (int i = 2; i <= answersCount - 1; i++)
|
|
||||||
{
|
|
||||||
voteMenu.AddMenuOption(command.GetArg(i), Helper.handleVotes);
|
|
||||||
}
|
|
||||||
Helper.PrintToCenterAll(_localizer!["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
Helper.PrintToCenterAll(_localizer!["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
||||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||||
sb.Append(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
sb.Append(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
||||||
_player.PrintToChat(sb.ToString());
|
_player.PrintToChat(sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MenuManager.OpenChatMenu(_player, voteMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.DiscordWebhook.Length > 0 && _localizer != null)
|
if (Config.DiscordWebhook.Length > 0 && _localizer != null)
|
||||||
@@ -1908,6 +1908,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
LocalizedString localizedMessage = _localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question];
|
LocalizedString localizedMessage = _localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question];
|
||||||
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
|
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
voteInProgress = true;
|
voteInProgress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ namespace CS2_SimpleAdmin
|
|||||||
public static List<CCSPlayerController> GetPlayerFromSteamid64(string steamid)
|
public static List<CCSPlayerController> GetPlayerFromSteamid64(string steamid)
|
||||||
{
|
{
|
||||||
return Utilities.GetPlayers().FindAll(x =>
|
return Utilities.GetPlayers().FindAll(x =>
|
||||||
x.AuthorizedSteamID != null &&
|
x.SteamID.ToString().Equals(steamid, StringComparison.OrdinalIgnoreCase)
|
||||||
x.AuthorizedSteamID.SteamId64.ToString().Equals(steamid, StringComparison.OrdinalIgnoreCase)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +59,6 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
//Console.WriteLine($"Setting immunity for SteamID {steamid} to {immunity}");
|
//Console.WriteLine($"Setting immunity for SteamID {steamid} to {immunity}");
|
||||||
|
|
||||||
|
|
||||||
if (flags != null)
|
if (flags != null)
|
||||||
{
|
{
|
||||||
//Console.WriteLine($"Applying flags to SteamID {steamid}:");
|
//Console.WriteLine($"Applying flags to SteamID {steamid}:");
|
||||||
@@ -150,9 +148,9 @@ namespace CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
if (CS2_SimpleAdmin.voteInProgress && !CS2_SimpleAdmin.votePlayers.Contains(player.Slot))
|
if (CS2_SimpleAdmin.voteInProgress && !CS2_SimpleAdmin.votePlayers.Contains(player.Slot))
|
||||||
{
|
{
|
||||||
|
option.Disabled = true;
|
||||||
CS2_SimpleAdmin.votePlayers.Add(player.Slot);
|
CS2_SimpleAdmin.votePlayers.Add(player.Slot);
|
||||||
CS2_SimpleAdmin.voteAnswers[option.Text]++;
|
CS2_SimpleAdmin.voteAnswers[option.Text]++;
|
||||||
option.Disabled = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using CounterStrikeSharp.API.Core;
|
using CounterStrikeSharp.API;
|
||||||
|
using CounterStrikeSharp.API.Core;
|
||||||
using CounterStrikeSharp.API.Modules.Admin;
|
using CounterStrikeSharp.API.Modules.Admin;
|
||||||
|
using CounterStrikeSharp.API.Modules.Memory;
|
||||||
using CounterStrikeSharp.API.Modules.Utils;
|
using CounterStrikeSharp.API.Modules.Utils;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -80,19 +82,31 @@ public static class PlayerUtils
|
|||||||
public static void Freeze(this CBasePlayerPawn pawn)
|
public static void Freeze(this CBasePlayerPawn pawn)
|
||||||
{
|
{
|
||||||
pawn.MoveType = MoveType_t.MOVETYPE_OBSOLETE;
|
pawn.MoveType = MoveType_t.MOVETYPE_OBSOLETE;
|
||||||
|
Schema.SetSchemaValue(pawn.Handle, "CBaseEntity", "m_nActualMoveType", 1); // obsolete
|
||||||
|
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_MoveType");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Unfreeze(this CBasePlayerPawn pawn)
|
public static void Unfreeze(this CBasePlayerPawn pawn)
|
||||||
{
|
{
|
||||||
pawn.MoveType = MoveType_t.MOVETYPE_WALK;
|
pawn.MoveType = MoveType_t.MOVETYPE_WALK;
|
||||||
|
Schema.SetSchemaValue(pawn.Handle, "CBaseEntity", "m_nActualMoveType", 2); // walk
|
||||||
|
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_MoveType");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ToggleNoclip(this CBasePlayerPawn pawn)
|
public static void ToggleNoclip(this CBasePlayerPawn pawn)
|
||||||
{
|
{
|
||||||
if (pawn.MoveType == MoveType_t.MOVETYPE_NOCLIP)
|
if (pawn.MoveType == MoveType_t.MOVETYPE_NOCLIP)
|
||||||
|
{
|
||||||
pawn.MoveType = MoveType_t.MOVETYPE_WALK;
|
pawn.MoveType = MoveType_t.MOVETYPE_WALK;
|
||||||
|
Schema.SetSchemaValue(pawn.Handle, "CBaseEntity", "m_nActualMoveType", 2); // walk
|
||||||
|
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_MoveType");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pawn.MoveType = MoveType_t.MOVETYPE_NOCLIP;
|
pawn.MoveType = MoveType_t.MOVETYPE_NOCLIP;
|
||||||
|
Schema.SetSchemaValue(pawn.Handle, "CBaseEntity", "m_nActualMoveType", 8); // noclip
|
||||||
|
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_MoveType");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PerformSlap(CBasePlayerPawn pawn, int damage = 0)
|
private static void PerformSlap(CBasePlayerPawn pawn, int damage = 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user