public void CreateGame(Client client) { GameLeader = client; GameState = CTFGameState.WaitingForPlayers; AddToGame(client); Messenger.PlayerMsg(client, "You have created a new game of Capture The Flag! Say /ctfstart to start!", Text.Yellow); Messenger.MapMsg(MapManager.GenerateMapID(HUBMAP), client.Player.Name + " has created a new game of Capture The Flag!", Text.Yellow); }
public void StartGame() { if (RedTeamPlayers >= MINTEAMCOUNT && BlueTeamPlayers >= MINTEAMCOUNT) { for (int i = 0; i < MAXTEAMCOUNT; i++) { try { if (BlueTeam[i] != null) { Messenger.PlayerMsg(BlueTeam[i], "You are on the Blue Team", Text.Yellow); Messenger.PlayerWarp(BlueTeam[i], BLUEMAP, BLUEX, BLUEY); BlueTeam[i].Player.Status = "Blue"; Messenger.SendPlayerData(BlueTeam[i]); } if (RedTeam[i] != null) { Messenger.PlayerMsg(RedTeam[i], "You are on the Red Team", Text.Yellow); Messenger.PlayerWarp(RedTeam[i], REDMAP, REDX, REDY); RedTeam[i].Player.Status = "Red"; Messenger.SendPlayerData(RedTeam[i]); } } catch (Exception ex) { } } GameState = CTFGameState.Started; } else { int needed = (MINTEAMCOUNT * 2) - (RedTeamPlayers + BlueTeamPlayers); if (needed == 1) { Messenger.PlayerMsg(GameLeader, "There are not enough players on each team! 1 more player needs to join before the game can start!", Text.BrightRed); } else { Messenger.PlayerMsg(GameLeader, "There are not enough players on each team! " + needed.ToString() + " more players need to join before the game can start!", Text.BrightRed); } } }
public void Init(CTFGameState newGameState) { RedTeam = new Client[MAXTEAMCOUNT]; BlueTeam = new Client[MAXTEAMCOUNT]; for (int i = 0; i < MAXTEAMCOUNT; i++) { RedTeam[i] = null; BlueTeam[i] = null; } RedTeamPlayers = 0; BlueTeamPlayers = 0; GameState = newGameState; RedScore = 0; BlueScore = 0; RedFlags = 5; BlueFlags = 5; PlayerCount = 0; GameLeader = null; RedFlagHolder = null; BlueFlagHolder = null; LastAdded = Teams.Red; }
public CTF(CTFGameState newGameState) { Init(newGameState); }