Added skull icon to normal chat, updated readme

This commit is contained in:
daffyyyy 2023-11-22 00:06:04 +01:00
parent c0f571fcaa
commit 19485b2f99
2 changed files with 11 additions and 4 deletions

View file

@ -107,13 +107,15 @@ public class CS2_Tags : BasePlugin
if (JsonTags != null && JsonTags.TryGetValue("tags", out var tags) && tags is JObject tagsObject)
{
string deadIcon = !player.PawnIsAlive ? $"{ChatColors.White}☠ {ChatColors.Default}" : "";
if (tagsObject.TryGetValue(steamid, out var playerTag) && playerTag is JObject)
{
string prefix = playerTag["prefix"]?.ToString() ?? "";
string? nickColor = !string.IsNullOrEmpty(playerTag?["nick_color"]?.ToString()) ? playerTag?["nick_color"]?.ToString() : $"{ChatColors.Default}";
string messageColor = playerTag?["message_color"]?.ToString() ?? $"{ChatColors.Default}";
Server.PrintToChatAll(ReplaceTags($" {prefix}{nickColor}{player.PlayerName}{ChatColors.Default}: {messageColor}{info.GetArg(1)}", player.TeamNum));
Server.PrintToChatAll(ReplaceTags($" {deadIcon}{prefix}{nickColor}{player.PlayerName}{ChatColors.Default}: {messageColor}{info.GetArg(1)}", player.TeamNum));
/* Temp fix for commands OLD
if (info.GetArg(1).StartsWith("!") || info.GetArg(1).StartsWith("/"))
@ -143,7 +145,7 @@ public class CS2_Tags : BasePlugin
string? nickColor = !string.IsNullOrEmpty(permissionTag?["nick_color"]?.ToString()) ? permissionTag?["nick_color"]?.ToString() : $"{ChatColors.Default}";
string messageColor = permissionTag?["message_color"]?.ToString() ?? $"{ChatColors.Default}";
Server.PrintToChatAll(ReplaceTags($" {prefix}{nickColor}{player.PlayerName}{ChatColors.Default}: {messageColor}{info.GetArg(1)}", player.TeamNum));
Server.PrintToChatAll(ReplaceTags($" {deadIcon}{prefix}{nickColor}{player.PlayerName}{ChatColors.Default}: {messageColor}{info.GetArg(1)}", player.TeamNum));
return HookResult.Handled;
}
@ -157,7 +159,7 @@ public class CS2_Tags : BasePlugin
string? nickColor = !string.IsNullOrEmpty(everyoneTag?["nick_color"]?.ToString()) ? everyoneTag?["nick_color"]?.ToString() : $"{ChatColors.Default}";
string messageColor = everyoneTag?["message_color"]?.ToString() ?? $"{ChatColors.Default}";
Server.PrintToChatAll(ReplaceTags($" {prefix}{nickColor}{player.PlayerName}{ChatColors.Default}: {messageColor}{info.GetArg(1)}", player.TeamNum));
Server.PrintToChatAll(ReplaceTags($" {deadIcon}{prefix}{nickColor}{player.PlayerName}{ChatColors.Default}: {messageColor}{info.GetArg(1)}", player.TeamNum));
return HookResult.Handled;
}

View file

@ -6,7 +6,10 @@
### Description
Adds tags to the server that can be easily edited, tags can be assigned via permission or steamid64
### Confiugration
### Commands
- css_tags_reload - Reload tags config
### Configuration
```
{
"tags": {
@ -58,6 +61,8 @@ In addons/counterstrikesharp/plugins/CS2-Tags/tags.json
public static char Magenta = '\x0E';
public static char LightRed = '\x0F';
```
```{TEAMCOLOR} - Team color```
Use color name for e.g. {LightRed}
### TODO