//During Game Main Methods public void Start() { GameStatus = TntWarsGameStatus.AboutToStart; //Checking Backups & physics etc. { BackupNumber = lvl.Backup(true); if (BackupNumber <= 0) { SendAllPlayersMessage(c.red + "Backing up Level for TNT Wars failed, Stopping game"); Player.GlobalMessageOps(c.red + "Backing up Level for TNT Wars failed, Stopping game"); GameStatus = TntWarsGameStatus.Finished; return; } Server.s.Log("Backed up " + lvl.name + " (" + BackupNumber.ToString() + ") for TNT Wars"); } //Map stuff lvl.setPhysics(3); lvl.permissionbuild = Group.Find(Server.defaultRank).Permission; lvl.permissionvisit = Group.Find(Server.defaultRank).Permission; lvl.Killer = true; //Seting Up Some Player stuff { foreach (player p in Players) { p.p.PlayingTntWars = true; p.p.CurrentAmountOfTnt = 0; p.p.CurrentTntGameNumber = GameNumber; if (GameDifficulty == TntWarsDifficulty.Easy || GameDifficulty == TntWarsDifficulty.Normal) p.p.TntWarsHealth = 2; else p.p.TntWarsHealth = 1; p.p.HarmedBy = null; if (GracePeriod) { p.p.canBuild = false; } if (p.spec) { p.p.canBuild = false; Player.SendMessage(p.p, "TNT Wars: Disabled building because you are a spectator!"); } p.p.TntWarsKillStreak = 0; p.p.TntWarsScoreMultiplier = 1f; p.p.TNTWarsLastKillStreakAnnounced = 0; SetTitlesAndColor(p); } if (GracePeriod) { SendAllPlayersMessage("TNT Wars: Disabled building during Grace Period!"); } } //Spawn them (And if needed, move them to the correct level!) { foreach (player p in Players.Where(p => p.p.level != lvl)) { Command.all.Find("goto").Use(p.p, lvl.name); while (p.p.Loading) { Thread.Sleep(250); } p.p.inTNTwarsMap = true; } if (GameMode == TntWarsGameMode.TDM) { Command.all.Find("reveal").Use(null, "all " + lvl.name); }//So peoples names apear above their heads in the right color! foreach (player p in Players) { Command.all.Find("spawn").Use(p.p, ""); //This has to be after reveal so that they spawn in the correct place!! Thread.Sleep(250); } } //Announcing Etc. string Gamemode = "Free For All"; if (GameMode == TntWarsGameMode.TDM) Gamemode = "Team Deathmatch"; string Difficulty = "Normal"; string HitsToDie = "2"; string explosiontime = "medium"; string explosionsize = "normal"; switch (GameDifficulty) { case TntWarsDifficulty.Easy: Difficulty = "Easy"; explosiontime = "long"; break; case TntWarsDifficulty.Normal: Difficulty = "Normal"; break; case TntWarsDifficulty.Hard: HitsToDie = "1"; Difficulty = "Hard"; break; case TntWarsDifficulty.Extreme: HitsToDie = "1"; explosiontime = "short"; explosionsize = "big"; Difficulty = "Extreme"; break; } string teamkillling = "Disabled"; if (TeamKills) teamkillling = "Enabled"; Player.GlobalMessage(c.red + "TNT Wars " + Server.DefaultColor + "on '" + lvl.name + "' has started " + c.teal + Gamemode + Server.DefaultColor + " with a difficulty of " + c.teal + Difficulty + Server.DefaultColor + " (" + c.teal + HitsToDie + Server.DefaultColor + " hits to die, a " + c.teal + explosiontime + Server.DefaultColor + " explosion delay and with a " + c.teal + explosionsize + Server.DefaultColor + " explosion size)" + ", team killing is " + c.teal + teamkillling + Server.DefaultColor + " and you can place " + c.teal + TntPerPlayerAtATime.ToString() + Server.DefaultColor + " TNT at a time and there is a score limit of " + c.teal + ScoreLimit.ToString() + Server.DefaultColor + "!!"); if (GameMode == TntWarsGameMode.TDM) SendAllPlayersMessage("TNT Wars: Start your message with ':' to send it as a team chat!"); //GracePeriod if (GracePeriod) //Check This Grace Stuff { GameStatus = TntWarsGameStatus.GracePeriod; int GracePeriodSecsRemaining = GracePeriodSecs; SendAllPlayersMessage("TNT Wars: Grace Period of " + c.lime + GracePeriodSecsRemaining.ToString() + Server.DefaultColor + " seconds"); while (GracePeriodSecsRemaining > 0) { switch (GracePeriodSecsRemaining) { case 300: SendAllPlayersMessage("TNT Wars: " + c.teal + "5" + Server.DefaultColor + " minutes remaining!"); break; case 240: SendAllPlayersMessage("TNT Wars: " + c.teal + "4" + Server.DefaultColor + " minutes remaining!"); break; case 180: SendAllPlayersMessage("TNT Wars: " + c.teal + "3" + Server.DefaultColor + " minutes remaining!"); break; case 120: SendAllPlayersMessage("TNT Wars: " + c.teal + "2" + Server.DefaultColor + " minutes remaining!"); break; case 90: SendAllPlayersMessage("TNT Wars: " + c.teal + "1" + Server.DefaultColor + " minute and " + c.teal + "30" + Server.DefaultColor + " seconds remaining!"); break; case 60: SendAllPlayersMessage("TNT Wars: " + c.teal + "1" + Server.DefaultColor + " minute remaining!"); break; case 45: SendAllPlayersMessage("TNT Wars: " + c.teal + "45" + Server.DefaultColor + " seconds remaining!"); break; case 30: SendAllPlayersMessage("TNT Wars: " + c.teal + "30" + Server.DefaultColor + " seconds remaining!"); break; case 15: SendAllPlayersMessage("TNT Wars: " + c.teal + "15" + Server.DefaultColor + " seconds remaining!"); break; case 10: SendAllPlayersMessage("TNT Wars: " + c.teal + "10" + Server.DefaultColor + " seconds remaining!"); break; case 9: SendAllPlayersMessage("TNT Wars: " + c.teal + "9" + Server.DefaultColor + " seconds remaining!"); break; case 8: SendAllPlayersMessage("TNT Wars: " + c.teal + "8" + Server.DefaultColor + " seconds remaining!"); break; case 7: SendAllPlayersMessage("TNT Wars: " + c.teal + "7" + Server.DefaultColor + " seconds remaining!"); break; case 6: SendAllPlayersMessage("TNT Wars: " + c.teal + "6" + Server.DefaultColor + " seconds remaining!"); break; case 5: SendAllPlayersMessage("TNT Wars: " + c.teal + "5" + Server.DefaultColor + " seconds remaining!"); break; case 4: SendAllPlayersMessage("TNT Wars: " + c.teal + "4" + Server.DefaultColor + " seconds remaining!"); break; case 3: SendAllPlayersMessage("TNT Wars: " + c.teal + "3" + Server.DefaultColor + " seconds remaining!"); break; case 2: SendAllPlayersMessage("TNT Wars: " + c.teal + "2" + Server.DefaultColor + " seconds remaining!"); break; case 1: SendAllPlayersMessage("TNT Wars: " + c.teal + "1" + Server.DefaultColor + " second remaining!"); break; } Thread.Sleep(1000); GracePeriodSecsRemaining -= 1; } SendAllPlayersMessage("TNT Wars: Grace Period is over!!!!!"); SendAllPlayersMessage("TNT Wars: You may now place " + c.red + "TNT"); } SendAllPlayersMessage("TNT Wars: " + c.white + "The Game Has Started!!!!!"); GameStatus = TntWarsGameStatus.InProgress; foreach (player p in Players) { if (p.spec == false) { p.p.canBuild = true; } } if (GracePeriod) { SendAllPlayersMessage("TNT Wars: You can now build!!"); } //MainLoop while (!Finished()) { int i = 1; //For making a top 5 (or whatever) players announcement every 3 loops (if TDM) Thread.Sleep(3 * 1000); if (Finished()) break; //--\\ Thread.Sleep(3 * 1000); if (Finished()) break; //----\ Thread.Sleep(3 * 1000); if (Finished()) break; //-----> So that if it finsihes, we don't have to wait like 10 secs for the announcement!! Thread.Sleep(3 * 1000); if (Finished()) break; //----/ Thread.Sleep(3 * 1000); if (Finished()) break; //--// if (GameMode == TntWarsGameMode.TDM) { if (i < 3) { SendAllPlayersScore(true, true); } if (i >= 3) { SendAllPlayersScore(true, true, true); i = 0; } i++; } else if (GameMode == TntWarsGameMode.FFA) { SendAllPlayersScore(false, true, true); } } END(); }
public void END() { GameStatus = TntWarsGameStatus.Finished; //let them build and spawn them and change playingtntwars to false foreach (player p in Players) { p.p.canBuild = true; Command.all.Find("spawn").Use(p.p, ""); p.p.PlayingTntWars = false; } //Message about winners etc. if (Players.Count <= 1) { Player.GlobalMessage(c.red + "TNT Wars " + Server.DefaultColor + "has ended because there are no longer enough players!"); } else { Player.GlobalMessage(c.red + "TNT Wars" + Server.DefaultColor + " has ended!!"); } if (GameMode == TntWarsGameMode.TDM) { if (RedScore >= BlueScore) { Player.GlobalMessage("TNT Wars: Team " + c.red + "Red " + Server.DefaultColor + "won " + c.red + "TNT Wars " + Server.DefaultColor + "by " + (RedScore - BlueScore).ToString() + " points!"); } if (BlueScore >= RedScore) { Player.GlobalMessage("TNT Wars: Team " + c.blue + "Blue " + Server.DefaultColor + "won " + c.red + "TNT Wars " + Server.DefaultColor + "by " + (BlueScore - RedScore).ToString() + " points!"); } try { foreach (player p in Players) { if (!p.spec) { Player.SendMessage(p.p, "TNT Wars: You Scored " + p.Score.ToString() + " points"); } } } catch { } SendAllPlayersMessage("TNT Wars: Top Scores:"); SendAllPlayersScore(false, false, true); } if (GameMode == TntWarsGameMode.FFA) { var pls = from pla in Players orderby pla.Score descending select pla; //LINQ FTW int count = 1; foreach (var pl in pls) { if (count == 1) { Player.GlobalMessage(c.red + "TNT Wars " + Server.DefaultColor + "1st Place: " + pl.p.color + pl.p.name + Server.DefaultColor + " with a score of " + pl.p.color + pl.Score); } else if (count == 2) { SendAllPlayersMessage(c.red + "TNT Wars " + Server.DefaultColor + "2nd Place: " + pl.p.color + pl.p.name + Server.DefaultColor + " with a score of " + pl.p.color + pl.Score); } else if (count == 3) { SendAllPlayersMessage(c.red + "TNT Wars " + Server.DefaultColor + "3rd Place: " + pl.p.color + pl.p.name + Server.DefaultColor + " with a score of " + pl.p.color + pl.Score); } else if (count >= 4) { SendAllPlayersMessage(c.red + "TNT Wars " + Server.DefaultColor + count.ToString() + "th Place: " + pl.p.color + pl.p.name + Server.DefaultColor + " with a score of " + pl.p.color + pl.Score); } if (count >= PlayingPlayers()) { break; } count++; Thread.Sleep(750); //Maybe, not sure (was 500) } } //Reset map Command.all.Find("restore").Use(null, BackupNumber.ToString() + " " + lvl.name); if (lvl.overload == 2501) { lvl.overload = 1500; Server.s.Log("TNT Wars: Set level physics overload back to 1500"); } }
public void END() { GameStatus = TntWarsGameStatus.Finished; //let them build and spawn them and change playingtntwars to false foreach (player p in Players) { p.p.canBuild = true; Command.all.Find("spawn").Use(p.p, ""); p.p.PlayingTntWars = false; } //Message about winners etc. if (Players.Count <= 1) { Player.GlobalMessage(Colors.red + "TNT Wars " + Server.DefaultColor + "has ended because there are no longer enough players!"); } else { Player.GlobalMessage(Colors.red + "TNT Wars" + Server.DefaultColor + " has ended!!"); } if (GameMode == TntWarsGameMode.TDM) { if (RedScore >= BlueScore) { Player.GlobalMessage("TNT Wars: Team " + Colors.red + "Red " + Server.DefaultColor + "won " + Colors.red + "TNT Wars " + Server.DefaultColor + "by " + (RedScore - BlueScore).ToString() + " points!"); } if (BlueScore >= RedScore) { Player.GlobalMessage("TNT Wars: Team " + Colors.blue + "Blue " + Server.DefaultColor + "won " + Colors.red + "TNT Wars " + Server.DefaultColor + "by " + (BlueScore - RedScore).ToString() + " points!"); } try { foreach (player p in Players) { if (!p.spec) { Player.SendMessage(p.p, "TNT Wars: You Scored " + p.Score.ToString() + " points"); } } } catch { } SendAllPlayersMessage("TNT Wars: Top Scores:"); SendAllPlayersScore(false, false, true); } if (GameMode == TntWarsGameMode.FFA) { var pls = from pla in Players orderby pla.Score descending select pla; //LINQ FTW int count = 1; foreach (var pl in pls) { if (count == 1) { Player.GlobalMessage(Colors.red + "TNT Wars " + Server.DefaultColor + "1st Place: " + pl.p.color + pl.p.name + Server.DefaultColor + " with a score of " + pl.p.color + pl.Score); } else if (count == 2) { SendAllPlayersMessage(Colors.red + "TNT Wars " + Server.DefaultColor + "2nd Place: " + pl.p.color + pl.p.name + Server.DefaultColor + " with a score of " + pl.p.color + pl.Score); } else if (count == 3) { SendAllPlayersMessage(Colors.red + "TNT Wars " + Server.DefaultColor + "3rd Place: " + pl.p.color + pl.p.name + Server.DefaultColor + " with a score of " + pl.p.color + pl.Score); } else if (count >= 4) { SendAllPlayersMessage(Colors.red + "TNT Wars " + Server.DefaultColor + count.ToString() + "th Place: " + pl.p.color + pl.p.name + Server.DefaultColor + " with a score of " + pl.p.color + pl.Score); } if (count >= PlayingPlayers()) { break; } count++; Thread.Sleep(750); //Maybe, not sure (was 500) } } //Reset map Command.all.Find("restore").Use(null, BackupNumber.ToString() + " " + lvl.name); if (lvl.overload == 2501) { lvl.overload = 1500; Server.s.Log("TNT Wars: Set level physics overload back to 1500"); } }
//During Game Main Methods public void Start() { GameStatus = TntWarsGameStatus.AboutToStart; //Checking Backups & physics etc. { BackupNumber = lvl.Backup(true); if (BackupNumber <= 0) { SendAllPlayersMessage(Colors.red + "Backing up Level for TNT Wars failed, Stopping game"); Chat.GlobalMessageOps(Colors.red + "Backing up Level for TNT Wars failed, Stopping game"); GameStatus = TntWarsGameStatus.Finished; return; } Server.s.Log("Backed up " + lvl.name + " (" + BackupNumber.ToString() + ") for TNT Wars"); } //Map stuff lvl.setPhysics(3); lvl.permissionbuild = Group.Find(Server.defaultRank).Permission; lvl.permissionvisit = Group.Find(Server.defaultRank).Permission; lvl.Killer = true; //Seting Up Some Player stuff { foreach (player p in Players) { p.p.PlayingTntWars = true; p.p.CurrentAmountOfTnt = 0; p.p.CurrentTntGameNumber = GameNumber; if (GameDifficulty == TntWarsDifficulty.Easy || GameDifficulty == TntWarsDifficulty.Normal) { p.p.TntWarsHealth = 2; } else { p.p.TntWarsHealth = 1; } p.p.HarmedBy = null; if (GracePeriod) { p.p.canBuild = false; } if (p.spec) { p.p.canBuild = false; Player.SendMessage(p.p, "TNT Wars: Disabled building because you are a spectator!"); } p.p.TntWarsKillStreak = 0; p.p.TntWarsScoreMultiplier = 1f; p.p.TNTWarsLastKillStreakAnnounced = 0; SetTitlesAndColor(p); } if (GracePeriod) { SendAllPlayersMessage("TNT Wars: Disabled building during Grace Period!"); } } //Spawn them (And if needed, move them to the correct level!) { foreach (player p in Players.Where(p => p.p.level != lvl)) { Command.all.Find("goto").Use(p.p, lvl.name); p.p.inTNTwarsMap = true; } if (GameMode == TntWarsGameMode.TDM) { Command.all.Find("reveal").Use(null, "all " + lvl.name); } //So peoples names apear above their heads in the right color! foreach (player p in Players) { Command.all.Find("spawn").Use(p.p, ""); //This has to be after reveal so that they spawn in the correct place!! Thread.Sleep(250); } } //Announcing Etc. string Gamemode = "Free For All"; if (GameMode == TntWarsGameMode.TDM) { Gamemode = "Team Deathmatch"; } string Difficulty = "Normal"; string HitsToDie = "2"; string explosiontime = "medium"; string explosionsize = "normal"; switch (GameDifficulty) { case TntWarsDifficulty.Easy: Difficulty = "Easy"; explosiontime = "long"; break; case TntWarsDifficulty.Normal: Difficulty = "Normal"; break; case TntWarsDifficulty.Hard: HitsToDie = "1"; Difficulty = "Hard"; break; case TntWarsDifficulty.Extreme: HitsToDie = "1"; explosiontime = "short"; explosionsize = "big"; Difficulty = "Extreme"; break; } string teamkillling = "Disabled"; if (TeamKills) { teamkillling = "Enabled"; } Player.GlobalMessage(Colors.red + "TNT Wars " + Server.DefaultColor + "on '" + lvl.name + "' has started " + Colors.teal + Gamemode + Server.DefaultColor + " with a difficulty of " + Colors.teal + Difficulty + Server.DefaultColor + " (" + Colors.teal + HitsToDie + Server.DefaultColor + " hits to die, a " + Colors.teal + explosiontime + Server.DefaultColor + " explosion delay and with a " + Colors.teal + explosionsize + Server.DefaultColor + " explosion size)" + ", team killing is " + Colors.teal + teamkillling + Server.DefaultColor + " and you can place " + Colors.teal + TntPerPlayerAtATime.ToString() + Server.DefaultColor + " TNT at a time and there is a score limit of " + Colors.teal + ScoreLimit.ToString() + Server.DefaultColor + "!!"); if (GameMode == TntWarsGameMode.TDM) { SendAllPlayersMessage("TNT Wars: Start your message with ':' to send it as a team chat!"); } //GracePeriod if (GracePeriod) //Check This Grace Stuff { GameStatus = TntWarsGameStatus.GracePeriod; int GracePeriodSecsRemaining = GracePeriodSecs; SendAllPlayersMessage("TNT Wars: Grace Period of " + Colors.lime + GracePeriodSecsRemaining.ToString() + Server.DefaultColor + " seconds"); while (GracePeriodSecsRemaining > 0) { switch (GracePeriodSecsRemaining) { case 300: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "5" + Server.DefaultColor + " minutes remaining!"); break; case 240: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "4" + Server.DefaultColor + " minutes remaining!"); break; case 180: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "3" + Server.DefaultColor + " minutes remaining!"); break; case 120: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "2" + Server.DefaultColor + " minutes remaining!"); break; case 90: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "1" + Server.DefaultColor + " minute and " + Colors.teal + "30" + Server.DefaultColor + " seconds remaining!"); break; case 60: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "1" + Server.DefaultColor + " minute remaining!"); break; case 45: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "45" + Server.DefaultColor + " seconds remaining!"); break; case 30: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "30" + Server.DefaultColor + " seconds remaining!"); break; case 15: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "15" + Server.DefaultColor + " seconds remaining!"); break; case 10: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "10" + Server.DefaultColor + " seconds remaining!"); break; case 9: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "9" + Server.DefaultColor + " seconds remaining!"); break; case 8: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "8" + Server.DefaultColor + " seconds remaining!"); break; case 7: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "7" + Server.DefaultColor + " seconds remaining!"); break; case 6: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "6" + Server.DefaultColor + " seconds remaining!"); break; case 5: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "5" + Server.DefaultColor + " seconds remaining!"); break; case 4: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "4" + Server.DefaultColor + " seconds remaining!"); break; case 3: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "3" + Server.DefaultColor + " seconds remaining!"); break; case 2: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "2" + Server.DefaultColor + " seconds remaining!"); break; case 1: SendAllPlayersMessage("TNT Wars: " + Colors.teal + "1" + Server.DefaultColor + " second remaining!"); break; } Thread.Sleep(1000); GracePeriodSecsRemaining -= 1; } SendAllPlayersMessage("TNT Wars: Grace Period is over!!!!!"); SendAllPlayersMessage("TNT Wars: You may now place " + Colors.red + "TNT"); } SendAllPlayersMessage("TNT Wars: " + Colors.white + "The Game Has Started!!!!!"); GameStatus = TntWarsGameStatus.InProgress; foreach (player p in Players) { if (p.spec == false) { p.p.canBuild = true; } } if (GracePeriod) { SendAllPlayersMessage("TNT Wars: You can now build!!"); } //MainLoop while (!Finished()) { int i = 1; //For making a top 5 (or whatever) players announcement every 3 loops (if TDM) Thread.Sleep(3 * 1000); if (Finished()) { break; //--\\ } Thread.Sleep(3 * 1000); if (Finished()) { break; //----\ } Thread.Sleep(3 * 1000); if (Finished()) { break; //-----> So that if it finsihes, we don't have to wait like 10 secs for the announcement!! } Thread.Sleep(3 * 1000); if (Finished()) { break; //----/ } Thread.Sleep(3 * 1000); if (Finished()) { break; //--// } if (GameMode == TntWarsGameMode.TDM) { if (i < 3) { SendAllPlayersScore(true, true); } if (i >= 3) { SendAllPlayersScore(true, true, true); i = 0; } i++; } else if (GameMode == TntWarsGameMode.FFA) { SendAllPlayersScore(false, true, true); } } END(); }
//During Game Main Methods public void Start() { GameStatus = TntWarsGameStatus.AboutToStart; //Checking Backups & physics etc. { BackupNumber = lvl.Backup(true); if (BackupNumber <= 0) { SendAllPlayersMessage(Colors.red + "Backing up Level for TNT Wars failed, Stopping game"); Chat.MessageOps(Colors.red + "Backing up Level for TNT Wars failed, Stopping game"); GameStatus = TntWarsGameStatus.Finished; return; } Logger.Log(LogType.SystemActivity, "Backed up {0} ({1}) for TNT Wars", lvl.name, BackupNumber); } //Map stuff lvl.setPhysics(3); lvl.BuildAccess.Min = Group.standard.Permission; lvl.VisitAccess.Min = Group.standard.Permission; lvl.Config.KillerBlocks = true; //Seting Up Some Player stuff { foreach (player p in Players) { p.p.PlayingTntWars = true; p.p.CurrentAmountOfTnt = 0; p.p.CurrentTntGameNumber = GameNumber; if (Difficulty == TntWarsDifficulty.Easy || Difficulty == TntWarsDifficulty.Normal) { p.p.TntWarsHealth = 2; } else { p.p.TntWarsHealth = 1; } p.p.HarmedBy = null; if (Config.InitialGracePeriod) { p.p.canBuild = false; } if (p.spec) { p.p.canBuild = false; Player.Message(p.p, "TNT Wars: Disabled building because you are a spectator!"); } p.p.TntWarsKillStreak = 0; p.p.TntWarsScoreMultiplier = 1f; p.p.TNTWarsLastKillStreakAnnounced = 0; SetTitlesAndColor(p); } if (Config.InitialGracePeriod) { SendAllPlayersMessage("TNT Wars: Disabled building during Grace Period!"); } } //Spawn them (And if needed, move them to the correct level!) { foreach (player p in Players) { if (p.p.level == lvl) { continue; } PlayerActions.ChangeMap(p.p, lvl); p.p.inTNTwarsMap = true; } if (GameMode == TntWarsGameMode.TDM) { Command.all.Find("reveal").Use(null, "all " + lvl.name); } //So peoples names apear above their heads in the right color! foreach (player p in Players) { Command.all.FindByName("Spawn").Use(p.p, ""); //This has to be after reveal so that they spawn in the correct place!! Thread.Sleep(250); } } //Announcing Etc. string Gamemode = "Free For All"; if (GameMode == TntWarsGameMode.TDM) { Gamemode = "Team Deathmatch"; } string difficulty = "Normal"; string HitsToDie = "2"; string explosiontime = "medium"; string explosionsize = "normal"; switch (Difficulty) { case TntWarsDifficulty.Easy: difficulty = "Easy"; explosiontime = "long"; break; case TntWarsDifficulty.Normal: difficulty = "Normal"; break; case TntWarsDifficulty.Hard: HitsToDie = "1"; difficulty = "Hard"; break; case TntWarsDifficulty.Extreme: HitsToDie = "1"; explosiontime = "short"; explosionsize = "big"; difficulty = "Extreme"; break; } string teamkillling = "Disabled"; if (Config.TeamKills) { teamkillling = "Enabled"; } Chat.MessageGlobal("&cTNT Wars %Son " + lvl.ColoredName + " %Shas started &3" + Gamemode + " %Swith a difficulty of &3" + difficulty + " %S(&3" + HitsToDie + " %Shits to die, a &3" + explosiontime + " %Sexplosion delay and with a &3" + explosionsize + " %Sexplosion size)" + ", team killing is &3" + teamkillling + " %Sand you can place &3" + Config.MaxPlayerActiveTnt + " %STNT at a time and there is a score limit of &3" + ScoreLimit + "%S!!"); if (GameMode == TntWarsGameMode.TDM) { SendAllPlayersMessage("TNT Wars: Start your message with ':' to send it as a team chat!"); } //GracePeriod if (Config.InitialGracePeriod) //Check This Grace Stuff { GameStatus = TntWarsGameStatus.GracePeriod; int GracePeriodSecsRemaining = Config.GracePeriodSeconds; SendAllPlayersMessage("TNT Wars: Grace Period of &a" + GracePeriodSecsRemaining + " %Sseconds"); while (GracePeriodSecsRemaining > 0) { switch (GracePeriodSecsRemaining) { case 300: SendAllPlayersMessage("TNT Wars: &35 %Sminutes remaining!"); break; case 240: SendAllPlayersMessage("TNT Wars: &34 %Sminutes remaining!"); break; case 180: SendAllPlayersMessage("TNT Wars: &33 %Sminutes remaining!"); break; case 120: SendAllPlayersMessage("TNT Wars: &32 %Sminutes remaining!"); break; case 90: SendAllPlayersMessage("TNT Wars: &31 %Sminute and &330 %Sseconds remaining!"); break; case 60: SendAllPlayersMessage("TNT Wars: &31 %Sminute remaining!"); break; case 45: SendAllPlayersMessage("TNT Wars: &345 %Sseconds remaining!"); break; case 30: SendAllPlayersMessage("TNT Wars: &330 %Sseconds remaining!"); break; case 15: SendAllPlayersMessage("TNT Wars: &315 %Sseconds remaining!"); break; case 10: SendAllPlayersMessage("TNT Wars: &310 %Sseconds remaining!"); break; case 9: SendAllPlayersMessage("TNT Wars: &39 %Sseconds remaining!"); break; case 8: SendAllPlayersMessage("TNT Wars: &38 %Sseconds remaining!"); break; case 7: SendAllPlayersMessage("TNT Wars: &37 %Sseconds remaining!"); break; case 6: SendAllPlayersMessage("TNT Wars: &36 %Sseconds remaining!"); break; case 5: SendAllPlayersMessage("TNT Wars: &35 %Sseconds remaining!"); break; case 4: SendAllPlayersMessage("TNT Wars: &34 %Sseconds remaining!"); break; case 3: SendAllPlayersMessage("TNT Wars: &33 %Sseconds remaining!"); break; case 2: SendAllPlayersMessage("TNT Wars: &32 %Sseconds remaining!"); break; case 1: SendAllPlayersMessage("TNT Wars: &31 %Ssecond remaining!"); break; } Thread.Sleep(1000); GracePeriodSecsRemaining -= 1; } SendAllPlayersMessage("TNT Wars: Grace Period is over!!!!!"); SendAllPlayersMessage("TNT Wars: You may now place " + Colors.red + "TNT"); } SendAllPlayersMessage("TNT Wars: " + Colors.white + "The Game Has Started!!!!!"); GameStatus = TntWarsGameStatus.InProgress; foreach (player p in Players) { if (!p.spec) { p.p.canBuild = true; } } if (Config.InitialGracePeriod) { SendAllPlayersMessage("TNT Wars: You can now build!!"); } //MainLoop while (!Finished()) { int i = 1; //For making a top 5 (or whatever) players announcement every 3 loops (if TDM) Thread.Sleep(3 * 1000); if (Finished()) { break; //--\\ } Thread.Sleep(3 * 1000); if (Finished()) { break; //----\ } Thread.Sleep(3 * 1000); if (Finished()) { break; //-----> So that if it finsihes, we don't have to wait like 10 secs for the announcement!! } Thread.Sleep(3 * 1000); if (Finished()) { break; //----/ } Thread.Sleep(3 * 1000); if (Finished()) { break; //--// } if (GameMode == TntWarsGameMode.TDM) { if (i < 3) { SendAllPlayersScore(true, true); } if (i >= 3) { SendAllPlayersScore(true, true, true); i = 0; } i++; } else if (GameMode == TntWarsGameMode.FFA) { SendAllPlayersScore(false, true, true); } } END(); }
public void END() { GameStatus = TntWarsGameStatus.Finished; //let them build and spawn them and change playingtntwars to false foreach (player p in Players) { p.p.canBuild = true; Command.all.FindByName("Spawn").Use(p.p, ""); p.p.PlayingTntWars = false; } //Message about winners etc. if (Players.Count <= 1) { Chat.MessageGlobal("&cTNT Wars %Shas ended because there are no longer enough players!"); } else { Chat.MessageGlobal("&cTNT Wars %Shas ended!!"); } if (GameMode == TntWarsGameMode.TDM) { if (RedScore >= BlueScore) { Chat.MessageGlobal("TNT Wars: Team &cRed %Swon &cTNT Wars %Sby {0} points!", RedScore - BlueScore); } if (BlueScore >= RedScore) { Chat.MessageGlobal("TNT Wars: Team &9Blue %Swon &cTNT Wars %Sby {0} points!", BlueScore - RedScore); } try { foreach (player p in Players) { if (!p.spec) { Player.Message(p.p, "TNT Wars: You Scored " + p.Score + " points"); } } } catch { } SendAllPlayersMessage("TNT Wars: Top Scores:"); SendAllPlayersScore(false, false, true); } if (GameMode == TntWarsGameMode.FFA) { int count = PlayingPlayers(); List <player> pls = SortedByScore(); for (int i = 0; i < count; i++) { player pl = pls[i]; if (i == 0) { Chat.MessageGlobal("&cTNT Wars %S1st Place: " + pl.p.ColoredName + " %Swith a score of " + pl.p.color + pl.Score); } else if (i == 1) { SendAllPlayersMessage("&cTNT Wars %S2nd Place: " + pl.p.ColoredName + " %Swith a score of " + pl.p.color + pl.Score); } else if (i == 2) { SendAllPlayersMessage("&cTNT Wars %S3rd Place: " + pl.p.ColoredName + " %Swith a score of " + pl.p.color + pl.Score); } else { SendAllPlayersMessage("&cTNT Wars %S" + count + "th Place: " + pl.p.ColoredName + " %Swith a score of " + pl.p.color + pl.Score); } Thread.Sleep(750); //Maybe, not sure (was 500) } } //Reset map Command.all.FindByName("Restore").Use(null, BackupNumber + " " + lvl.name); if (lvl.Config.PhysicsOverload == 2501) { lvl.Config.PhysicsOverload = 1500; Logger.Log(LogType.GameActivity, "TNT Wars: Set level physics overload back to 1500"); } }