Пример #1
0
        private static void k9MainLogic()
        {
            suspectVehicle = Game.LocalPlayer.Character.IsInAnyVehicle(false) ? InCar() : OnFoot();
            if (!suspectVehicle.Exists())
            {
                Game.DisplaySubtitle("No vehicle detected."); return;
            }
            Game.DisplayNotification("~b~" + PoliceSmartRadio.PlayerName + ": ~s~Requesting K-9 backup.");
            k9Vehicle = Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Code2, LSPD_First_Response.EBackupUnitType.LocalUnit, string.Empty, false, false, 1);
            GameFiber.Yield();
            dogHandler = k9Vehicle.Driver;

            k9Vehicle.IsPersistent = true;

            dogHandler.MakeMissionPed();

            k9 = new Ped(k9Model, Vector3.Zero, 0);
            k9.MakeMissionPed();

            if (k9Vehicle.FreePassengerSeatsCount > 2 && k9Vehicle.GetFreeSeatIndex(1, 2) != null)
            {
                k9.WarpIntoVehicle(k9Vehicle, k9Vehicle.GetFreeSeatIndex(1, 2).GetValueOrDefault());
            }
            else
            {
                k9.WarpIntoVehicle(k9Vehicle, 2);
            }
            k9VehicleBlip       = k9Vehicle.AttachBlip();
            k9VehicleBlip.Color = System.Drawing.Color.Blue;
            k9VehicleBlip.Flash(1000, 20000);
            k9SeatIndex = k9.SeatIndex;
            while (k9Vehicle.Speed != 0 && k9Vehicle.DistanceTo(Game.LocalPlayer.Character.Position) > 20f)
            {
                GameFiber.Yield();
            }
            GameFiber.Sleep(5000);
            dogHandler.Tasks.LeaveVehicle(LeaveVehicleFlags.None);
            k9.Tasks.LeaveVehicle(LeaveVehicleFlags.None).WaitForCompletion(6000);
            k9OutOfVehicle = k9.Position;
            dogHandler.Tasks.AchieveHeading(ExtensionMethods.CalculateHeadingTowardsEntity(dogHandler, suspectVehicle)).WaitForCompletion(1000);
            GameFiber.Wait(1000);
            k9VehicleBlip.Delete();
            inspectVehicle();
            dogHandler.Tasks.EnterVehicle(k9Vehicle, 5000, -1).WaitForCompletion();
            dogHandler.Dismiss();
            k9Vehicle.Dismiss();
        }
Пример #2
0
        private static void k9MainLogic()
        {
            suspectVehicle = Game.LocalPlayer.Character.IsInAnyVehicle(false) ? InCar() : OnFoot();
            if (!suspectVehicle.Exists())
            {
                Game.DisplaySubtitle("No vehicle detected."); return;
            }
            Zones.WorldDistricts currentdistrict = Zones.GetWorldDistrict(Game.LocalPlayer.Character.Position);
            if (currentdistrict == Zones.WorldDistricts.City)
            {
                k9VehicleModel  = cityK9VehicleModels.PickRandom();
                dogHandlerModel = cityHandlerModels.PickRandom();
            }
            else if (currentdistrict == Zones.WorldDistricts.BlaineCounty)
            {
                k9VehicleModel  = blaineK9VehicleModels.PickRandom();
                dogHandlerModel = blaineHandlerModels.PickRandom();
            }
            else if (currentdistrict == Zones.WorldDistricts.LosSantosCountryside)
            {
                k9VehicleModel  = lsCountyK9VehicleModels.PickRandom();
                dogHandlerModel = lsCountyHandlerModels.PickRandom();
            }

            SpawnPoint sp = SpawnPointExtensions.GetVehicleSpawnPointTowardsPositionWithChecks(suspectVehicle.Position, spawnDistance);

            k9Vehicle = new Vehicle(k9VehicleModel, sp.Position, sp.Heading);
            k9Vehicle.IsPersistent = true;

            dogHandler = new Ped(dogHandlerModel, Vector3.Zero, 0);
            dogHandler.MakeMissionPed();
            dogHandler.WarpIntoVehicle(k9Vehicle, -1);

            k9 = new Ped(k9Model, Vector3.Zero, 0);
            k9.MakeMissionPed();

            if (k9Vehicle.FreePassengerSeatsCount > 2 && k9Vehicle.GetFreeSeatIndex(1, 2) != null)
            {
                k9.WarpIntoVehicle(k9Vehicle, k9Vehicle.GetFreeSeatIndex(1, 2).GetValueOrDefault());
            }
            else
            {
                k9.WarpIntoVehicle(k9Vehicle, 0);
            }
            k9VehicleBlip       = k9Vehicle.AttachBlip();
            k9VehicleBlip.Color = System.Drawing.Color.Blue;
            k9VehicleBlip.Flash(1000, 20000);
            k9SeatIndex = k9.SeatIndex;
            driveToPosition(dogHandler, k9Vehicle, suspectVehicle.Position);
            dogHandler.Tasks.LeaveVehicle(LeaveVehicleFlags.None);
            k9.Tasks.LeaveVehicle(LeaveVehicleFlags.None).WaitForCompletion(6000);
            k9OutOfVehicle = k9.Position;

            dogHandler.Tasks.AchieveHeading(ExtensionMethods.CalculateHeadingTowardsEntity(dogHandler, suspectVehicle)).WaitForCompletion(1000);
            GameFiber.Wait(1000);
            k9VehicleBlip.Delete();
            inspectVehicle();
            dogHandler.Tasks.EnterVehicle(k9Vehicle, 5000, -1).WaitForCompletion();
            dogHandler.Dismiss();
            k9Vehicle.Dismiss();
        }