1.0.3b
- Minor changes
This commit is contained in:
parent
bbeef2adba
commit
6c5fda09f4
1 changed files with 16 additions and 17 deletions
33
CS2-Tags.cs
33
CS2-Tags.cs
|
|
@ -14,12 +14,12 @@ namespace CS2_Tags;
|
|||
[MinimumApiVersion(142)]
|
||||
public class CS2_Tags : BasePlugin
|
||||
{
|
||||
private List<int> GaggedIds = new List<int>();
|
||||
private HashSet<ushort> GaggedIds = new HashSet<ushort>();
|
||||
public static JObject? JsonTags { get; private set; }
|
||||
public override string ModuleName => "CS2-Tags";
|
||||
public override string ModuleDescription => "Add player tags easily in cs2 game";
|
||||
public override string ModuleAuthor => "daffyy";
|
||||
public override string ModuleVersion => "1.0.3a";
|
||||
public override string ModuleVersion => "1.0.3b";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
|
|
@ -31,7 +31,6 @@ public class CS2_Tags : BasePlugin
|
|||
RegisterEventHandler<EventPlayerDeath>(OnPlayerDeath);
|
||||
AddCommandListener("say", OnPlayerChat);
|
||||
AddCommandListener("say_team", OnPlayerChatTeam);
|
||||
|
||||
}
|
||||
|
||||
private static void CreateOrLoadJsonFile(string filepath)
|
||||
|
|
@ -95,31 +94,31 @@ public class CS2_Tags : BasePlugin
|
|||
}
|
||||
|
||||
[ConsoleCommand("css_tag_mute")]
|
||||
[CommandHelper(minArgs: 1, usage: "<Index>", whoCanExecute: CommandUsage.SERVER_ONLY)]
|
||||
[CommandHelper(minArgs: 1, usage: "<UserID>", whoCanExecute: CommandUsage.SERVER_ONLY)]
|
||||
public void OnTagMuteCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
int index = 0;
|
||||
int.TryParse(command.GetArg(1), out index);
|
||||
ushort userid = 0;
|
||||
ushort.TryParse(command.GetArg(1), out userid);
|
||||
|
||||
if (index == 0)
|
||||
if (userid == 0)
|
||||
return;
|
||||
|
||||
if (!GaggedIds.Contains(index))
|
||||
GaggedIds.Add(index);
|
||||
if (!GaggedIds.Contains(userid))
|
||||
GaggedIds.Add(userid);
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_tag_unmute")]
|
||||
[CommandHelper(minArgs: 1, usage: "<Index>", whoCanExecute: CommandUsage.SERVER_ONLY)]
|
||||
[CommandHelper(minArgs: 1, usage: "<UserID>", whoCanExecute: CommandUsage.SERVER_ONLY)]
|
||||
public void OnTagUnMuteCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
int index = 0;
|
||||
int.TryParse(command.GetArg(1), out index);
|
||||
ushort userid = 0;
|
||||
ushort.TryParse(command.GetArg(1), out userid);
|
||||
|
||||
if (index == 0)
|
||||
if (userid == 0)
|
||||
return;
|
||||
|
||||
if (GaggedIds.Contains(index))
|
||||
GaggedIds.Remove(index);
|
||||
if (GaggedIds.Contains(userid))
|
||||
GaggedIds.Remove(userid);
|
||||
}
|
||||
|
||||
private void OnClientAuthorized(int playerSlot, SteamID steamId)
|
||||
|
|
@ -167,7 +166,7 @@ public class CS2_Tags : BasePlugin
|
|||
if (player == null || !player.IsValid || info.GetArg(1).Length == 0 || player.AuthorizedSteamID == null) return HookResult.Continue;
|
||||
string steamid = player.AuthorizedSteamID.SteamId64.ToString();
|
||||
|
||||
if (GaggedIds.Contains((int)player.Index)) return HookResult.Handled;
|
||||
if (player.UserId != null && GaggedIds.Contains((ushort)player.UserId)) return HookResult.Handled;
|
||||
|
||||
if (info.GetArg(1).StartsWith("!") || info.GetArg(1).StartsWith("@") || info.GetArg(1).StartsWith("/") || info.GetArg(1).StartsWith(".") || info.GetArg(1) == "rtv") return HookResult.Continue;
|
||||
|
||||
|
|
@ -249,7 +248,7 @@ public class CS2_Tags : BasePlugin
|
|||
if (player == null || !player.IsValid || info.GetArg(1).Length == 0 || player.AuthorizedSteamID == null) return HookResult.Continue;
|
||||
string steamid = player.AuthorizedSteamID.SteamId64.ToString();
|
||||
|
||||
if (GaggedIds.Contains((int)player.Index)) return HookResult.Handled;
|
||||
if (player.UserId != null && GaggedIds.Contains((ushort)player.UserId)) return HookResult.Handled;
|
||||
|
||||
if (info.GetArg(1).StartsWith("@") && AdminManager.PlayerHasPermissions(player, "@css/chat"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue