Right, now I really look foolish. I'd forgotten to add the librarys.
We've got a chap in our squad that works with C# professionally and he sacrificed some time and helped me with a script, using the ones that you've so kindly donated as a basis to go on.
He's come up with a script that works perfectly. We have it running on our dedicated server. Here's an excerpt from one of our sub-missions.
Code:
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
public class Mission : AMission
{
private const int All = -1;
private const int Allies = 1;
private const int Axis = 2;
public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);
SendScreenMessageTo(All, "Welcome Everyone");
SendScreenMessageTo(Axis, "Lucie-Anton: good hunting over the channel. Weather reports clear skys with mild cloudbase at 1500 meters.");
SendScreenMessageTo(Allies, "Sector control reports 79 squadron on inbound leg to patrol SE Dover area. Over.");
}
private void SendScreenMessageTo(int army, string message)
{
if (army == All)
{
GamePlay.gpHUDLogCenter(message);
}
else
{
//Singleplayer (for Testing)
if (GamePlay.gpRemotePlayers() == null ||
GamePlay.gpRemotePlayers().Length <= 0)
{
if (GamePlay.gpPlayer() != null &&
GamePlay.gpPlayer().Army() == army)
{
GamePlay.gpHUDLogCenter(message);
}
}
else // Multiplayer
{
var playersInArmy = new List<Player>();
foreach (var player in GamePlay.gpRemotePlayers())
{
if (player.Army() == army)
{
playersInArmy.Add(player);
}
}
GamePlay.gpHUDLogCenter(playersInArmy.ToArray(), message);
}
}
}
private void SendChatMessageTo(int army, string message)
{
if (army == All)
{
GamePlay.gpLogServer(null, message, null);
}
else
{
//Singleplayer (for Testing)
if (GamePlay.gpRemotePlayers() == null ||
GamePlay.gpRemotePlayers().Length <= 0)
{
if (GamePlay.gpPlayer() != null &&
GamePlay.gpPlayer().Army() == army)
{
GamePlay.gpLogServer(null, message, null);
}
}
else // Multiplayer
{
var playersInArmy = new List<Player>();
foreach (var player in GamePlay.gpRemotePlayers())
{
if (player.Army() == army)
{
playersInArmy.Add(player);
}
}
GamePlay.gpLogServer(playersInArmy.ToArray(), message, null);
}
}
}
}
Thank you so much for your help everyone.
Cheers
Gromic