2015-12-01 12:50:50 +00:00
|
|
|
|
using System;
|
2017-02-23 13:08:59 +00:00
|
|
|
|
using System.Linq;
|
2015-12-01 12:50:50 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using MultiTheftAuto;
|
|
|
|
|
using MultiTheftAuto.EventArgs;
|
|
|
|
|
|
2017-02-23 13:08:59 +00:00
|
|
|
|
using Console = MultiTheftAuto.Console;
|
|
|
|
|
|
2015-12-01 12:50:50 +00:00
|
|
|
|
namespace Test
|
|
|
|
|
{
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main( string[] args )
|
|
|
|
|
{
|
2017-02-23 13:08:59 +00:00
|
|
|
|
Event.AddHandler( "onElementDestroy", Resource.Root, new Action<Vehicle>( Vehicle_OnElementDestroy ) );
|
2015-12-12 10:10:23 +00:00
|
|
|
|
|
2017-02-23 13:08:59 +00:00
|
|
|
|
for( int i = 0; i < 8; i++ )
|
|
|
|
|
{
|
|
|
|
|
Vehicle vehicle = new Vehicle( VehicleModel.SULTAN + i, Vector3.Zero, Vector3.Zero );
|
|
|
|
|
}
|
2015-12-12 10:10:23 +00:00
|
|
|
|
|
2017-02-23 13:08:59 +00:00
|
|
|
|
Debug.Info( "------------------------------------" );
|
2015-12-01 12:50:50 +00:00
|
|
|
|
|
2017-02-23 13:08:59 +00:00
|
|
|
|
foreach( Vehicle vehicle in Element.GetByType( "vehicle" ) )
|
|
|
|
|
{
|
|
|
|
|
Debug.Info( string.Format( "{0} {1}", vehicle.GetVehicleType(), vehicle.GetName() ) );
|
2015-12-01 12:50:50 +00:00
|
|
|
|
|
2017-02-23 13:08:59 +00:00
|
|
|
|
vehicle.Destroy();
|
|
|
|
|
}
|
2015-12-05 10:26:07 +00:00
|
|
|
|
|
2017-02-23 13:08:59 +00:00
|
|
|
|
Debug.Info( "------------------------------------" );
|
2015-12-01 12:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-23 13:08:59 +00:00
|
|
|
|
static void Vehicle_OnElementDestroy( Vehicle sender )
|
2015-12-01 12:50:50 +00:00
|
|
|
|
{
|
2017-02-23 13:08:59 +00:00
|
|
|
|
Console.WriteLine( "onElementDestroy: " + sender.GetName() );
|
2015-12-01 12:50:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|