mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-17 18:39:07 +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 ConcurrentBag<int> godPlayers = 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<string> bannedPlayers = new ConcurrentBag<string>();
|
||||
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 ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
|
||||
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();
|
||||
|
||||
@@ -1885,22 +1886,21 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
||||
for (int i = 2; i <= answersCount - 1; i++)
|
||||
{
|
||||
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))
|
||||
{
|
||||
|
||||
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]);
|
||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||
sb.Append(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
||||
_player.PrintToChat(sb.ToString());
|
||||
}
|
||||
|
||||
MenuManager.OpenChatMenu(_player, voteMenu);
|
||||
}
|
||||
|
||||
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];
|
||||
_ = SendWebhookMessage(localizedMessage.ToString().Replace("", "").Replace("", ""));
|
||||
}
|
||||
|
||||
voteInProgress = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ namespace CS2_SimpleAdmin
|
||||
public static List<CCSPlayerController> GetPlayerFromSteamid64(string steamid)
|
||||
{
|
||||
return Utilities.GetPlayers().FindAll(x =>
|
||||
x.AuthorizedSteamID != null &&
|
||||
x.AuthorizedSteamID.SteamId64.ToString().Equals(steamid, StringComparison.OrdinalIgnoreCase)
|
||||
x.SteamID.ToString().Equals(steamid, StringComparison.OrdinalIgnoreCase)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,7 +59,6 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
//Console.WriteLine($"Setting immunity for SteamID {steamid} to {immunity}");
|
||||
|
||||
|
||||
if (flags != null)
|
||||
{
|
||||
//Console.WriteLine($"Applying flags to SteamID {steamid}:");
|
||||
@@ -150,9 +148,9 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
if (CS2_SimpleAdmin.voteInProgress && !CS2_SimpleAdmin.votePlayers.Contains(player.Slot))
|
||||
{
|
||||
option.Disabled = true;
|
||||
CS2_SimpleAdmin.votePlayers.Add(player.Slot);
|
||||
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.Memory;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Text;
|
||||
|
||||
@@ -80,19 +82,31 @@ public static class PlayerUtils
|
||||
public static void Freeze(this CBasePlayerPawn pawn)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (pawn.MoveType == MoveType_t.MOVETYPE_NOCLIP)
|
||||
{
|
||||
pawn.MoveType = MoveType_t.MOVETYPE_WALK;
|
||||
Schema.SetSchemaValue(pawn.Handle, "CBaseEntity", "m_nActualMoveType", 2); // walk
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_MoveType");
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user