/// <summary> /// Creates a static <see cref="BaseVehicle" /> in the world. /// </summary> /// <param name="vehicletype">The model for the vehicle.</param> /// <param name="position">The coordinates for the vehicle.</param> /// <param name="rotation">The facing angle for the vehicle.</param> /// <param name="color1">The primary color ID.</param> /// <param name="color2">The secondary color ID.</param> /// <returns> The <see cref="BaseVehicle" /> created.</returns> public virtual BaseVehicle CreateStatic(VehicleModelType vehicletype, Vector3 position, float rotation, int color1, int color2) { var id = Internal.AddStaticVehicle((int)vehicletype, position.X, position.Y, position.Z, rotation, color1, color2); return(id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id)); }
/// <summary> /// Creates a static <see cref="BaseVehicle" /> in the world. /// </summary> /// <param name="vehicletype">The model for the vehicle.</param> /// <param name="position">The coordinates for the vehicle.</param> /// <param name="rotation">The facing angle for the vehicle.</param> /// <param name="color1">The primary color ID.</param> /// <param name="color2">The secondary color ID.</param> /// <param name="respawnDelay"> /// The delay until the car is respawned without a driver in seconds. Using -1 will prevent the /// vehicle from respawning. /// </param> /// <param name="addAlarm">If true, enables the vehicle to have a siren, providing the vehicle has a horn.</param> /// <returns> The <see cref="BaseVehicle" /> created.</returns> public virtual BaseVehicle CreateStatic(VehicleModelType vehicletype, Vector3 position, float rotation, int color1, int color2, int respawnDelay, bool addAlarm = false) { var id = Internal.AddStaticVehicleEx((int)vehicletype, position.X, position.Y, position.Z, rotation, color1, color2, respawnDelay, addAlarm); return(id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id)); }
/// <summary> /// Creates a <see cref="BaseVehicle" /> in the world. /// </summary> /// <param name="vehicletype">The model for the vehicle.</param> /// <param name="position">The coordinates for the vehicle.</param> /// <param name="rotation">The facing angle for the vehicle.</param> /// <param name="color1">The primary color ID.</param> /// <param name="color2">The secondary color ID.</param> /// <param name="respawnDelay"> /// The delay until the car is respawned without a driver in seconds. Using -1 will prevent the /// vehicle from respawning. /// </param> /// <param name="addAlarm">If true, enables the vehicle to have a siren, providing the vehicle has a horn.</param> /// <returns> The <see cref="BaseVehicle" /> created.</returns> public virtual BaseVehicle Create(VehicleModelType vehicletype, Vector3 position, float rotation, int color1, int color2, int respawnDelay = -1, bool addAlarm = false) { var id = new[] { 449, 537, 538, 569, 570, 590 }.Contains((int)vehicletype) ? Internal.AddStaticVehicleEx((int)vehicletype, position.X, position.Y, position.Z, rotation, color1, color2, respawnDelay, addAlarm) : Internal.CreateVehicle((int)vehicletype, position.X, position.Y, position.Z, rotation, color1, color2, respawnDelay, addAlarm); return(id == BaseVehicle.InvalidId ? null : BaseVehicle.FindOrCreate(id)); }