Log in

View Full Version : Fuel limit


28_Condor
05-21-2012, 02:43 AM
Its possible to build a script to limit fuel for a type of plane? Or better: for plane and respawn in airfiled?


Thanks for any help :)

salmo
05-21-2012, 06:03 AM
Fuel limit on spawning


public override void OnPlaceEnter(Player player, AiActor actor, int placeIndex)
{
base.OnPlaceEnter(player, actor, placeIndex);

AiAircraft aircraft = actor as AiAircraft;
if (aircraft != null)
{
double FuelLimit = 100; // max kg's of fuel allowed
double f = aircraft.getParameter(part.ParameterTypes.S_FuelRe serve, -1); // kg's of fuel in aircraft
if (f > FuelLimit) // too much fuel
{
aircraft.Destroy(); // too much fuel so destroy plane
}
}
}

28_Condor
05-21-2012, 08:04 PM
Thanks, Salmo!

Where I can specify the type of plane? Sorry, I'm newbie with scripts...

I want a limit only for BFs... like in one airfield 100%, in another 20%