diff --git a/CnD_Sound.cs b/CnD_Sound.cs index 7158835..ef87f3a 100644 --- a/CnD_Sound.cs +++ b/CnD_Sound.cs @@ -1,744 +1,445 @@ -using System.Text.Json.Serialization; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API; using MaxMind.GeoIP2; using MaxMind.GeoIP2.Exceptions; -using System.Text; -using System.Drawing; using Microsoft.Extensions.Localization; -using CounterStrikeSharp.API.Modules.Commands; -using Newtonsoft.Json; +using CounterStrikeSharp.API.Core.Attributes; +using CnD_Sound.Config; +using CounterStrikeSharp.API.Modules.Entities; namespace CnD_Sound; -public class CnDSoundConfig : BasePluginConfig +[MinimumApiVersion(164)] +public class CnDSound : BasePlugin { - [JsonPropertyName("InGameSoundDisableCommands")] public string InGameSoundDisableCommands { get; set; } = "!stopsound,!stopsounds"; - [JsonPropertyName("RemovePlayerCookieOlderThanXDays")] public int RemovePlayerCookieOlderThanXDays { get; set; } = 7; - [JsonPropertyName("InGameSoundConnect")] public string InGameSoundConnect { get; set; } = "sounds/buttons/blip1.vsnd_c"; - [JsonPropertyName("InGameSoundDisconnect")] public string InGameSoundDisconnect { get; set; } = "sounds/player/taunt_clap_01.vsnd_c"; - - - [JsonPropertyName("SendLogToText")] public bool SendLogToText { get; set; } = false; - [JsonPropertyName("LogFileFormat")] public string LogFileFormat { get; set; } = ".txt"; - [JsonPropertyName("LogFileDateFormat")] public string LogFileDateFormat { get; set; } = "MM-dd-yyyy"; - [JsonPropertyName("LogInsideFileTimeFormat")] public string LogInsideFileTimeFormat { get; set; } = "HH:mm:ss"; - [JsonPropertyName("LogTextFormatConnect")] public string LogTextFormatConnect { get; set; } = "[{DATE} - {TIME}] {PLAYERNAME} Connected [{SHORTCOUNTRY} - {CITY}] [{STEAMID} - {IP}]"; - [JsonPropertyName("LogTextFormatDisconnect")] public string LogTextFormatDisconnect { get; set; } = "[{DATE} - {TIME}] {PLAYERNAME} Disconnected [{SHORTCOUNTRY} - {CITY}] [{STEAMID64}] [{STEAMID} - {IP}] [{REASON}]"; - [JsonPropertyName("AutoDeleteLogsMoreThanXdaysOld")] public int AutoDeleteLogsMoreThanXdaysOld { get; set; } = 0; - - - - [JsonPropertyName("SendLogToWebHook")] public int SendLogToWebHook { get; set; } = 0; - [JsonPropertyName("SideColorMessage")] public string SideColorMessage { get; set; } = "00FFFF"; - [JsonPropertyName("WebHookURL")] public string WebHookURL { get; set; } = "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; - [JsonPropertyName("LogDiscordChatFormatConnect")] public string LogDiscordChatFormatConnect { get; set; } = "{PLAYERNAME} Connected [{LONGCOUNTRY} - {CITY}]"; - [JsonPropertyName("LogDiscordChatFormatDisconnect")] public string LogDiscordChatFormatDisconnect { get; set; } = "{PLAYERNAME} Disconnected [{LONGCOUNTRY} - {CITY}] [{REASON}]"; - - - - [JsonPropertyName("SendLogToServerConsole")] public bool SendLogToServerConsole { get; set; } = false; - [JsonPropertyName("LogServerConsoleFormatConnect")] public string LogServerConsoleFormatConnect { get; set; } = "Gold KingZ | {PLAYERNAME} Connected [{SHORTCOUNTRY} - {CITY}]"; - [JsonPropertyName("LogServerConsoleFormatDisconnect")] public string LogServerConsoleFormatDisconnect { get; set; } = "Gold KingZ | {PLAYERNAME} Disconnected [{SHORTCOUNTRY} - {CITY}] [{REASON}]"; -} - -public class CnDSound : BasePlugin, IPluginConfig -{ - public override string ModuleName => "Connect Disconnect Sound"; - public override string ModuleVersion => "1.0.8"; + public override string ModuleName => "Connect Disconnect Sound (Connect , Disconnect , Country , City , Message , Sound , Logs , Discord)"; + public override string ModuleVersion => "1.0.9"; public override string ModuleAuthor => "Gold KingZ"; - public override string ModuleDescription => "Connect , Disconnect , Country , City , Message , Sound , Logs , Discord"; + public override string ModuleDescription => "https://github.com/oqyh"; internal static IStringLocalizer? Stringlocalizer; - private static readonly HttpClient _httpClient = new HttpClient(); - private static readonly HttpClient httpClient = new HttpClient(); - public CnDSoundConfig Config { get; set; } = new CnDSoundConfig(); + public ENetworkDisconnectionReason Reason { get; set; } - public void OnConfigParsed(CnDSoundConfig config) - { - Config = config; - Stringlocalizer = Localizer; - if (Config.SendLogToWebHook < 0 || Config.SendLogToWebHook > 3) - { - config.SendLogToWebHook = 0; - Console.WriteLine("|||||||||||||||||||||||||||||||||||| I N V A L I D ||||||||||||||||||||||||||||||||||||"); - Console.WriteLine("SendLogToWebHook: is invalid, setting to default value (0) Please Choose 0 or 1 or 2 or 3."); - Console.WriteLine("SendLogToWebHook (0) = Disableis invalid"); - Console.WriteLine("SendLogToWebHook (1) = Text Only"); - Console.WriteLine("SendLogToWebHook (2) = Text With + Name + Hyperlink To Steam Profile"); - Console.WriteLine("SendLogToWebHook (3) = Text With + Name + Hyperlink To Steam Profile + Profile Picture"); - Console.WriteLine("|||||||||||||||||||||||||||||||||||| I N V A L I D ||||||||||||||||||||||||||||||||||||"); - } - - if (Config.SideColorMessage.StartsWith("#")) - { - Config.SideColorMessage = Config.SideColorMessage.Substring(1); - } - } + public override void Load(bool hotReload) { + string ModulePath = ModuleDirectory; + Configs.Shared.CookiesFolderPath = ModulePath; + Configs.Load(ModulePath); + + Stringlocalizer = Localizer; RegisterListener(OnClientPutInServer); RegisterListener(OnMapStart); + RegisterEventHandler(OnEventPlayerConnectFull); RegisterEventHandler(OnPlayerDisconnect); - AddCommandListener("say", OnPlayerSayPublic, HookMode.Post); - AddCommandListener("say_team", OnPlayerSayTeam, HookMode.Post); + RegisterEventHandler(OnPlayerDisconnectPre, HookMode.Pre); + RegisterEventHandler(OnEventPlayerChat, HookMode.Post); + RegisterListener(OnMapEnd); } - private HookResult OnPlayerSayPublic(CCSPlayerController? player, CommandInfo info) - { - if (string.IsNullOrEmpty(Config.InGameSoundDisableCommands) || player == null || !player.IsValid || player.IsBot || player.IsHLTV)return HookResult.Continue; - var playerid = player.SteamID; - bool playerValue = RetrieveBoolValueById((int)playerid); - var message = info.GetArg(1); - if (string.IsNullOrWhiteSpace(message)) return HookResult.Continue; - string trimmedMessage1 = message.TrimStart(); - string trimmedMessage = trimmedMessage1.TrimEnd(); - - string[] disableCommands = Config.InGameSoundDisableCommands.Split(','); - - if (disableCommands.Any(cmd => cmd.Equals(trimmedMessage, StringComparison.OrdinalIgnoreCase))) + private void OnMapStart(string Map) + { + if(Configs.GetConfigData().Log_AutoDeleteLogsMoreThanXdaysOld > 0) { - DateTime personDate = DateTime.Now; - + string Fpath = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/logs"); + Helper.DeleteOldFiles(Fpath, "*" + ".txt", TimeSpan.FromDays(Configs.GetConfigData().Log_AutoDeleteLogsMoreThanXdaysOld)); + } + } + public HookResult OnEventPlayerChat(EventPlayerChat @event, GameEventInfo info) + { + if(string.IsNullOrEmpty(Configs.GetConfigData().InGameSoundDisableCommands) || @event == null)return HookResult.Continue; + var eventplayer = @event.Userid; + var eventmessage = @event.Text; + var player = Utilities.GetPlayerFromUserid(eventplayer); - playerValue = !playerValue; + if (player == null || !player.IsValid)return HookResult.Continue; + var playerid = player.SteamID; - if (playerValue) - { - player.PrintToChat(Localizer["InGame_Command_Disabled"]); - }else + if (string.IsNullOrWhiteSpace(eventmessage)) return HookResult.Continue; + string trimmedMessageStart = eventmessage.TrimStart(); + string message = trimmedMessageStart.TrimEnd(); + string[] InGameSoundDisableCommand = Configs.GetConfigData().InGameSoundDisableCommands.Split(','); + + if (InGameSoundDisableCommand.Any(cmd => cmd.Equals(message, StringComparison.OrdinalIgnoreCase))) + { + if (!string.IsNullOrEmpty(Configs.GetConfigData().InGameAllowDisableCommandsOnlyForGroups) && !Globals.AllowedGroups.ContainsKey(playerid)) { - player.PrintToChat(Localizer["InGame_Command_Enabled"]); + if (!string.IsNullOrEmpty(Localizer["command.not.allowed"])) + { + Helper.AdvancedPrintToChat(player, Localizer["command.not.allowed"]); + } + return HookResult.Continue; } - SaveToJsonFile((int)playerid, playerValue, personDate); - } - return HookResult.Continue; - } - private HookResult OnPlayerSayTeam(CCSPlayerController? player, CommandInfo info) - { - if (string.IsNullOrEmpty(Config.InGameSoundDisableCommands) || player == null || !player.IsValid || player.IsBot || player.IsHLTV)return HookResult.Continue; - var playerid = player.SteamID; - bool playerValue = RetrieveBoolValueById((int)playerid); - var message = info.GetArg(1); - if (string.IsNullOrWhiteSpace(message)) return HookResult.Continue; - string trimmedMessage1 = message.TrimStart(); - string trimmedMessage = trimmedMessage1.TrimEnd(); - - string[] disableCommands = Config.InGameSoundDisableCommands.Split(','); - - if (disableCommands.Any(cmd => cmd.Equals(trimmedMessage, StringComparison.OrdinalIgnoreCase))) - { DateTime personDate = DateTime.Now; - - + bool playerValue = CnD_SoundJson.RetrieveBoolValueById((int)playerid); playerValue = !playerValue; if (playerValue) { - player.PrintToChat(Localizer["InGame_Command_Disabled"]); + if (!string.IsNullOrEmpty(Localizer["command.sound.disabled"])) + { + Helper.AdvancedPrintToChat(player, Localizer["command.sound.disabled"]); + } }else { - player.PrintToChat(Localizer["InGame_Command_Enabled"]); + if (!string.IsNullOrEmpty(Localizer["command.sound.enabled"])) + { + Helper.AdvancedPrintToChat(player, Localizer["command.sound.enabled"]); + } } - SaveToJsonFile((int)playerid, playerValue, personDate); + CnD_SoundJson.SaveToJsonFile((int)playerid, playerValue, personDate); } return HookResult.Continue; } - private void OnMapStart(string Map) + public HookResult OnEventPlayerConnectFull(EventPlayerConnectFull @event, GameEventInfo info) { - if(Config.AutoDeleteLogsMoreThanXdaysOld > 0) + if (@event == null)return HookResult.Continue; + var player = @event.Userid; + + if (player == null || !player.IsValid || player.IsBot || player.IsHLTV) return HookResult.Continue; + var playerid = player.SteamID; + + if(!string.IsNullOrEmpty(Configs.GetConfigData().InGameAllowDisableCommandsOnlyForGroups) && Helper.IsPlayerInGroupPermission(player, Configs.GetConfigData().InGameAllowDisableCommandsOnlyForGroups)) { - string Fpath = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/logs"); - DeleteOldFiles(Fpath, "*" + Config.LogFileFormat, TimeSpan.FromDays(Config.AutoDeleteLogsMoreThanXdaysOld)); + if (!Globals.AllowedGroups.ContainsKey(playerid)) + { + Globals.AllowedGroups.Add(playerid, true); + } + } + + if(Configs.GetConfigData().DisableLoopConnections) + { + if (Globals.OnLoop.ContainsKey(playerid)) + { + Globals.OnLoop.Remove(playerid); + } } - } - + return HookResult.Continue; + } private void OnClientPutInServer(int playerSlot) { - string Fpath = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/logs/"); - string Time = DateTime.Now.ToString(Config.LogInsideFileTimeFormat); - string Date = DateTime.Now.ToString(Config.LogFileDateFormat); - string fileName = DateTime.Now.ToString(Config.LogFileDateFormat) + Config.LogFileFormat; + string Time = DateTime.Now.ToString("HH:mm:ss"); + string Date = DateTime.Now.ToString("MM-dd-yyyy"); + string fileName = DateTime.Now.ToString("MM-dd-yyyy") + ".txt"; string Tpath = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/logs/") + $"{fileName}"; - if(Config.SendLogToText && !Directory.Exists(Fpath)) - { - Directory.CreateDirectory(Fpath); - } - - if(Config.SendLogToText && !File.Exists(Tpath)) - { - File.Create(Tpath); - } - var player = Utilities.GetPlayerFromSlot(playerSlot); - if (player == null || !player.IsValid || player.IsBot || player.IsHLTV)return; var JoinPlayer = player.PlayerName; - var steamId2 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId2 : "InvalidSteamID"; - var steamId3 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId3 : "InvalidSteamID"; - var steamId32 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId32.ToString() : "InvalidSteamID"; - var steamId64 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId64.ToString() : "InvalidSteamID"; + var steamId2 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId2 : Localizer["invalid.steamid"]; + var steamId3 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId3 : Localizer["invalid.steamid"]; + var steamId32 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId32.ToString() : Localizer["invalid.steamid"]; + var steamId64 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId64.ToString() : Localizer["invalid.steamid"]; var GetIpAddress = NativeAPI.GetPlayerIpAddress(playerSlot); - var ipAddress = GetIpAddress?.Split(':')[0] ?? "InValidIpAddress"; + var ipAddress = GetIpAddress?.Split(':')[0] ?? Localizer["invalid.ipadress"]; var Country = GetCountry(ipAddress); var SCountry = GetCountryS(ipAddress); var City = GetCity(ipAddress); - - if (!string.IsNullOrEmpty(Localizer["InGame_Message_Connect"])) + + if (!string.IsNullOrEmpty(Localizer["chat.message.connect"])) { - Server.PrintToChatAll(Localizer["InGame_Message_Connect", Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, string.Empty]); + Helper.AdvancedPrintToServer(Localizer["chat.message.connect"],Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, string.Empty); } - - if(Config.SendLogToServerConsole) + + if (!string.IsNullOrEmpty(Localizer["console.message.connect"])) { - if (!string.IsNullOrEmpty(Config.LogServerConsoleFormatConnect)) + Helper.AdvancedPrintToConsoleServer(Localizer["console.message.connect"],Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, string.Empty); + } + + if(Configs.GetConfigData().SendLogToText) + { + if(!Directory.Exists(Fpath)) { - var replacer = ReplaceMessages(Config.LogServerConsoleFormatConnect, Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, string.Empty); - Server.PrintToConsole(replacer); + Directory.CreateDirectory(Fpath); } - } - if(Config.SendLogToText) - { - var replacerlog = ReplaceMessages(Config.LogTextFormatConnect, Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, string.Empty); - if (!string.IsNullOrEmpty(Config.LogTextFormatConnect) && File.Exists(Tpath)) + if(!File.Exists(Tpath)) + { + using (File.Create(Tpath)) { } + } + if (!string.IsNullOrEmpty(Configs.GetConfigData().Log_TextConnectMessageFormat) && File.Exists(Tpath)) { + var replacerlog = Helper.ReplaceMessages(Configs.GetConfigData().Log_TextConnectMessageFormat, Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, string.Empty); try { File.AppendAllLines(Tpath, new[]{replacerlog}); }catch { - Console.WriteLine("|||||||||||||||||||||||||||||| E R R O R ||||||||||||||||||||||||||||||"); - Console.WriteLine("[Error Cant Write] Please Give CnD_Sound.dll Permissions To Write"); - Console.WriteLine("|||||||||||||||||||||||||||||| E R R O R ||||||||||||||||||||||||||||||"); + } } } - var replacerDISCORDlog = ReplaceMessages(Config.LogDiscordChatFormatConnect, Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, string.Empty); - if(Config.SendLogToWebHook == 1) + if (!string.IsNullOrEmpty(Configs.GetConfigData().Log_DiscordConnectMessageFormat)) { - if (!string.IsNullOrEmpty(Config.LogDiscordChatFormatConnect)) + var replacerlogd = Helper.ReplaceMessages(Configs.GetConfigData().Log_DiscordConnectMessageFormat, Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, string.Empty); + if(Configs.GetConfigData().Log_SendLogToDiscordOnMode == 1) { - _ = SendToDiscordWebhookNormal(Config.WebHookURL, replacerDISCORDlog); - } - }else if(Config.SendLogToWebHook == 2) - { - if (!string.IsNullOrEmpty(Config.LogDiscordChatFormatConnect)) + Task.Run(() => + { + _ = CnD_SoundJson.SendToDiscordWebhookNormal(Configs.GetConfigData().Log_DiscordWebHookURL, replacerlogd); + }); + + }else if(Configs.GetConfigData().Log_SendLogToDiscordOnMode == 2) { - _ = SendToDiscordWebhookNameLink(Config.WebHookURL, replacerDISCORDlog, steamId64.ToString(), JoinPlayer); - } - }else if(Config.SendLogToWebHook == 3) - { - if (!string.IsNullOrEmpty(Config.LogDiscordChatFormatConnect)) + Task.Run(() => + { + _ = CnD_SoundJson.SendToDiscordWebhookNameLink(Configs.GetConfigData().Log_DiscordWebHookURL, replacerlogd, steamId64.ToString(), JoinPlayer); + }); + }else if(Configs.GetConfigData().Log_SendLogToDiscordOnMode == 3) { - _ = SendToDiscordWebhookNameLinkWithPicture(Config.WebHookURL, replacerDISCORDlog, steamId64.ToString(), JoinPlayer); + Task.Run(() => + { + _ = CnD_SoundJson.SendToDiscordWebhookNameLinkWithPicture(Configs.GetConfigData().Log_DiscordWebHookURL, replacerlogd, steamId64.ToString(), JoinPlayer); + }); } } - if (!string.IsNullOrEmpty(Config.InGameSoundConnect)) + + if (!string.IsNullOrEmpty(Configs.GetConfigData().InGameSoundConnect)) { - foreach(var players in GetPlayerControllers().FindAll(x => x.Connected == PlayerConnectedState.PlayerConnected && !x.IsBot)) + var AllPlayers = Helper.GetAllController(); + foreach(var players in AllPlayers) { - if (players.IsValid) + var playerid = players.SteamID; + bool playerValue = CnD_SoundJson.RetrieveBoolValueById((int)playerid); + if (!string.IsNullOrEmpty(Configs.GetConfigData().InGameSoundDisableCommands)) { - var playerid = players.SteamID; - bool playerValue = RetrieveBoolValueById((int)playerid); - if (!string.IsNullOrEmpty(Config.InGameSoundDisableCommands)) + if (playerValue) { - if (playerValue) - { - //skip sounds - }else - { - players.ExecuteClientCommand("play " + Config.InGameSoundConnect); - } + //skip sounds }else { - players.ExecuteClientCommand("play " + Config.InGameSoundConnect); + players.ExecuteClientCommand("play " + Configs.GetConfigData().InGameSoundConnect); } - + }else + { + players.ExecuteClientCommand("play " + Configs.GetConfigData().InGameSoundConnect); } } } } + private HookResult OnPlayerDisconnectPre(EventPlayerDisconnect @event, GameEventInfo info) + { + if (!Configs.GetConfigData().RemoveDefaultDisconnect || @event == null)return HookResult.Continue; + + info.DontBroadcast = true; + + return HookResult.Continue; + } private HookResult OnPlayerDisconnect(EventPlayerDisconnect @event, GameEventInfo info) { string Fpath = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/logs/"); - string Time = DateTime.Now.ToString(Config.LogInsideFileTimeFormat); - string Date = DateTime.Now.ToString(Config.LogFileDateFormat); - string fileName = DateTime.Now.ToString(Config.LogFileDateFormat) + Config.LogFileFormat; + string Time = DateTime.Now.ToString("HH:mm:ss"); + string Date = DateTime.Now.ToString("MM-dd-yyyy"); + string fileName = DateTime.Now.ToString("MM-dd-yyyy") + ".txt"; string Tpath = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/logs/") + $"{fileName}"; - if(Config.SendLogToText && !Directory.Exists(Fpath)) - { - Directory.CreateDirectory(Fpath); - } - - if(Config.SendLogToText && !File.Exists(Tpath)) - { - File.Create(Tpath); - } - var player = @event.Userid; var reasonInt = @event.Reason; if (player == null || !player.IsValid || player.IsBot || player.IsHLTV)return HookResult.Continue; - var playerSlot = player.Slot; - var JoinPlayer = player.PlayerName; - var steamId2 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId2 : "InvalidSteamID"; - var steamId3 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId3 : "InvalidSteamID"; - var steamId32 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId32.ToString() : "InvalidSteamID"; - var steamId64 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId64.ToString() : "InvalidSteamID"; + var LeftPlayer = player.PlayerName; + var steamId2 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId2 : Localizer["invalid.steamid"]; + var steamId3 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId3 : Localizer["invalid.steamid"]; + var steamId32 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId32.ToString() : Localizer["invalid.steamid"]; + var steamId64 = (player.AuthorizedSteamID != null) ? player.AuthorizedSteamID.SteamId64.ToString() : Localizer["invalid.steamid"]; var GetIpAddress = NativeAPI.GetPlayerIpAddress(playerSlot); - var ipAddress = GetIpAddress?.Split(':')[0] ?? "InValidIpAddress"; + var ipAddress = GetIpAddress?.Split(':')[0] ?? Localizer["invalid.ipadress"]; var Country = GetCountry(ipAddress); var SCountry = GetCountryS(ipAddress); var City = GetCity(ipAddress); - if (!string.IsNullOrEmpty(Localizer["InGame_Message_Disconnect"])) + if(Configs.GetConfigData().DisableLoopConnections) { - if (Enum.IsDefined(typeof(ENetworkDisconnectionReason), reasonInt)) + if(reasonInt == 54 || reasonInt == 55 || reasonInt == 57) { - string disconnectReasonString = NetworkDisconnectionReasonHelper.GetDisconnectReasonString((ENetworkDisconnectionReason)reasonInt); - Server.PrintToChatAll(Localizer["InGame_Message_Disconnect", Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, disconnectReasonString]); + if (!Globals.OnLoop.ContainsKey(player.SteamID)) + { + Globals.OnLoop.Add(player.SteamID, true); + } + if (Globals.OnLoop.ContainsKey(player.SteamID)) + { + return HookResult.Continue; + } } } - if(Config.SendLogToServerConsole) + if (!string.IsNullOrEmpty(Localizer["chat.message.disconnect"])) { - if (!string.IsNullOrEmpty(Config.LogServerConsoleFormatDisconnect)) + if (Enum.IsDefined(typeof(ENetworkDisconnectionReason), reasonInt)) { - if (Enum.IsDefined(typeof(ENetworkDisconnectionReason), reasonInt)) - { - string disconnectReasonString = NetworkDisconnectionReasonHelper.GetDisconnectReasonString((ENetworkDisconnectionReason)reasonInt); - var replacer = ReplaceMessages(Config.LogServerConsoleFormatDisconnect, Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, disconnectReasonString); - Server.PrintToConsole(replacer); - } + string disconnectReasonString = NetworkDisconnectionReasonHelper.GetDisconnectReasonString((ENetworkDisconnectionReason)reasonInt); + Helper.AdvancedPrintToServer(Localizer["chat.message.disconnect"],Date, Time, LeftPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, disconnectReasonString); } } - - if(Config.SendLogToText) + + if (!string.IsNullOrEmpty(Localizer["console.message.disconnect"])) { if (Enum.IsDefined(typeof(ENetworkDisconnectionReason), reasonInt)) { string disconnectReasonString = NetworkDisconnectionReasonHelper.GetDisconnectReasonString((ENetworkDisconnectionReason)reasonInt); - var replacerlog = ReplaceMessages(Config.LogTextFormatDisconnect, Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, disconnectReasonString); - if (!string.IsNullOrEmpty(Config.LogTextFormatDisconnect) && File.Exists(Tpath)) + Helper.AdvancedPrintToConsoleServer(Localizer["console.message.disconnect"],Date, Time, LeftPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, disconnectReasonString); + } + } + + if(Configs.GetConfigData().SendLogToText) + { + if(!Directory.Exists(Fpath)) + { + Directory.CreateDirectory(Fpath); + } + + if(!File.Exists(Tpath)) + { + using (File.Create(Tpath)) { } + } + + if (!string.IsNullOrEmpty(Configs.GetConfigData().Log_TextDisconnectMessageFormat) && File.Exists(Tpath)) + { + if (Enum.IsDefined(typeof(ENetworkDisconnectionReason), reasonInt)) { - + string disconnectReasonString = NetworkDisconnectionReasonHelper.GetDisconnectReasonString((ENetworkDisconnectionReason)reasonInt); + var replacerlog = Helper.ReplaceMessages(Configs.GetConfigData().Log_TextDisconnectMessageFormat, Date, Time, LeftPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, disconnectReasonString); try { File.AppendAllLines(Tpath, new[]{replacerlog}); }catch { - Console.WriteLine("|||||||||||||||||||||||||||||| E R R O R ||||||||||||||||||||||||||||||"); - Console.WriteLine("[Error Cant Write] Please Give CnD_Sound.dll Permissions To Write"); - Console.WriteLine("|||||||||||||||||||||||||||||| E R R O R ||||||||||||||||||||||||||||||"); + } } } } + - if (Enum.IsDefined(typeof(ENetworkDisconnectionReason), reasonInt)) + if (!string.IsNullOrEmpty(Configs.GetConfigData().Log_DiscordDisconnectMessageFormat)) { - string disconnectReasonString = NetworkDisconnectionReasonHelper.GetDisconnectReasonString((ENetworkDisconnectionReason)reasonInt); - var replacerDISCORDlog = ReplaceMessages(Config.LogDiscordChatFormatDisconnect, Date, Time, JoinPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, disconnectReasonString); - if(Config.SendLogToWebHook == 1) + if (Enum.IsDefined(typeof(ENetworkDisconnectionReason), reasonInt)) { - if (!string.IsNullOrEmpty(Config.LogDiscordChatFormatDisconnect)) + string disconnectReasonString = NetworkDisconnectionReasonHelper.GetDisconnectReasonString((ENetworkDisconnectionReason)reasonInt); + var replacerlogd = Helper.ReplaceMessages(Configs.GetConfigData().Log_DiscordDisconnectMessageFormat, Date, Time, LeftPlayer, steamId2, steamId3, steamId32.ToString(), steamId64.ToString(), ipAddress.ToString(), Country, SCountry, City, disconnectReasonString); + if(Configs.GetConfigData().Log_SendLogToDiscordOnMode == 1) { - _ = SendToDiscordWebhookNormal(Config.WebHookURL, replacerDISCORDlog); - } - }else if(Config.SendLogToWebHook == 2) - { - if (!string.IsNullOrEmpty(Config.LogDiscordChatFormatDisconnect)) + Task.Run(() => + { + _ = CnD_SoundJson.SendToDiscordWebhookNormal(Configs.GetConfigData().Log_DiscordWebHookURL, replacerlogd); + }); + + }else if(Configs.GetConfigData().Log_SendLogToDiscordOnMode == 2) { - _ = SendToDiscordWebhookNameLink(Config.WebHookURL, replacerDISCORDlog, steamId64.ToString(), JoinPlayer); - } - }else if(Config.SendLogToWebHook == 3) - { - if (!string.IsNullOrEmpty(Config.LogDiscordChatFormatDisconnect)) + Task.Run(() => + { + _ = CnD_SoundJson.SendToDiscordWebhookNameLink(Configs.GetConfigData().Log_DiscordWebHookURL, replacerlogd, steamId64.ToString(), LeftPlayer); + }); + }else if(Configs.GetConfigData().Log_SendLogToDiscordOnMode == 3) { - _ = SendToDiscordWebhookNameLinkWithPicture(Config.WebHookURL, replacerDISCORDlog, steamId64.ToString(), JoinPlayer); + Task.Run(() => + { + _ = CnD_SoundJson.SendToDiscordWebhookNameLinkWithPicture(Configs.GetConfigData().Log_DiscordWebHookURL, replacerlogd, steamId64.ToString(), LeftPlayer); + }); } } } - - if (!string.IsNullOrEmpty(Config.InGameSoundDisconnect)) + + if (!string.IsNullOrEmpty(Configs.GetConfigData().InGameSoundDisconnect)) { - foreach(var players in GetPlayerControllers().FindAll(x => x.Connected == PlayerConnectedState.PlayerConnected && !x.IsBot)) + var AllPlayers = Helper.GetAllController(); + foreach(var players in AllPlayers) { - if (players.IsValid) + var playerid = players.SteamID; + bool playerValue = CnD_SoundJson.RetrieveBoolValueById((int)playerid); + if (!string.IsNullOrEmpty(Configs.GetConfigData().InGameSoundDisableCommands)) { - var playerid = players.SteamID; - bool playerValue = RetrieveBoolValueById((int)playerid); - if (!string.IsNullOrEmpty(Config.InGameSoundDisableCommands)) + if (playerValue) { - if (playerValue) - { - //skip sounds - }else - { - players.ExecuteClientCommand("play " + Config.InGameSoundDisconnect); - } + //skip sounds }else { - players.ExecuteClientCommand("play " + Config.InGameSoundDisconnect); + players.ExecuteClientCommand("play " + Configs.GetConfigData().InGameSoundDisconnect); } - + }else + { + players.ExecuteClientCommand("play " + Configs.GetConfigData().InGameSoundDisconnect); } } } + Globals.AllowedGroups.Remove(player.SteamID); return HookResult.Continue; } - private string ReplaceMessages(string Message, string date, string time, string PlayerName, string SteamId, string SteamId3, string SteamId32, string SteamId64, string ipAddress, string Country, string SCountry, string City, string reason) - { - var replacedMessage = Message - .Replace("{TIME}", time) - .Replace("{DATE}", date) - .Replace("{PLAYERNAME}", PlayerName.ToString()) - .Replace("{STEAMID}", SteamId.ToString()) - .Replace("{STEAMID3}", SteamId3.ToString()) - .Replace("{STEAMID32}", SteamId32.ToString()) - .Replace("{STEAMID64}", SteamId64.ToString()) - .Replace("{IP}", ipAddress.ToString()) - .Replace("{LONGCOUNTRY}", Country) - .Replace("{SHORTCOUNTRY}", SCountry) - .Replace("{CITY}", City) - .Replace("{REASON}", reason); - return replacedMessage; - } - - private static List GetPlayerControllers() - { - var playerList = Utilities.FindAllEntitiesByDesignerName("cs_player_controller").ToList(); - - return playerList; - } - - private string GetCountryS(string ipAddress) + public string GetCountryS(string ipAddress) { + string cookiesFilePath = Configs.Shared.CookiesFolderPath!; try { - using (var reader = new DatabaseReader(Path.Combine(ModuleDirectory, "../../plugins/CnD_Sound/GeoLocation/GeoLite2-City.mmdb"))) + using (var reader = new DatabaseReader(Path.Combine(cookiesFilePath, "../../plugins/CnD_Sound/GeoLocation/GeoLite2-City.mmdb"))) { var response = reader.City(ipAddress); - return response.Country.IsoCode ?? "U/C"; + return response.Country.IsoCode ?? Localizer["unknown.short.country"]; } } catch (AddressNotFoundException) { - return "U/C"; + return Localizer["unknown.short.country"]; } catch { - return "U/C"; + return Localizer["unknown.short.country"]; } } - private string GetCountry(string ipAddress) + public string GetCountry(string ipAddress) { + string cookiesFilePath = Configs.Shared.CookiesFolderPath!; try { - using (var reader = new DatabaseReader(Path.Combine(ModuleDirectory, "../../plugins/CnD_Sound/GeoLocation/GeoLite2-City.mmdb"))) + using (var reader = new DatabaseReader(Path.Combine(cookiesFilePath, "../../plugins/CnD_Sound/GeoLocation/GeoLite2-City.mmdb"))) { var response = reader.City(ipAddress); - return response.Country.Name ?? "Unknown Country"; + return response.Country.Name ?? Localizer["unknown.long.country"]; } } catch (AddressNotFoundException) { - return "Unknown Country"; + return Localizer["unknown.long.country"]; } catch { - return "Unknown Country"; + return Localizer["unknown.long.country"]; } } - private string GetCity(string ipAddress) + public string GetCity(string ipAddress) { + string cookiesFilePath = Configs.Shared.CookiesFolderPath!; try { - using (var reader = new DatabaseReader(Path.Combine(ModuleDirectory, "../../plugins/CnD_Sound/GeoLocation/GeoLite2-City.mmdb"))) + using (var reader = new DatabaseReader(Path.Combine(cookiesFilePath, "../../plugins/CnD_Sound/GeoLocation/GeoLite2-City.mmdb"))) { var response = reader.City(ipAddress); - return response.City.Name ?? "Unknown City"; + return response.City.Name ?? Localizer["unknown.city"]; } } catch (AddressNotFoundException) { - return "Unknown City"; + return Localizer["unknown.city"]; } - catch + catch { - return "Unknown City"; + return Localizer["unknown.city"]; } } - - public async Task SendToDiscordWebhookNormal(string webhookUrl, string message) + public void OnMapEnd() { - try - { - var payload = new { content = message }; - var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload); - var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); - - var response = await _httpClient.PostAsync(webhookUrl, content).ConfigureAwait(false); - - if (!response.IsSuccessStatusCode) - { - Console.WriteLine($"Failed to send message. Status code: {response.StatusCode}, Response: {await response.Content.ReadAsStringAsync()}"); - } - } - catch (Exception ex) - { - Console.WriteLine($"Exception: {ex.Message}"); - } + Helper.ClearVariables(); } - - public async Task SendToDiscordWebhookNameLink(string webhookUrl, string message, string steamUserId, string STEAMNAME) - { - try - { - string profileLink = GetSteamProfileLink(steamUserId); - int colorss = int.Parse(Config.SideColorMessage, System.Globalization.NumberStyles.HexNumber); - Color color = Color.FromArgb(colorss >> 16, (colorss >> 8) & 0xFF, colorss & 0xFF); - using (var httpClient = new HttpClient()) - { - var embed = new - { - type = "rich", - title = STEAMNAME, - url = profileLink, - description = message, - color = color.ToArgb() & 0xFFFFFF - }; - - var payload = new - { - embeds = new[] { embed } - }; - - var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload); - var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); - var response = await _httpClient.PostAsync(webhookUrl, content).ConfigureAwait(false); - - if (!response.IsSuccessStatusCode) - { - Console.WriteLine($"Failed to send message. Status code: {response.StatusCode}, Response: {await response.Content.ReadAsStringAsync()}"); - } - } - } - catch (Exception ex) - { - Console.WriteLine($"Exception: {ex.Message}"); - } - } - public async Task SendToDiscordWebhookNameLinkWithPicture(string webhookUrl, string message, string steamUserId, string STEAMNAME) - { - try - { - string profileLink = GetSteamProfileLink(steamUserId); - string profilePictureUrl = await GetProfilePictureAsync(steamUserId); - int colorss = int.Parse(Config.SideColorMessage, System.Globalization.NumberStyles.HexNumber); - Color color = Color.FromArgb(colorss >> 16, (colorss >> 8) & 0xFF, colorss & 0xFF); - using (var httpClient = new HttpClient()) - { - var embed = new - { - type = "rich", - description = message, - color = color.ToArgb() & 0xFFFFFF, - author = new - { - name = STEAMNAME, - url = profileLink, - icon_url = profilePictureUrl - } - }; - - var payload = new - { - embeds = new[] { embed } - }; - - var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload); - var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); - var response = await _httpClient.PostAsync(webhookUrl, content).ConfigureAwait(false); - - if (!response.IsSuccessStatusCode) - { - Console.WriteLine($"Failed to send message. Status code: {response.StatusCode}, Response: {await response.Content.ReadAsStringAsync()}"); - } - } - } - catch (Exception ex) - { - Console.WriteLine($"Exception: {ex.Message}"); - } - } - private static async Task GetProfilePictureAsync(string steamId64) - { - try - { - string apiUrl = $"https://steamcommunity.com/profiles/{steamId64}/?xml=1"; - - HttpResponseMessage response = await httpClient.GetAsync(apiUrl); - - if (response.IsSuccessStatusCode) - { - string xmlResponse = await response.Content.ReadAsStringAsync(); - int startIndex = xmlResponse.IndexOf("", startIndex); - string profilePictureUrl = xmlResponse.Substring(startIndex, endIndex - startIndex); - - return profilePictureUrl; - } - else - { - Console.WriteLine($"Error: {response.StatusCode} - {response.ReasonPhrase}"); - return null!; - } - } - catch (Exception ex) - { - Console.WriteLine($"Exception: {ex.Message}"); - return null!; - } - } - static string GetSteamProfileLink(string userId) - { - return $"https://steamcommunity.com/profiles/{userId}"; - } - static void DeleteOldFiles(string folderPath, string searchPattern, TimeSpan maxAge) - { - try - { - DirectoryInfo directoryInfo = new DirectoryInfo(folderPath); - - if (directoryInfo.Exists) - { - FileInfo[] files = directoryInfo.GetFiles(searchPattern); - DateTime currentTime = DateTime.Now; - - foreach (FileInfo file in files) - { - TimeSpan age = currentTime - file.LastWriteTime; - - if (age > maxAge) - { - file.Delete(); - } - } - } - else - { - Console.WriteLine($"Directory not found: {folderPath}"); - } - } - catch (Exception ex) - { - Console.WriteLine($"Error: {ex.Message}"); - } - } - private void SaveToJsonFile(int id, bool boolValue, DateTime date) - { - string Fpath = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/Cookies/"); - string Fpathc = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/Cookies/CnD_Sound_Cookies.json"); - try - { - if(!Directory.Exists(Fpath)) - { - Directory.CreateDirectory(Fpath); - } - - if (!File.Exists(Fpathc)) - { - File.WriteAllText(Fpathc, "[]"); - } - - List allPersonsData; - string jsonData = File.ReadAllText(Fpathc); - allPersonsData = JsonConvert.DeserializeObject>(jsonData) ?? new List(); - - PersonData existingPerson = allPersonsData.Find(p => p.Id == id)!; - - if (existingPerson != null) - { - existingPerson.BoolValue = boolValue; - existingPerson.Date = date; - } - else - { - PersonData newPerson = new PersonData { Id = id, BoolValue = boolValue, Date = date }; - allPersonsData.Add(newPerson); - } - allPersonsData.RemoveAll(p => (DateTime.Now - p.Date).TotalDays > Config.RemovePlayerCookieOlderThanXDays); - - string updatedJsonData = JsonConvert.SerializeObject(allPersonsData, Formatting.Indented); - try - { - File.WriteAllText(Fpathc, updatedJsonData); - }catch - { - } - }catch - { - } - } - - private bool RetrieveBoolValueById(int targetId) - { - string Fpath = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/Cookies/"); - string Fpathc = Path.Combine(ModuleDirectory,"../../plugins/CnD_Sound/Cookies/CnD_Sound_Cookies.json"); - try - { - if (File.Exists(Fpathc)) - { - string jsonData = File.ReadAllText(Fpathc); - List allPersonsData = JsonConvert.DeserializeObject>(jsonData) ?? new List(); - - PersonData targetPerson = allPersonsData.Find(p => p.Id == targetId)!; - - if (targetPerson != null) - { - if (DateTime.Now - targetPerson.Date <= TimeSpan.FromDays(Config.RemovePlayerCookieOlderThanXDays)) - { - return targetPerson.BoolValue; - } - else - { - allPersonsData.Remove(targetPerson); - string updatedJsonData = JsonConvert.SerializeObject(allPersonsData, Formatting.Indented); - try - { - File.WriteAllText(Fpathc, updatedJsonData); - }catch - { - } - } - } - } - return false; - }catch - { - return false; - } - } - - - private class PersonData + public override void Unload(bool hotReload) { - public int Id { get; set; } - public bool BoolValue { get; set; } - public DateTime Date { get; set; } + Helper.ClearVariables(); } } \ No newline at end of file diff --git a/Config/Configs.cs b/Config/Configs.cs new file mode 100644 index 0000000..7b15532 --- /dev/null +++ b/Config/Configs.cs @@ -0,0 +1,160 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace CnD_Sound.Config +{ + public static class Configs + { + public static class Shared { + public static string? CookiesFolderPath { get; set; } + } + + private static readonly string ConfigDirectoryName = "config"; + private static readonly string ConfigFileName = "config.json"; + private static string? _configFilePath; + private static ConfigData? _configData; + + private static readonly JsonSerializerOptions SerializationOptions = new() + { + Converters = + { + new JsonStringEnumConverter() + }, + WriteIndented = true, + AllowTrailingCommas = true, + ReadCommentHandling = JsonCommentHandling.Skip, + }; + + public static bool IsLoaded() + { + return _configData is not null; + } + + public static ConfigData GetConfigData() + { + if (_configData is null) + { + throw new Exception("Config not yet loaded."); + } + + return _configData; + } + + public static ConfigData Load(string modulePath) + { + var configFileDirectory = Path.Combine(modulePath, ConfigDirectoryName); + if(!Directory.Exists(configFileDirectory)) + { + Directory.CreateDirectory(configFileDirectory); + } + + _configFilePath = Path.Combine(configFileDirectory, ConfigFileName); + if (File.Exists(_configFilePath)) + { + _configData = JsonSerializer.Deserialize(File.ReadAllText(_configFilePath), SerializationOptions); + } + else + { + _configData = new ConfigData(); + } + + if (_configData is null) + { + throw new Exception("Failed to load configs."); + } + + SaveConfigData(_configData); + + return _configData; + } + + private static void SaveConfigData(ConfigData configData) + { + if (_configFilePath is null) + { + throw new Exception("Config not yet loaded."); + } + + File.WriteAllText(_configFilePath, JsonSerializer.Serialize(configData, SerializationOptions)); + } + + public class ConfigData + { + public bool DisableLoopConnections { get; set; } + public bool RemoveDefaultDisconnect { get; set; } + public string InGameSoundConnect { get; set; } + public string InGameSoundDisconnect { get; set; } + public string InGameAllowDisableCommandsOnlyForGroups { get; set; } + public string InGameSoundDisableCommands { get; set; } + public int RemovePlayerCookieOlderThanXDays { get; set; } + public string empty { get; set; } + public bool SendLogToText { get; set; } + public string Log_TextConnectMessageFormat { get; set; } + public string Log_TextDisconnectMessageFormat { get; set; } + public int Log_AutoDeleteLogsMoreThanXdaysOld { get; set; } + private int _Log_SendLogToDiscordOnMode; + public int Log_SendLogToDiscordOnMode + { + get => _Log_SendLogToDiscordOnMode; + set + { + _Log_SendLogToDiscordOnMode = value; + if (_Log_SendLogToDiscordOnMode < 0 || _Log_SendLogToDiscordOnMode > 3) + { + Log_SendLogToDiscordOnMode = 0; + Console.WriteLine("|||||||||||||||||||||||||||||||||||||||||||||||| I N V A L I D ||||||||||||||||||||||||||||||||||||||||||||||||"); + Console.WriteLine("[Vote-GoldKingZ] Log_SendLogToDiscordOnMode: is invalid, setting to default value (0) Please Choose 0 or 1 or 2 or 3."); + Console.WriteLine("[Vote-GoldKingZ] Log_SendLogToDiscordOnMode (0) = Disable"); + Console.WriteLine("[Vote-GoldKingZ] Log_SendLogToDiscordOnMode (1) = Text Only"); + Console.WriteLine("[Vote-GoldKingZ] Log_SendLogToDiscordOnMode (2) = Text With + Name + Hyperlink To Steam Profile"); + Console.WriteLine("[Vote-GoldKingZ] Log_SendLogToDiscordOnMode (3) = Text With + Name + Hyperlink To Steam Profile + Profile Picture"); + Console.WriteLine("|||||||||||||||||||||||||||||||||||||||||||||||| I N V A L I D ||||||||||||||||||||||||||||||||||||||||||||||||"); + } + } + } + private string? _Log_DiscordSideColor; + public string Log_DiscordSideColor + { + get => _Log_DiscordSideColor!; + set + { + _Log_DiscordSideColor = value; + if (_Log_DiscordSideColor.StartsWith("#")) + { + Log_DiscordSideColor = _Log_DiscordSideColor.Substring(1); + } + } + } + public string Log_DiscordWebHookURL { get; set; } + public string Log_DiscordConnectMessageFormat { get; set; } + public string Log_DiscordDisconnectMessageFormat { get; set; } + public string Log_DiscordUsersWithNoAvatarImage { get; set; } + public string empty2 { get; set; } + public string Information_For_You_Dont_Delete_it { get; set; } + + public ConfigData() + { + DisableLoopConnections = true; + RemoveDefaultDisconnect = true; + InGameSoundConnect = "sounds/buttons/blip1.vsnd_c"; + InGameSoundDisconnect = "sounds/player/taunt_clap_01.vsnd_c"; + InGameAllowDisableCommandsOnlyForGroups = ""; + InGameSoundDisableCommands = "!stopsound,!stopsounds"; + RemovePlayerCookieOlderThanXDays = 7; + empty = "-----------------------------------------------------------------------------------"; + SendLogToText = false; + Log_TextConnectMessageFormat = "[{DATE} - {TIME}] {PLAYERNAME} Connected [{SHORTCOUNTRY} - {CITY}] [{STEAMID} - {IP}]"; + Log_TextDisconnectMessageFormat = "[{DATE} - {TIME}] {PLAYERNAME} Disconnected [{SHORTCOUNTRY} - {CITY}] [{STEAMID64}] [{STEAMID} - {IP}] [{REASON}]"; + Log_AutoDeleteLogsMoreThanXdaysOld = 7; + Log_SendLogToDiscordOnMode = 0; + Log_DiscordSideColor = "00FFFF"; + Log_DiscordWebHookURL = "https://discord.com/api/webhooks/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; + Log_DiscordConnectMessageFormat = "{PLAYERNAME} Connected [{LONGCOUNTRY} - {CITY}]"; + Log_DiscordDisconnectMessageFormat = "{PLAYERNAME} Disconnected [{LONGCOUNTRY} - {CITY}] [{REASON}]"; + Log_DiscordUsersWithNoAvatarImage = "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/b5/b5bd56c1aa4644a474a2e4972be27ef9e82e517e_full.jpg"; + empty2 = "-----------------------------------------------------------------------------------"; + Information_For_You_Dont_Delete_it = " Vist [https://github.com/oqyh/cs2-Connect-Disconnect-Sound/tree/main?tab=readme-ov-file#-configuration-] To Understand All Above"; + } + } + } +} diff --git a/CounterStrikeSharp.API.dll b/CounterStrikeSharp.API.dll index 3abc691..ab832f0 100644 Binary files a/CounterStrikeSharp.API.dll and b/CounterStrikeSharp.API.dll differ diff --git a/Helper/CnDJson.cs b/Helper/CnDJson.cs new file mode 100644 index 0000000..5f9a2d7 --- /dev/null +++ b/Helper/CnDJson.cs @@ -0,0 +1,231 @@ +using Newtonsoft.Json; +using CnD_Sound.Config; +using System.Text; +using System.Drawing; + +namespace CnD_Sound; + +public class CnD_SoundJson +{ + private static readonly HttpClient _httpClient = new HttpClient(); + private static readonly HttpClient httpClient = new HttpClient(); + private class PersonData + { + public int Id { get; set; } + public bool BoolValue { get; set; } + public DateTime Date { get; set; } + } + public static async Task SendToDiscordWebhookNormal(string webhookUrl, string message) + { + try + { + var payload = new { content = message }; + var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload); + var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); + + var response = await _httpClient.PostAsync(webhookUrl, content).ConfigureAwait(false); + + + } + catch + { + } + } + + public static async Task SendToDiscordWebhookNameLink(string webhookUrl, string message, string steamUserId, string STEAMNAME) + { + try + { + string profileLink = GetSteamProfileLink(steamUserId); + int colorss = int.Parse(Configs.GetConfigData().Log_DiscordSideColor, System.Globalization.NumberStyles.HexNumber); + Color color = Color.FromArgb(colorss >> 16, (colorss >> 8) & 0xFF, colorss & 0xFF); + using (var httpClient = new HttpClient()) + { + var embed = new + { + type = "rich", + title = STEAMNAME, + url = profileLink, + description = message, + color = color.ToArgb() & 0xFFFFFF + }; + + var payload = new + { + embeds = new[] { embed } + }; + + var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload); + var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); + var response = await _httpClient.PostAsync(webhookUrl, content).ConfigureAwait(false); + + } + } + catch + { + } + } + public static async Task SendToDiscordWebhookNameLinkWithPicture(string webhookUrl, string message, string steamUserId, string STEAMNAME) + { + try + { + string profileLink = GetSteamProfileLink(steamUserId); + string profilePictureUrl = await GetProfilePictureAsync(steamUserId, Configs.GetConfigData().Log_DiscordUsersWithNoAvatarImage); + int colorss = int.Parse(Configs.GetConfigData().Log_DiscordSideColor, System.Globalization.NumberStyles.HexNumber); + Color color = Color.FromArgb(colorss >> 16, (colorss >> 8) & 0xFF, colorss & 0xFF); + using (var httpClient = new HttpClient()) + { + var embed = new + { + type = "rich", + description = message, + color = color.ToArgb() & 0xFFFFFF, + author = new + { + name = STEAMNAME, + url = profileLink, + icon_url = profilePictureUrl + } + }; + + var payload = new + { + embeds = new[] { embed } + }; + + var jsonPayload = Newtonsoft.Json.JsonConvert.SerializeObject(payload); + var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json"); + var response = await _httpClient.PostAsync(webhookUrl, content).ConfigureAwait(false); + } + } + catch + { + + } + } + public static async Task GetProfilePictureAsync(string steamId64, string defaultImage) + { + try + { + string apiUrl = $"https://steamcommunity.com/profiles/{steamId64}/?xml=1"; + + HttpResponseMessage response = await httpClient.GetAsync(apiUrl); + + if (response.IsSuccessStatusCode) + { + string xmlResponse = await response.Content.ReadAsStringAsync(); + int startIndex = xmlResponse.IndexOf("", startIndex); + + if (endIndex >= 0) + { + string profilePictureUrl = xmlResponse.Substring(startIndex, endIndex - startIndex); + return profilePictureUrl; + } + else + { + return defaultImage; + } + } + else + { + return null!; + } + } + catch + { + return null!; + } + } + public static string GetSteamProfileLink(string userId) + { + return $"https://steamcommunity.com/profiles/{userId}"; + } + + public static void SaveToJsonFile(int id, bool boolValue, DateTime date) + { + string cookiesFilePath = Configs.Shared.CookiesFolderPath!; + string Fpath = Path.Combine(cookiesFilePath,"../../plugins/CnD_Sound/Cookies/"); + string Fpathc = Path.Combine(cookiesFilePath,"../../plugins/CnD_Sound/Cookies/CnD_Sound_Cookies.json"); + try + { + if(!Directory.Exists(Fpath)) + { + Directory.CreateDirectory(Fpath); + } + + if (!File.Exists(Fpathc)) + { + File.WriteAllText(Fpathc, "[]"); + } + + List allPersonsData; + string jsonData = File.ReadAllText(Fpathc); + allPersonsData = JsonConvert.DeserializeObject>(jsonData) ?? new List(); + + PersonData existingPerson = allPersonsData.Find(p => p.Id == id)!; + + if (existingPerson != null) + { + existingPerson.BoolValue = boolValue; + existingPerson.Date = date; + } + else + { + PersonData newPerson = new PersonData { Id = id, BoolValue = boolValue, Date = date }; + allPersonsData.Add(newPerson); + } + allPersonsData.RemoveAll(p => (DateTime.Now - p.Date).TotalDays > Configs.GetConfigData().RemovePlayerCookieOlderThanXDays); + + string updatedJsonData = JsonConvert.SerializeObject(allPersonsData, Formatting.Indented); + try + { + File.WriteAllText(Fpathc, updatedJsonData); + }catch + { + } + }catch + { + } + } + + public static bool RetrieveBoolValueById(int targetId) + { + string cookiesFilePath = Configs.Shared.CookiesFolderPath!; + string Fpath = Path.Combine(cookiesFilePath,"../../plugins/CnD_Sound/Cookies/"); + string Fpathc = Path.Combine(cookiesFilePath,"../../plugins/CnD_Sound/Cookies/CnD_Sound_Cookies.json"); + try + { + if (File.Exists(Fpathc)) + { + string jsonData = File.ReadAllText(Fpathc); + List allPersonsData = JsonConvert.DeserializeObject>(jsonData) ?? new List(); + + PersonData targetPerson = allPersonsData.Find(p => p.Id == targetId)!; + + if (targetPerson != null) + { + if (DateTime.Now - targetPerson.Date <= TimeSpan.FromDays(Configs.GetConfigData().RemovePlayerCookieOlderThanXDays)) + { + return targetPerson.BoolValue; + } + else + { + allPersonsData.Remove(targetPerson); + string updatedJsonData = JsonConvert.SerializeObject(allPersonsData, Formatting.Indented); + try + { + File.WriteAllText(Fpathc, updatedJsonData); + }catch + { + } + } + } + } + return false; + }catch + { + return false; + } + } +} \ No newline at end of file diff --git a/Helper/Globals.cs b/Helper/Globals.cs new file mode 100644 index 0000000..693c7e6 --- /dev/null +++ b/Helper/Globals.cs @@ -0,0 +1,7 @@ +namespace CnD_Sound; + +public class Globals +{ + public static Dictionary AllowedGroups = new Dictionary(); + public static Dictionary OnLoop = new Dictionary(); +} \ No newline at end of file diff --git a/Helper/Helper.cs b/Helper/Helper.cs new file mode 100644 index 0000000..1263724 --- /dev/null +++ b/Helper/Helper.cs @@ -0,0 +1,148 @@ +using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API; +using System.Text.RegularExpressions; +using CounterStrikeSharp.API.Modules.Admin; + +namespace CnD_Sound; + +public class Helper +{ + public static void AdvancedPrintToChat(CCSPlayerController player, string message, params object[] args) + { + for (int i = 0; i < args.Length; i++) + { + message = message.Replace($"{{{i}}}", args[i].ToString()); + } + if (Regex.IsMatch(message, "{nextline}", RegexOptions.IgnoreCase)) + { + string[] parts = Regex.Split(message, "{nextline}", RegexOptions.IgnoreCase); + foreach (string part in parts) + { + string messages = part.Trim(); + player.PrintToChat(" " + messages); + } + }else + { + player.PrintToChat(message); + } + } + public static void AdvancedPrintToServer(string message, params object[] args) + { + for (int i = 0; i < args.Length; i++) + { + message = message.Replace($"{{{i}}}", args[i].ToString()); + } + if (Regex.IsMatch(message, "{nextline}", RegexOptions.IgnoreCase)) + { + string[] parts = Regex.Split(message, "{nextline}", RegexOptions.IgnoreCase); + foreach (string part in parts) + { + string messages = part.Trim(); + Server.PrintToChatAll(" " + messages); + } + }else + { + Server.PrintToChatAll(message); + } + } + public static void AdvancedPrintToConsoleServer(string message, params object[] args) + { + for (int i = 0; i < args.Length; i++) + { + message = message.Replace($"{{{i}}}", args[i].ToString()); + } + if (Regex.IsMatch(message, "{nextline}", RegexOptions.IgnoreCase)) + { + string[] parts = Regex.Split(message, "{nextline}", RegexOptions.IgnoreCase); + foreach (string part in parts) + { + string messages = part.Trim(); + Server.PrintToConsole(" " + messages); + } + }else + { + Server.PrintToConsole(message); + } + } + public static string ReplaceMessages(string Message, string date, string time, string PlayerName, string SteamId, string SteamId3, string SteamId32, string SteamId64, string ipAddress, string Country, string SCountry, string City, string reason) + { + var replacedMessage = Message + .Replace("{TIME}", time) + .Replace("{DATE}", date) + .Replace("{PLAYERNAME}", PlayerName.ToString()) + .Replace("{STEAMID}", SteamId.ToString()) + .Replace("{STEAMID3}", SteamId3.ToString()) + .Replace("{STEAMID32}", SteamId32.ToString()) + .Replace("{STEAMID64}", SteamId64.ToString()) + .Replace("{IP}", ipAddress.ToString()) + .Replace("{LONGCOUNTRY}", Country) + .Replace("{SHORTCOUNTRY}", SCountry) + .Replace("{CITY}", City) + .Replace("{REASON}", reason); + return replacedMessage; + } + + public static List GetPlayerControllers() + { + var playerList = Utilities.FindAllEntitiesByDesignerName("cs_player_controller").ToList(); + + return playerList; + } + + + public static void DeleteOldFiles(string folderPath, string searchPattern, TimeSpan maxAge) + { + try + { + DirectoryInfo directoryInfo = new DirectoryInfo(folderPath); + + if (directoryInfo.Exists) + { + FileInfo[] files = directoryInfo.GetFiles(searchPattern); + DateTime currentTime = DateTime.Now; + + foreach (FileInfo file in files) + { + TimeSpan age = currentTime - file.LastWriteTime; + + if (age > maxAge) + { + file.Delete(); + } + } + } + } + catch + { + + } + } + public static List GetAllController() + { + var playerList = Utilities.FindAllEntitiesByDesignerName("cs_player_controller").Where(p => p != null && p.IsValid && !p.IsBot && !p.IsHLTV && p.Connected == PlayerConnectedState.PlayerConnected).ToList(); + return playerList; + } + public static bool IsPlayerInGroupPermission(CCSPlayerController player, string groups) + { + var excludedGroups = groups.Split(','); + foreach (var group in excludedGroups) + { + if (group.StartsWith("#")) + { + if (AdminManager.PlayerInGroup(player, group)) + return true; + } + else if (group.StartsWith("@")) + { + if (AdminManager.PlayerHasPermissions(player, group)) + return true; + } + } + return false; + } + public static void ClearVariables() + { + Globals.AllowedGroups.Clear(); + Globals.OnLoop.Clear(); + } +} \ No newline at end of file diff --git a/Helper/NetworkDisconnectionReasonHelper.cs b/Helper/NetworkDisconnectionReasonHelper.cs new file mode 100644 index 0000000..c7ce52a --- /dev/null +++ b/Helper/NetworkDisconnectionReasonHelper.cs @@ -0,0 +1,368 @@ +public enum ENetworkDisconnectionReason +{ + NETWORK_DISCONNECT_INVALID = 0, // Invalid + NETWORK_DISCONNECT_SHUTDOWN = 1, // Server Shutdown + NETWORK_DISCONNECT_DISCONNECT_BY_USER = 2, // "#GameUI_Disconnect_User" + NETWORK_DISCONNECT_DISCONNECT_BY_SERVER = 3, // "#GameUI_Disconnect_Server" + NETWORK_DISCONNECT_LOST = 4, // "#GameUI_Disconnect_ConnectionLost" + NETWORK_DISCONNECT_OVERFLOW = 5, // "#GameUI_Disconnect_ConnectionOverflow" + NETWORK_DISCONNECT_STEAM_BANNED = 6, // "#GameUI_Disconnect_SteamIDBanned" + NETWORK_DISCONNECT_STEAM_INUSE = 7, // "#GameUI_Disconnect_SteamIDInUse" + NETWORK_DISCONNECT_STEAM_TICKET = 8, // "#GameUI_Disconnect_SteamTicket" + NETWORK_DISCONNECT_STEAM_LOGON = 9, // "#GameUI_Disconnect_SteamLogon" + NETWORK_DISCONNECT_STEAM_AUTHCANCELLED = 10, // "#GameUI_Disconnect_SteamLogon" + NETWORK_DISCONNECT_STEAM_AUTHALREADYUSED = 11, // "#GameUI_Disconnect_SteamLogon" + NETWORK_DISCONNECT_STEAM_AUTHINVALID = 12, // "#GameUI_Disconnect_SteamLogon" + NETWORK_DISCONNECT_STEAM_VACBANSTATE = 13, // "#GameUI_Disconnect_SteamVAC" + NETWORK_DISCONNECT_STEAM_LOGGED_IN_ELSEWHERE = 14, // "#GameUI_Disconnect_SteamInUse" + NETWORK_DISCONNECT_STEAM_VAC_CHECK_TIMEDOUT = 15, // "#GameUI_Disconnect_SteamTimeOut" + NETWORK_DISCONNECT_STEAM_DROPPED = 16, // "#GameUI_Disconnect_SteamDropped" + NETWORK_DISCONNECT_STEAM_OWNERSHIP = 17, // "#GameUI_Disconnect_SteamOwnership" + NETWORK_DISCONNECT_SERVERINFO_OVERFLOW = 18, // "#GameUI_Disconnect_ServerInfoOverflow" + NETWORK_DISCONNECT_TICKMSG_OVERFLOW = 19, // "#GameUI_Disconnect_TickMessage" + NETWORK_DISCONNECT_STRINGTABLEMSG_OVERFLOW = 20, // "#GameUI_Disconnect_StringTableMessage" + NETWORK_DISCONNECT_DELTAENTMSG_OVERFLOW = 21, // "#GameUI_Disconnect_DeltaEntMessage" + NETWORK_DISCONNECT_TEMPENTMSG_OVERFLOW = 22, // "#GameUI_Disconnect_TempEntMessage" + NETWORK_DISCONNECT_SOUNDSMSG_OVERFLOW = 23, // "#GameUI_Disconnect_SoundsMessage" + NETWORK_DISCONNECT_SNAPSHOTOVERFLOW = 24, // "#GameUI_Disconnect_SnapshotOverflow" + NETWORK_DISCONNECT_SNAPSHOTERROR = 25, // "#GameUI_Disconnect_SnapshotError" + NETWORK_DISCONNECT_RELIABLEOVERFLOW = 26, // "#GameUI_Disconnect_ReliableOverflow" + NETWORK_DISCONNECT_BADDELTATICK = 27, // "#GameUI_Disconnect_BadClientDeltaTick" + NETWORK_DISCONNECT_NOMORESPLITS = 28, // "#GameUI_Disconnect_NoMoreSplits" + NETWORK_DISCONNECT_TIMEDOUT = 29, // "#GameUI_Disconnect_TimedOut" + NETWORK_DISCONNECT_DISCONNECTED = 30, // "#GameUI_Disconnect_Disconnected" + NETWORK_DISCONNECT_LEAVINGSPLIT = 31, // "#GameUI_Disconnect_LeavingSplit" + NETWORK_DISCONNECT_DIFFERENTCLASSTABLES = 32, // "#GameUI_Disconnect_DifferentClassTables" + NETWORK_DISCONNECT_BADRELAYPASSWORD = 33, // "#GameUI_Disconnect_BadRelayPassword" + NETWORK_DISCONNECT_BADSPECTATORPASSWORD = 34, // "#GameUI_Disconnect_BadSpectatorPassword" + NETWORK_DISCONNECT_HLTVRESTRICTED = 35, // "#GameUI_Disconnect_HLTVRestricted" + NETWORK_DISCONNECT_NOSPECTATORS = 36, // "#GameUI_Disconnect_NoSpectators" + NETWORK_DISCONNECT_HLTVUNAVAILABLE = 37, // "#GameUI_Disconnect_HLTVUnavailable" + NETWORK_DISCONNECT_HLTVSTOP = 38, // "#GameUI_Disconnect_HLTVStop" + NETWORK_DISCONNECT_KICKED = 39, // "#GameUI_Disconnect_Kicked" + NETWORK_DISCONNECT_BANADDED = 40, // "#GameUI_Disconnect_BanAdded" + NETWORK_DISCONNECT_KICKBANADDED = 41, // "#GameUI_Disconnect_KickBanAdded" + NETWORK_DISCONNECT_HLTVDIRECT = 42, // "#GameUI_Disconnect_HLTVDirect" + NETWORK_DISCONNECT_PURESERVER_CLIENTEXTRA = 43, // "#GameUI_Disconnect_PureServer_ClientExtra" + NETWORK_DISCONNECT_PURESERVER_MISMATCH = 44, // "#GameUI_Disconnect_PureServer_Mismatch" + NETWORK_DISCONNECT_USERCMD = 45, // "#GameUI_Disconnect_UserCmd" + NETWORK_DISCONNECT_REJECTED_BY_GAME = 46, // "#GameUI_Disconnect_RejectedByGame" + NETWORK_DISCONNECT_MESSAGE_PARSE_ERROR = 47, // "#GameUI_Disconnect_MessageParseError" + NETWORK_DISCONNECT_INVALID_MESSAGE_ERROR = 48, // "#GameUI_Disconnect_InvalidMessageError" + NETWORK_DISCONNECT_BAD_SERVER_PASSWORD = 49, // "#GameUI_Disconnect_BadServerPassword" + NETWORK_DISCONNECT_DIRECT_CONNECT_RESERVATION = 50, + NETWORK_DISCONNECT_CONNECTION_FAILURE = 51, // "#GameUI_Disconnect_ConnectionFailure" + NETWORK_DISCONNECT_NO_PEER_GROUP_HANDLERS = 52, // "#GameUI_Disconnect_NoPeerGroupHandlers" + NETWORK_DISCONNECT_RECONNECTION = 53, + NETWORK_DISCONNECT_LOOPSHUTDOWN = 54, // "#GameUI_Disconnect_LoopShutdown" + NETWORK_DISCONNECT_LOOPDEACTIVATE = 55, // "#GameUI_Disconnect_LoopDeactivate" + NETWORK_DISCONNECT_HOST_ENDGAME = 56, // "#GameUI_Disconnect_Host_EndGame" + NETWORK_DISCONNECT_LOOP_LEVELLOAD_ACTIVATE = 57, // "#GameUI_Disconnect_LoopLevelLoadActivate" + NETWORK_DISCONNECT_CREATE_SERVER_FAILED = 58, // "#GameUI_Disconnect_CreateServerFailed" + NETWORK_DISCONNECT_EXITING = 59, // "#GameUI_Disconnect_ExitingEngine" + NETWORK_DISCONNECT_REQUEST_HOSTSTATE_IDLE = 60, // "#GameUI_Disconnect_Request_HSIdle" + NETWORK_DISCONNECT_REQUEST_HOSTSTATE_HLTVRELAY = 61, // "#GameUI_Disconnect_Request_HLTVRelay" + NETWORK_DISCONNECT_CLIENT_CONSISTENCY_FAIL = 62, // "#GameUI_ClientConsistencyFail" + NETWORK_DISCONNECT_CLIENT_UNABLE_TO_CRC_MAP = 63, // "#GameUI_ClientUnableToCRCMap" + NETWORK_DISCONNECT_CLIENT_NO_MAP = 64, // "#GameUI_ClientNoMap" + NETWORK_DISCONNECT_CLIENT_DIFFERENT_MAP = 65, // "#GameUI_ClientDifferentMap" + NETWORK_DISCONNECT_SERVER_REQUIRES_STEAM = 66, // "#GameUI_ServerRequireSteams" + NETWORK_DISCONNECT_STEAM_DENY_MISC = 67, // "#GameUI_Disconnect_SteamDeny_Misc" + NETWORK_DISCONNECT_STEAM_DENY_BAD_ANTI_CHEAT = 68, // "#GameUI_Disconnect_SteamDeny_BadAntiCheat" + NETWORK_DISCONNECT_SERVER_SHUTDOWN = 69, // "#GameUI_Disconnect_ServerShutdown" + NETWORK_DISCONNECT_REPLAY_INCOMPATIBLE = 71, // "#GameUI_Disconnect_ReplayIncompatible" + NETWORK_DISCONNECT_CONNECT_REQUEST_TIMEDOUT = 72, // "#GameUI_Disconnect_ConnectionTimedout" + NETWORK_DISCONNECT_SERVER_INCOMPATIBLE = 73, // "#GameUI_Disconnect_ServerIncompatible" + NETWORK_DISCONNECT_LOCALPROBLEM_MANYRELAYS = 74, // "#GameUI_Disconnect_LocalProblem_ManyRelays" + NETWORK_DISCONNECT_LOCALPROBLEM_HOSTEDSERVERPRIMARYRELAY = 75, // "#GameUI_Disconnect_LocalProblem_HostedServerPrimaryRelay" + NETWORK_DISCONNECT_LOCALPROBLEM_NETWORKCONFIG = 76, // "#GameUI_Disconnect_LocalProblem_NetworkConfig" + NETWORK_DISCONNECT_LOCALPROBLEM_OTHER = 77, // "#GameUI_Disconnect_LocalProblem_Other" + NETWORK_DISCONNECT_REMOTE_TIMEOUT = 79, // "#GameUI_Disconnect_RemoteProblem_Timeout" + NETWORK_DISCONNECT_REMOTE_TIMEOUT_CONNECTING = 80, // "#GameUI_Disconnect_RemoteProblem_TimeoutConnecting" + NETWORK_DISCONNECT_REMOTE_OTHER = 81, // "#GameUI_Disconnect_RemoteProblem_Other" + NETWORK_DISCONNECT_REMOTE_BADCRYPT = 82, // "#GameUI_Disconnect_RemoteProblem_BadCrypt" + NETWORK_DISCONNECT_REMOTE_CERTNOTTRUSTED = 83, // "#GameUI_Disconnect_RemoteProblem_BadCert" + NETWORK_DISCONNECT_UNUSUAL = 84, // "#GameUI_Disconnect_Unusual" + NETWORK_DISCONNECT_INTERNAL_ERROR = 85, // "#GameUI_Disconnect_InternalError" + NETWORK_DISCONNECT_REJECT_BADCHALLENGE = 128, // "#GameUI_ServerRejectBadChallenge" + NETWORK_DISCONNECT_REJECT_NOLOBBY = 129, // "#GameUI_ServerNoLobby" + NETWORK_DISCONNECT_REJECT_BACKGROUND_MAP = 130, // "#Valve_Reject_Background_Map" + NETWORK_DISCONNECT_REJECT_SINGLE_PLAYER = 131, // "#Valve_Reject_Single_Player" + NETWORK_DISCONNECT_REJECT_HIDDEN_GAME = 132, // "#Valve_Reject_Hidden_Game" + NETWORK_DISCONNECT_REJECT_LANRESTRICT = 133, // "#GameUI_ServerRejectLANRestrict" + NETWORK_DISCONNECT_REJECT_BADPASSWORD = 134, // "#GameUI_ServerRejectBadPassword" + NETWORK_DISCONNECT_REJECT_SERVERFULL = 135, // "#GameUI_ServerRejectServerFull" + NETWORK_DISCONNECT_REJECT_INVALIDRESERVATION = 136, // "#GameUI_ServerRejectInvalidReservation" + NETWORK_DISCONNECT_REJECT_FAILEDCHANNEL = 137, // "#GameUI_ServerRejectFailedChannel" + NETWORK_DISCONNECT_REJECT_CONNECT_FROM_LOBBY = 138, // "#Valve_Reject_Connect_From_Lobby" + NETWORK_DISCONNECT_REJECT_RESERVED_FOR_LOBBY = 139, // "#Valve_Reject_Reserved_For_Lobby" + NETWORK_DISCONNECT_REJECT_INVALIDKEYLENGTH = 140, // "#GameUI_ServerReject_InvalidKeyLength" + NETWORK_DISCONNECT_REJECT_OLDPROTOCOL = 141, // "#GameUI_ServerRejectOldProtocol" + NETWORK_DISCONNECT_REJECT_NEWPROTOCOL = 142, // "#GameUI_ServerRejectNewProtocol" + NETWORK_DISCONNECT_REJECT_INVALIDCONNECTION = 143, // "#GameUI_ServerRejectInvalidConnection" + NETWORK_DISCONNECT_REJECT_INVALIDCERTLEN = 144, // "#GameUI_ServerRejectInvalidCertLen" + NETWORK_DISCONNECT_REJECT_INVALIDSTEAMCERTLEN = 145, // "#GameUI_ServerRejectInvalidSteamCertLen" + NETWORK_DISCONNECT_REJECT_STEAM = 146, // "#GameUI_ServerRejectSteam" + NETWORK_DISCONNECT_REJECT_SERVERAUTHDISABLED = 147, // "#GameUI_ServerAuthDisabled" + NETWORK_DISCONNECT_REJECT_SERVERCDKEYAUTHINVALID = 148, // "#GameUI_ServerCDKeyAuthInvalid" + NETWORK_DISCONNECT_REJECT_BANNED = 149, // "#GameUI_ServerRejectBanned" + NETWORK_DISCONNECT_KICKED_TEAMKILLING = 150, // "#Player_DisconnectReason_TeamKilling" + NETWORK_DISCONNECT_KICKED_TK_START = 151, // "#Player_DisconnectReason_TK_Start" + NETWORK_DISCONNECT_KICKED_UNTRUSTEDACCOUNT = 152, // "#Player_DisconnectReason_UntrustedAccount" + NETWORK_DISCONNECT_KICKED_CONVICTEDACCOUNT = 153, // "#Player_DisconnectReason_ConvictedAccount" + NETWORK_DISCONNECT_KICKED_COMPETITIVECOOLDOWN = 154, // "#Player_DisconnectReason_CompetitiveCooldown" + NETWORK_DISCONNECT_KICKED_TEAMHURTING = 155, // "#Player_DisconnectReason_TeamHurting" + NETWORK_DISCONNECT_KICKED_HOSTAGEKILLING = 156, // "#Player_DisconnectReason_HostageKilling" + NETWORK_DISCONNECT_KICKED_VOTEDOFF = 157, // "#Player_DisconnectReason_VotedOff" + NETWORK_DISCONNECT_KICKED_IDLE = 158, // "#Player_DisconnectReason_Idle" + NETWORK_DISCONNECT_KICKED_SUICIDE = 159, // "#Player_DisconnectReason_Suicide" + NETWORK_DISCONNECT_KICKED_NOSTEAMLOGIN = 160, // "#Player_DisconnectReason_NoSteamLogin" + NETWORK_DISCONNECT_KICKED_NOSTEAMTICKET = 161, // "#Player_DisconnectReason_NoSteamTicket" +} +public static class NetworkDisconnectionReasonHelper +{ + public static string GetDisconnectReasonString(ENetworkDisconnectionReason reason) + { + switch (reason) + { + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_INVALID: + return "Invalid Reason."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_SHUTDOWN: + return "Server Shutdown."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_DISCONNECT_BY_USER: + return "Disconnected by user."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_DISCONNECT_BY_SERVER: + return "Disconnected from Server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LOST: + return "Connection lost."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_OVERFLOW: + return "Overflow error."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_BANNED: + return "STEAM UserID is banned."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_INUSE: + return "STEAM UserID is already in use on this server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_TICKET: + return "STEAM UserID ticket is invalid."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_LOGON: + return "No Steam logon."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_AUTHCANCELLED: + return "Steam authorization failed. Connection to server denied by Steam."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_AUTHALREADYUSED: + return "Steam authorization failed. Connection to server denied by Steam."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_AUTHINVALID: + return "Steam authorization failed. Connection to server denied by Steam."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_VACBANSTATE: + return "VAC banned from secure server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_LOGGED_IN_ELSEWHERE: + return "This Steam account is being used in another location."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_VAC_CHECK_TIMEDOUT: + return "Valve Anti-Cheat challenge timed out. Please ensure that you are not using any programs that may interfere with VAC, and confirm that Steam is correctly installed."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_DROPPED: + return "Steam authorization failed. You must be connected to Steam to make the initial connection to the game server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_OWNERSHIP: + return "This Steam account does not own this game. Please login to the correct Steam account."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_SERVERINFO_OVERFLOW: + return "Info data overflow."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_TICKMSG_OVERFLOW: + return "Server failed to write client tick message."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STRINGTABLEMSG_OVERFLOW: + return "Error writing string table update message."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_DELTAENTMSG_OVERFLOW: + return "Too many entities on the server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_TEMPENTMSG_OVERFLOW: + return "Too many temporary entities on the server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_SOUNDSMSG_OVERFLOW: + return "Error reliable buffer overflow."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_SNAPSHOTOVERFLOW: + return "Error reliable snapshot overflow."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_SNAPSHOTERROR: + return "Error sending snapshot."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_RELIABLEOVERFLOW: + return "Error reliable buffer overflow."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_BADDELTATICK: + return "Client delta ticks out of order."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_NOMORESPLITS: + return "No more split slots available."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_TIMEDOUT: + return "Unable to establish a connection with the gameserver."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_DISCONNECTED: + return "Disconnected. The console might have more details."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LEAVINGSPLIT: + return "Split slot disconnected."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_DIFFERENTCLASSTABLES: + return "Server uses different class tables."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_BADRELAYPASSWORD: + return "Bad relay password."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_BADSPECTATORPASSWORD: + return "Bad spectator password."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_HLTVRESTRICTED: + return "SourceTV server is restricted to local spectators (class C)."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_NOSPECTATORS: + return "Match does not allow spectators."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_HLTVUNAVAILABLE: + return "No SourceTV relay available."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_HLTVSTOP: + return "SourceTV stop."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED: + return "Kicked by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_BANADDED: + return "Added to banned list."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKBANADDED: + return "Kicked and banned."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_HLTVDIRECT: + return "SourceTV cannot connect to the game directly."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_PURESERVER_CLIENTEXTRA: + return "Pure server: client has loaded extra file(s)."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_PURESERVER_MISMATCH: + return "Pure server: client file does not match server.\n\nhttps://support.steampowered.com/kb_article.php?ref=8285-YOAZ-6049"; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_USERCMD: + return "Error in parsing user commands."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECTED_BY_GAME: + return "Connection rejected by game."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_MESSAGE_PARSE_ERROR: + return "Failed to parse message."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_INVALID_MESSAGE_ERROR: + return "Message is invalid."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_BAD_SERVER_PASSWORD: + return "Bad password rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_DIRECT_CONNECT_RESERVATION: + return "Reservation cannot connect to the game directly."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_CONNECTION_FAILURE: + return "Connection failure."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_NO_PEER_GROUP_HANDLERS: + return "Connection peer group missing."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_RECONNECTION: + return "Reconnecting"; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LOOPSHUTDOWN: + return "Loop shutdown."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LOOPDEACTIVATE: + return "Loop deactivated."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_HOST_ENDGAME: + return "Game ended by host."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LOOP_LEVELLOAD_ACTIVATE: + return "Loop level loading activated."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_CREATE_SERVER_FAILED: + return "Failed to create server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_EXITING: + return "Shutting down game."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REQUEST_HOSTSTATE_IDLE: + return "Host is idle."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REQUEST_HOSTSTATE_HLTVRELAY: + return "Host is a relay."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_CLIENT_CONSISTENCY_FAIL: + return "Client consistency check failed."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_CLIENT_UNABLE_TO_CRC_MAP: + return "Client map verification failed."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_CLIENT_NO_MAP: + return "Required map is missing on your client."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_CLIENT_DIFFERENT_MAP: + return "Your map version differs from the server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_SERVER_REQUIRES_STEAM: + return "Client and server must be connected to Steam."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_DENY_MISC: + return "Connection to server denied by Steam."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_STEAM_DENY_BAD_ANTI_CHEAT: + return "Connection to server denied by VAC."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_SERVER_SHUTDOWN: + return "Disconnected from gameserver. The gameserver is shutting down."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REPLAY_INCOMPATIBLE: + return "Replay is not compatible."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_CONNECT_REQUEST_TIMEDOUT: + return "Unable to establish a connection with the gameserver."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_SERVER_INCOMPATIBLE: + return "Server version is not compatible."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LOCALPROBLEM_MANYRELAYS: + return "Lost connection, even after trying several relays in different geographic locations. The most likely cause is a problem with your Internet connection."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LOCALPROBLEM_HOSTEDSERVERPRIMARYRELAY: + return "Gameserver has lost connectivity with the primary relay the client was using."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LOCALPROBLEM_NETWORKCONFIG: + return "Check your Internet connection. Unable to download the network configuration from CDN."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_LOCALPROBLEM_OTHER: + return "Disconnected. It looks like there may be a problem with your Internet connection."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REMOTE_TIMEOUT: + return "The game stopped receiving communications from the remote host."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REMOTE_TIMEOUT_CONNECTING: + return "After several attempts to connect, the server did not respond."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REMOTE_OTHER: + return "Problem communicating with the remote host."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REMOTE_BADCRYPT: + return "The remote host presented a bad certificate or is misconfigured."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REMOTE_CERTNOTTRUSTED: + return "The remote host presented a certificate that could not be used for authentication."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_UNUSUAL: + return "Disconnected. The console might have more details."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_INTERNAL_ERROR: + return "Disconnected due to an internal error. The console might have more details."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_BADCHALLENGE: + return "Bad challenge packet rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_NOLOBBY: + return "Server is not hosting a game lobby."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_BACKGROUND_MAP: + return "Server is running a background map."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_SINGLE_PLAYER: + return "Server is running a single player game."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_HIDDEN_GAME: + return "Server is running a hidden game."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_LANRESTRICT: + return "Server is restricted to LAN games only."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_BADPASSWORD: + return "Bad password rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_SERVERFULL: + return "Server is full."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_INVALIDRESERVATION: + return "Server reservation is invalid."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_FAILEDCHANNEL: + return "Bad network channel rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_CONNECT_FROM_LOBBY: + return "Server requires clients to connect from a game lobby."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_RESERVED_FOR_LOBBY: + return "Server is reserved for a game lobby."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_INVALIDKEYLENGTH: + return "Invalid key rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_OLDPROTOCOL: + return "Your client is out of date."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_NEWPROTOCOL: + return "Server is out of date."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_INVALIDCONNECTION: + return "Invalid connection rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_INVALIDCERTLEN: + return "Invalid client certificate rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_INVALIDSTEAMCERTLEN: + return "Invalid Steam certificate rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_STEAM: + return "Steam rejected your connection to server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_SERVERAUTHDISABLED: + return "Server authentication is disabled."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_SERVERCDKEYAUTHINVALID: + return "CD key authentication rejected by server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_BANNED: + return "Your client is not allowed to join this server."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_TEAMKILLING: + return "For killing too many teammates."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_TK_START: + return "For killing a teammate at round start."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_UNTRUSTEDACCOUNT: + return "Account is Untrusted."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_CONVICTEDACCOUNT: + return "Account is Convicted."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_COMPETITIVECOOLDOWN: + return "Player has competitive matchmaking cooldown."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_TEAMHURTING: + return "For doing too much team damage."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_HOSTAGEKILLING: + return "For killing too many hostages."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_VOTEDOFF: + return "Voted off."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_IDLE: + return "Player idle."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_SUICIDE: + return "For suiciding too many times."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_NOSTEAMLOGIN: + return "No user logon."; + case ENetworkDisconnectionReason.NETWORK_DISCONNECT_KICKED_NOSTEAMTICKET: + return "Game authentication failed."; + default: + return $"Unknown Disconnect Reason {(int)reason}"; + } + } +} \ No newline at end of file diff --git a/lang/en.json b/lang/en.json index 635f044..580b73b 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,7 +1,17 @@ { - "InGame_Message_Connect": "{green}Gold KingZ {grey}| {purple}{2} {lime}Connected [{9} - {10}]", - "InGame_Message_Disconnect": "{green}Gold KingZ {grey}| {purple}{2} {red}Disconnected [{11}]", + "chat.message.connect": "{green}Gold KingZ {grey}| {purple}{2} {lime}Connected [{9} - {10}]", + "chat.message.disconnect": "{green}Gold KingZ {grey}| {purple}{2} {red}Disconnected [{11}]", - "InGame_Command_Enabled": "{green}Gold KingZ {grey}| Connect/Disconnect Sounds Has Been {lime}Enabled", - "InGame_Command_Disabled": "{green}Gold KingZ {grey}| Connect/Disconnect Sounds Has Been {darkred}Disabled" + "console.message.connect": "Gold KingZ | {2} Connected [{9} - {10}]", + "console.message.disconnect": "Gold KingZ | {2} Disconnected [{9} - {10}] [{11}]", + + "command.not.allowed": "{green}Gold KingZ {grey}| {darkred}Toggle Connect/Disconnect Sounds For Vips", + "command.sound.enabled": "{green}Gold KingZ {grey}| Connect/Disconnect Sounds Has Been {lime}Enabled", + "command.sound.disabled": "{green}Gold KingZ {grey}| Connect/Disconnect Sounds Has Been {darkred}Disabled", + + "invalid.steamid": "InvalidSteamID", + "invalid.ipadress": "InValidIpAddress", + "unknown.short.country": "U/C", + "unknown.long.country": "Unknown Country", + "unknown.city": "Unknown City" } \ No newline at end of file