Any chance of a bit of help here?
I've been running a Lobby for around three months now and have been slowly learning the beast that is known as FMB and some simple scripting that I've obtained from 1C.
I recently put a script in place to remove 'abandoned' player aircraft which is this:
Code: Select all
using System;
using maddox.game;
using maddox.game.world;
using System.Collections.Generic;
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(1, () =>
{
_DespawnEmptyPlane(actor);
});
}
}
So next I added the following to it (inserted before the last bracket):
Code: Select all
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
if (action != null)
{
action.Do();
}
}
Any help, ideas, please??