Example #1
0
 protected override void Load()
 {
     Logger.Log("Plugin loaded Correctly. Fixed by educatalan02 - Support: " + Discord);
     Logger.Log("Version: " + Assembly.GetName().Version);
     Plugin.Instance             = this;
     U.Events.OnPlayerConnected += OnConnected;
 }
Example #2
0
        internal DatabaseManager()
        {
            Path = Directory.GetCurrentDirectory() + "\\Databases\\CyTic.SkinChanger.db";
            bool flag = !Directory.Exists(Directory.GetCurrentDirectory() + "\\Databases");

            if (flag)
            {
                Directory.CreateDirectory(Directory.GetCurrentDirectory() + "\\Databases");
            }
            LiteDatabase liteDatabase = new LiteDatabase(Path, null);

            skinsCollection = liteDatabase.GetCollection <SkinCollection>("PlayerSkins");
            Logger.Log("LiteDB loaded.", ConsoleColor.Green);
        }
Example #3
0
 protected override void Load()
 {
     UnturnedPlayerEvents.OnPlayerChatted += Events_PlayerChatted;
     Logger.Log("Successfully loaded CGames v1.0");
     if (Configuration.Instance.Use_Feex_Points == true)
     {
         if (IsDependencyLoaded("FeexRanks"))
         {
             Logger.Log("CGames successfully loaded with FeexRanks", ConsoleColor.Magenta);
         }
         else
         {
             Logger.LogWarning("You don't have FeexRanks enabled to use the point system!");
         }
     }
 }
Example #4
0
        private void Events_OnPlayerConnected(UnturnedPlayer player)
        {
            string IP = player.IP;

            if (Configuration.Instance.UseIPHUB)
            {
                using (var webClient = new WebClient())
                {
                    webClient.Headers.Add("X-Key: " + Configuration.Instance.IPHUBAPIKey);
                    try
                    {
                        var     response = webClient.DownloadString("http://v2.api.iphub.info/ip/" + IP);
                        JObject parsed   = JObject.Parse(response);
                        int     Block    = parsed.GetValue("block").Value <int>();
                        switch (Block)
                        {
                        case 0:
                            Logger.Log(player.CharacterName + " has safe IP.", ConsoleColor.Green);
                            break;

                        case 1:
                        case 2:
                            Logger.Log(player.CharacterName + " has Proxy/VPN. Terminating connection...", ConsoleColor.Red);
                            player.Kick("Using VPN.");
                            return;
                        }
                    }
                    catch (WebException ex)
                    {
                        Logger.LogError("Error while using IPHUB: " + ex.Message);
                    }
                }
            }
            if (Database.IsBanned(player, out string reason))
            {
                Logger.Log(player.CharacterName + " is banned. Terminating connection...");
                player.Kick("General ban: " + reason);
            }
            else if (Database.IsIpBanned(player, out string reasona))
            {
                Logger.Log(player.CharacterName + " is IP banned. Terminating connection...");
                player.Kick("General IPban: " + reasona);
            }
        }
Example #5
0
        protected override void Load()
        {
            instance = this;

            Logger.Log("Loading MaxskillsButWithoutOverkill. Skills that will not be maxskilled:\n");

            foreach (string s in Configuration.Instance.ignoreTheseSkills)
            {
                Logger.Log("\t" + s + "\n");
            }

            skills = typeof(UnturnedSkill).GetFields(BindingFlags.Static | BindingFlags.Public);

            skillCtor = typeof(UnturnedSkill).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null,
                                                             new Type[] { typeof(byte), typeof(byte) }, null);

            if (Configuration.Instance.enableMaxskillsByDefault)
            {
                UnturnedPlayerEvents.OnPlayerRevive += OnRevive;
                U.Events.OnPlayerConnected          += OnConnect;
            }
        }
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer unturnedPlayer = (UnturnedPlayer)caller;

            if (unturnedPlayer.Features.VanishMode)
            {
                unturnedPlayer.Features.VanishMode = false;
                Logger.Log(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("vanish_off_console"));
                UnturnedChat.Say(caller, AdvancedGodVanish.Instance.Translate("Vanish_off_Private"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOffPrivateColor, Color.red));
                if (AdvancedGodVanish.Instance.Configuration.Instance.AnnouncerEnabled)
                {
                    UnturnedChat.Say(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("Vanish_off_Public"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOffPublicColor, Color.red));
                    if (AdvancedGodVanish.Instance.Configuration.Instance.LoggingEnabled)
                    {
                        using (StreamWriter streamWriter = File.AppendText(directory + "/GodVanishLog.txt"))
                        {
                            streamWriter.WriteLine("[Vanish]player.CharacterName[" + unturnedPlayer.DisplayName + "]" + AdvancedGodVanish.Instance.Translate("vanish_off_console") + " Steam64ID: " + unturnedPlayer.CSteamID + streamWriter.NewLine);
                            streamWriter.Close();
                        }
                    }
                }
                return;
            }
            unturnedPlayer.Features.VanishMode = true;
            Logger.LogWarning(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("vanish_on_console"));
            if (AdvancedGodVanish.Instance.Configuration.Instance.AnnouncerEnabled)
            {
                UnturnedChat.Say(unturnedPlayer.CharacterName + AdvancedGodVanish.Instance.Translate("Vanish_on_Public"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOnPublicColor, Color.red));
                UnturnedChat.Say(caller, AdvancedGodVanish.Instance.Translate("Vanish_on_Private"), UnturnedChat.GetColorFromName(AdvancedGodVanish.Instance.Configuration.Instance.VanishOnPrivateColor, Color.red));
                if (AdvancedGodVanish.Instance.Configuration.Instance.LoggingEnabled)
                {
                    using (StreamWriter streamWriter2 = File.AppendText(directory + "/GodVanishLog.txt"))
                    {
                        streamWriter2.WriteLine("[Vanish]" + unturnedPlayer.CharacterName + "[" + unturnedPlayer.DisplayName + "]" + AdvancedGodVanish.Instance.Translate("vanish_on_console") + " Steam64ID: " + unturnedPlayer.CSteamID + streamWriter2.NewLine);
                        streamWriter2.Close();
                    }
                }
            }
        }
Example #7
0
 // logging for buys.
 private void Instance_OnShopBuy(decimal curBallance, UnturnedPlayer player, ushort numItems, ShopObject sObject, ItemType type, decimal newCost, decimal totalCost, short totalItems)
 {
     Logger.Log(string.Format("Player {0} [{1}] ({2}) at location: {3}, has bought {4} items, with type: {5}, with id: {6}({7}), for {8} credits. Players balance is now {9} credits.",
                              player.CharacterName, player.SteamName, player.CSteamID, player.IsInVehicle ? player.CurrentVehicle.transform.position.ToString() : player.Position.ToString(), totalItems, type.ToString(), sObject.ItemName, sObject.ItemID, Math.Round(totalCost, 4), Math.Round(curBallance, 2)));
 }