Exemple #1
0
        void OpenTheGatesOfHell(Player player, string cmd, string[] input)
        {
            if (!player.HasPermission("admin") && !player.HasPermission("mod"))
            {
                PrintToChat(player, "You have no permission to open the gates of Hell!"); return;
            }
            string z = "villager";
            string w = "werewolf";

            if (input.IsNullOrEmpty())
            {
                CreatureAmount = GetConfig("AMOUNT of creatures to spawn", 5); PrintToChat(player, "you have not set an argument for the number of spawned creatures, using default value of " + CreatureAmount.ToString());
            }
            else
            {
                CreatureAmount = int.Parse(string.Concat(input));
            }

            if (CreatureAmount > 20)
            {
                CreatureAmount = 20; PrintToChat(player, "You cannot spawn more than 20 Villagers per Player with GatesOfHell (Server Lag)!");
            }
            if (Werewolves && Zombies)
            {
                timer.Repeat(3f, (CreatureAmount / 2), () =>
                {
                    foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                    {
                        Vector3 RandomPosition          = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                        Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                        SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, z);
                    }
                });
                timer.Repeat(3f, (CreatureAmount / 2), () =>
                {
                    foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                    {
                        Vector3 RandomPosition          = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                        Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                        SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, w);
                    }
                });
            }
            else if (Zombies)
            {
                timer.Repeat(3f, (CreatureAmount), () =>
                {
                    foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                    {
                        Vector3 RandomPosition          = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                        Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                        SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, z);
                    }
                });
            }
            else if (Werewolves)
            {
                timer.Repeat(3f, (CreatureAmount / 2), () =>
                {
                    foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                    {
                        Vector3 RandomPosition          = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                        Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                        SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, w);
                    }
                });
            }
            else if (!Werewolves && !Zombies)
            {
                PrintToChat(player, "You need to activate at least one creature in the configfile to spawn it! reload the plugin afterwards."); return;
            }
        }
        void OpenTheGatesOfHell(Player player, string cmd, string[] input)
        {
            if (!player.HasPermission("admin") && !player.HasPermission("mod"))
            {
                PrintToChat(player, string.Format(GetMessage("NoAdmin", player.Id.ToString()))); return;
            }
            string z = "villager";
            string w = "werewolf";

            if (input.IsNullOrEmpty())
            {
                CreatureAmount = GetConfig("AMOUNT of creatures to spawn", 5); PrintToChat(player, string.Format(GetMessage("NoArgument", player.Id.ToString())), CreatureAmount.ToString());
            }
            else
            {
                CreatureAmount = int.Parse(string.Concat(input));
            }

            if (CreatureAmount > 20)
            {
                CreatureAmount = 20; PrintToChat(player, string.Format(GetMessage("TooMany", player.Id.ToString())));
            }
            if (Werewolves && Zombies)
            {
                timer.Repeat(3f, (CreatureAmount / 2), () =>
                {
                    foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                    {
                        Vector3 RandomPosition          = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                        Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                        SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, z);
                    }
                });
                timer.Repeat(3f, (CreatureAmount / 2), () =>
                {
                    foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                    {
                        Vector3 RandomPosition          = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                        Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                        SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, w);
                    }
                });
            }
            else if (Zombies)
            {
                timer.Repeat(3f, (CreatureAmount), () =>
                {
                    foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                    {
                        Vector3 RandomPosition          = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                        Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                        SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, z);
                    }
                });
            }
            else if (Werewolves)
            {
                timer.Repeat(3f, (CreatureAmount / 2), () =>
                {
                    foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                    {
                        Vector3 RandomPosition          = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                        Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                        SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, w);
                    }
                });
            }
            else if (!Werewolves && !Zombies)
            {
                PrintToChat(player, string.Format(GetMessage("WrongConfig", player.Id.ToString()))); return;
            }
        }