Quote:
Originally Posted by No457_Squog
No457_Mako & myself tweaked this code so that the server is included in the workings. The Server isn't listed in the GamePlay.gpRemotePlayers() array.
Code:
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)) || ((GamePlay.gpPlayer().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);
});
}
}
|
~S
Will test on Australian Skies tomorrow
EDIT: This works for me, thanks No457_Mako & No457_Squog, has helped with server stability. Ran 3 maps no worries, we were having issues with loading new maps before this
Worked with Position swap ONLINE in the bf 110 as well.
Matoni