示例#1
0
        void HandleStart(Player p, ZSGame game, string[] args)
        {
            if (!CheckExtraPerm(p, 1))
            {
                return;
            }
            if (game.Running)
            {
                Player.Message(p, "There is already a Zombie Survival game currently in progress."); return;
            }
            Level lvl = Player.IsSuper(p) ? null : p.level;

            if (args.Length == 2)
            {
                int rounds = 1;
                if (!CommandParser.GetInt(p, args[1], "Rounds", ref rounds, 0))
                {
                    return;
                }

                ZombieGameStatus status = rounds == 0 ?
                                          ZombieGameStatus.InfiniteRounds : ZombieGameStatus.VariableRounds;
                game.Start(status, lvl, rounds);
            }
            else
            {
                game.Start(ZombieGameStatus.SingleRound, lvl, 0);
            }
        }
示例#2
0
        public void Start(ZombieGameStatus status, int amount)
        {
            Status             = status;
            RoundInProgress    = false;
            initialChangeLevel = false;
            MaxRounds          = amount + 1;
            RoundsDone         = 0;

            Thread t = new Thread(MainLoop);

            t.Name = "MCG_ZombieGame";
            t.Start();
        }
示例#3
0
        public void Start(ZombieGameStatus status, Level level, int rounds)
        {
            Status          = status;
            RoundInProgress = false;
            MaxRounds       = rounds + 1;
            RoundsDone      = 0;
            if (!SetStartLevel(level))
            {
                return;
            }

            Thread t = new Thread(MainLoop);

            t.Name = "MCG_ZombieGame";
            t.Start();
        }
示例#4
0
 static void HandleStart(Player p, string message, string[] args)
 {
     if (Server.zombie.Running)
     {
         Player.SendMessage(p, "There is already a Zombie Survival game currently in progress."); return;
     }
     if (args.Length == 2)
     {
         int rounds = 1;
         if (!int.TryParse(args[1], out rounds))
         {
             Player.SendMessage(p, "You need to specify a valid option!"); return;
         }
         ZombieGameStatus status = rounds == 0 ?
                                   ZombieGameStatus.InfiniteRounds : ZombieGameStatus.VariableRounds;
         Server.zombie.Start(status, rounds);
     }
     else
     {
         Server.zombie.Start(ZombieGameStatus.SingleRound, 0);
     }
 }
示例#5
0
        public void Start(ZombieGameStatus status, Level level, int rounds)
        {
            Status          = status;
            RoundInProgress = false;
            MaxRounds       = rounds + 1;
            RoundsDone      = 0;
            if (!SetStartLevel(level))
            {
                return;
            }

            HookStats();
            if (plugin.Game == null)
            {
                plugin.Game = this; plugin.Load(false);
            }

            Thread t = new Thread(MainLoop);

            t.Name = "MCG_ZombieGame";
            t.Start();
        }
示例#6
0
        public void End()
        {
            Status          = ZombieGameStatus.NotStarted;
            MaxRounds       = 0;
            RoundInProgress = false;
            RoundStart      = DateTime.MinValue;
            RoundEnd        = DateTime.MinValue;
            if (plugin.Game != null)
            {
                plugin.Game = null; plugin.Unload(false);
            }

            Player[] online = PlayerInfo.Online.Items;
            Alive.Clear();
            Infected.Clear();

            Bounties.Clear();
            Picker.Clear();

            foreach (Player pl in online)
            {
                pl.Game.Referee  = false;
                pl.Game.RatedMap = false;
                pl.Game.ResetZombieState();
                ResetInvisibility(pl);
                pl.SetPrefix();

                if (pl.level == null || !pl.level.name.CaselessEq(MapName))
                {
                    continue;
                }
                HUD.Reset(pl);
            }

            LastLevelName = "";
            MapName       = "";
            Map           = null;
            UnhookStats();
        }