View Single Post
  #2  
Old 04-23-2012, 06:02 AM
FG28_Kodiak FG28_Kodiak is offline
Approved Member
 
Join Date: Dec 2009
Location: Swabia->Bavaria->Germany
Posts: 884
Default

You dont need a player in this case, you get a AiAircraft via OnAircraftCrashLanded. So you don't need a Player. The most of your player code make no sense
corrected:
Code:
    public override void OnAircraftCrashLanded(int missionNumber, string shortName, AiAircraft aircraft)
    {
        base.OnAircraftCrashLanded(missionNumber, shortName, aircraft);
       
            switch ((aircraft).InternalTypeName())
            {
                case "bob:Aircraft.SpitfireMkIIa":
                    currentSpitIIas--;
                    allowedSpitIIas -= 1;
                    break;
                case "bob:Aircraft.Bf-109E-4":
                    currentSpitIIas--;  // <---- Attention wrong variable 
                    allowed109s -= 1;
                    break;
            }
        

        List<Player> playersInPlane = new List<Player>();

        for (int i = 0; i < aircraft.Places(); i++)
        {
            if (aircraft.Player(i) != null)
            {
                playersInPlane.Add(aircraft.Player(i));
            }
        }
        
        if (playersInPlane.Count > 0)
            GamePlay.gpHUDLogCenter(playersInPlane.ToArray(), "Looks like you are walking home...", new object[] { });

        Timeout(120, () =>
            { destroyPlane(aircraft); });
    }
Reply With Quote