public static void CreateDeloreonintruck(Vector3 truckposition) { if (!(Docstruck == null)) { Docstruck.Delete(); } Model gmcvan = new Model("GMCVAN"); if (gmcvan.IsValid) { Docstruck = World.CreateVehicle(gmcvan, truckposition); Docstruck.Rotation = new Vector3(0, 0, 102); Docstruck.OpenDoor(VehicleDoor.Trunk, false, true); Vector3 position = Docstruck.GetOffsetInWorldCoords(new Vector3(0, -10, 0)); TimeTravel.instantDelorean.Deloreanlist.Add(new TimeCircuits()); TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon = World.CreateVehicle(new Model("BTTF"), position); TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.Rotation = new Vector3(0, 0, 102); TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.IsInvincible = true; TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.CanBeVisiblyDamaged = false; if (!(Doc == null)) { Doc.Delete(); } Doc = TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.CreatePedOnSeat(VehicleSeat.Driver, new Model("S_M_M_Doctor_01")); Doc.RelationshipGroup = (int)Relationship.Companion; Einstein = World.CreatePed(PedHash.Chop, Docstruck.GetOffsetInWorldCoords(new Vector3(-20, 0, 0))); Einstein.RelationshipGroup = (int)Relationship.Companion; Einstein.IsInvincible = true; TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.DirtLevel = 0; TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.PrimaryColor = VehicleColor.BrushedAluminium; TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.SecondaryColor = VehicleColor.BrushedAluminium; TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.NumberPlate = "OutATime"; } }
public void CallMechanic( Vehicle vehicle, Engine vehicleEngine ) { if ( this._isCalled ) { UI.Notify( "Mechanic is already called!", true ); return; } if ( Math.Round( vehicle.Speed, 2 ) > 0 ) { UI.Notify( "You should stop your car before calling the mechanic!", true ); return; } if ( !this.TakeMoney() ) { UI.Notify( "Not enought money!", true ); return; } vehicle.IsDriveable = false; var vehiclePosition = vehicle.Position; var spawnPosition = World.GetNextPositionOnStreet( vehiclePosition.Around( 80f ) ); this._mechanicVehicle = World.CreateVehicle( VehicleHash.Panto, spawnPosition ); this._mechanicPed = this._mechanicVehicle.CreatePedOnSeat( VehicleSeat.Driver, PedHash.FatWhite01AFM ); this._mechanicPed.Weapons.Give( WeaponHash.FireExtinguisher, 10000, true, true ); var openHoodPosition = vehicle.GetOffsetInWorldCoords( new Vector3( 0.35f, 3.0f, 0.0f ) ); var shootPosition = vehicle.GetOffsetInWorldCoords( new Vector3( 0.35f, 5.0f, 0.0f ) ); var tasks = new TaskSequence(); tasks.AddTask.DriveTo( this._mechanicVehicle, vehiclePosition, 15f, 40, (int)DrivingStyle.Rushed ); tasks.AddTask.RunTo( openHoodPosition ); tasks.AddTask.TurnTo( vehicle, 1000 ); tasks.AddTask.Wait( 1000 ); tasks.AddTask.GoTo( shootPosition ); tasks.AddTask.ShootAt( vehiclePosition, 15500, FiringPattern.FullAuto ); tasks.AddTask.GoTo( openHoodPosition ); tasks.AddTask.TurnTo( vehicle, 1000 ); tasks.AddTask.Wait( 1000 ); tasks.AddTask.CruiseWithVehicle( this._mechanicVehicle, 30f, (int)DrivingStyle.Rushed ); tasks.Close(); this._taskSequenceEventController.Subscribe( 2, this._mechanicPed, tasks, () => { this._mechanicVehicle.LeftIndicatorLightOn = true; this._mechanicVehicle.RightIndicatorLightOn = true; } ); this._taskSequenceEventController.Subscribe( 4, this._mechanicPed, tasks, () => this.OpenVehicleHood( vehicle ) ); this._taskSequenceEventController.Subscribe( 5, this._mechanicPed, tasks, () => { vehicleEngine.Temperature -= 0.5f; vehicleEngine.Damage -= 5.5f; vehicle.EngineHealth += vehicle.EngineHealth >= 1000 ? 0 : 2f; }, true ); this._taskSequenceEventController.Subscribe( 8, this._mechanicPed, tasks, () => this.OpenVehicleHood( vehicle, false ) ); this._taskSequenceEventController.Subscribe( 9, this._mechanicPed, tasks, () => { this._mechanicPed.MarkAsNoLongerNeeded(); this._mechanicPed.Task.CruiseWithVehicle( this._mechanicVehicle, 30f, (int)DrivingStyle.AvoidTrafficExtremely ); vehicle.IsDriveable = true; this._mechanicBlip.Remove(); this._taskSequenceEventController.UnsubscribeAll( this._mechanicPed, tasks ); this._mechanicVehicle.MarkAsNoLongerNeeded(); this._mechanicVehicle.LeftIndicatorLightOn = false; this._mechanicVehicle.RightIndicatorLightOn = false; this._isCalled = false; } ); this._mechanicPed.Task.PerformSequence( tasks ); this._mechanicBlip = this._mechanicPed.AddBlip(); this._mechanicBlip.Color = BlipColor.Blue; this._mechanicBlip.Name = "Mechanic"; this._isCalled = true; }