Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Diagnostics;
using maddox.game;
using maddox.game.world;
using System.Media;
using maddox.GP;
using System.IO;
using System.Reflection;
using System.Timers;
using part;
public class Mission : AMission
{
public void _DespawnEmptyPlane(AiActor actor)
{
if (actor == null)
{
return;
}
Player[] Players = GamePlay.gpRemotePlayers();
bool PlaneIsEmpty = true;
foreach (Player i in Players)
{
if ((i.Place() as AiAircraft) == (actor as AiAircraft))
{
PlaneIsEmpty = false;
break;
}
}
if (PlaneIsEmpty)
{
(actor as AiAircraft).Destroy();
}
}
public override void OnPlaceLeave(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceLeave(player, actor, placeIndex);
Timeout(5, () =>
{
_DespawnEmptyPlane(actor);
});
}
private void sendScreenMessageTo(int army, string msg, object[] parms)
{
List<Player> Players = new List<Player>();
//Singleplayer or Dedi Server
if (GamePlay.gpPlayer() != null)
{
if (GamePlay.gpPlayer().Army() == army || army == -1)
Players.Add(GamePlay.gpPlayer());
} // Multiplayer
if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
{
foreach (Player p in GamePlay.gpRemotePlayers())
{
if (p.Army() == army || army == -1)
Players.Add(p);
}
}
if (Players != null && Players.Count > 0)
GamePlay.gpHUDLogCenter(Players.ToArray(), msg, parms);
}
private void sendChatMessageTo(int army, string msg, object[] parms)
{
List<Player> Players = new List<Player>();
//Singleplayer or Dedi Server
if (GamePlay.gpPlayer() != null)
{
if (GamePlay.gpPlayer().Army() == army || army == -1)
Players.Add(GamePlay.gpPlayer());
} // Multiplayer
if (GamePlay.gpRemotePlayers() != null || GamePlay.gpRemotePlayers().Length > 0)
{
foreach (Player p in GamePlay.gpRemotePlayers())
{
if (p.Army() == army || army == -1)
Players.Add(p);
}
}
if (Players != null && Players.Count > 0)
GamePlay.gpLogServer(Players.ToArray(), msg, parms);
}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
if ("g1".Equals(shortName))
{
AiAction Action = GamePlay.gpGetAction("g1");
if (Action != null)
{
Action.Do();
GamePlay.gpGetTrigger(shortName).Enable = false;
}
Timeout(5, () => sendScreenMessageTo(2, "11", null));
Timeout(11, () => sendScreenMessageTo(2, "22", null));
Timeout(27, () => sendScreenMessageTo(2, "BLUE TEAM, Escort Ju87 from Calais, alt 4.5K", null));
Timeout(30, () => sendScreenMessageTo(2, "BLUE TEAM, Ju87 obj is Dover port", null));
}
if ("g2".Equals(shortName))
{
AiAction Action = GamePlay.gpGetAction("g2");
if (Action != null)
{
Action.Do();
GamePlay.gpGetTrigger(shortName).Enable = false;
}
Timeout(10, () => sendScreenMessageTo(1, "33", null));
Timeout(20, () => sendScreenMessageTo(1, "44", null));
Timeout(27, () => sendScreenMessageTo(1, "RED TEAM, Scramble! New contact group, Ju87 from Calais", null));
Timeout(30, () => sendScreenMessageTo(1, "RED TEAM, Bombers Mid Channel angels 15, direction Dover", null));
}
if ("ju87".Equals(shortName))
{
AiAction Action = GamePlay.gpGetAction("ju87");
if (Action != null)
{
Action.Do();
GamePlay.gpGetTrigger(shortName).Enable = false;
}
if ("trigger_ju87".Equals(shortName) && active)
{
Timeout(5.0, () => {
GamePlay.gpHUDLogCenter("ju87");
// System.Media.SoundPlayer player = new System.Media.SoundPlayer("True-Patriot.wav");
// player.Play();
});
}
}
}
}
Bookmarks