Example #1
0
        public override bool OnCalloutAccepted()
        {
            vehicle = new Vehicle(SpawnUtil.GetRandomCivilianCarModel(), SpawnPoint)
            {
                IsPersistent = true
            };

            driver = vehicle.CreateRandomDriver();
            driver.IsPersistent         = true;
            driver.BlockPermanentEvents = true;
            // Set the ped drunk
            NativeFunction.Natives.SET_PED_CONFIG_FLAG(driver, 100, true);

            driver.Tasks.CruiseWithVehicle(214f, VehicleDrivingFlags.DriveAroundVehicles | VehicleDrivingFlags.DriveAroundObjects | VehicleDrivingFlags.AllowWrongWay | VehicleDrivingFlags.AllowMedianCrossing |
                                           VehicleDrivingFlags.AvoidHighways | VehicleDrivingFlags.DriveAroundObjects);

            Blip        = driver.AttachBlip();
            Blip.Sprite = BlipSprite.Enemy;
            Blip.Scale  = 0.5f;
            Blip.SetColor(BlipColor.Red);
            Blip.SetRouteColor(BlipColor.LightRed);

            ScannerMessages.DisplayDispatchText("Driver Under The Influence", "Reports of a ~y~driver~w~ under the ~r~influence~w~. Test the driver for ~r~alcohol~w~ and ~r~narcotics.");

            return(base.OnCalloutAccepted());
        }
Example #2
0
 /// <summary>
 /// Reports Code 4 to the player, then ends the <see cref="Callout"/>.
 /// </summary>
 protected void EndSuccess()
 {
     terminated = false;
     Game.LogTrivial($"Rel.C: {Name} ending - successful");
     ScannerMessages.EndCall(Name);
     End();
 }
Example #3
0
        public override bool OnCalloutAccepted()
        {
            robber = new Ped(SpawnPoint.Around(0.8f))
            {
                IsPersistent         = true,
                BlockPermanentEvents = true
            };

            robber.Inventory.GiveNewWeapon(WeaponHash.Pistol, 40, true);

            victim = new Ped(SpawnPoint.Around(0.4f))
            {
                IsPersistent         = true,
                BlockPermanentEvents = true
            };

            Blip = new Blip(robber.Position.Around(30f), 80f)
            {
                Alpha          = 0.5f,
                IsRouteEnabled = true
            };
            Blip.SetColor(BlipColor.YellowDynamic);

            ScannerMessages.DisplayDispatchText("Mugging", "Find the ~r~robber ~w~and save the ~g~victim~w~ in the ~y~area~w~!");

            return(base.OnCalloutAccepted());
        }
        public override bool OnCalloutAccepted()
        {
            vehicle = new Vehicle(SpawnUtil.GetRandomEmergencyCarModel(), SpawnPoint);
            vehicle.IsPersistent = true;

            if (!vehicle) // vehicle fails to be created
            {
                Game.LogTrivial("Rel.C: Vehicle does not exists");
                return(false);
            }

            thief = new Ped(SpawnPoint.Around(1.5f))
            {
                IsPersistent         = true,
                BlockPermanentEvents = true
            };

            thief.WarpIntoVehicle(vehicle, -1);

            if (!thief)
            {
                Game.LogTrivial("Rel.C: Thief does not exists");
                return(false);
            }

            if (MathHelper.GetRandomInteger(5) != 3)
            {
                var window = vehicle.Windows[0];
                if (!vehicle.Exists())
                {
                    Game.LogTrivial("Rel.C: Vehicle does not exist when breaking the window");
                    return(false);
                }
                vehicle.IsStolen = true;
                window.Smash();
                ScannerMessages.DisplayDispatchText("Stolen Emergency Vehicle", "The vehicle was ~r~stolen~w~ from police station. Chase the suspect.");
            }
            else
            {
                thief.Inventory.GiveNewWeapon(WeaponHash.Pistol, 90, true);
                ScannerMessages.DisplayDispatchText("Stolen Emergency Vehicle", "The vehicle was ~r~hijacked~w~.");
                this.ResponseType = CalloutResponseType.Code99;
            }

            pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(pursuit, thief);
            Functions.SetPursuitAsCalledIn(pursuit);
            Functions.SetPursuitIsActiveForPlayer(pursuit, true);
            Functions.SetPursuitCopsCanJoin(pursuit, true);
            Functions.RequestBackup(thief.Position, EBackupResponseType.Pursuit, EBackupUnitType.LocalUnit);
            Functions.RequestBackup(thief.Position, EBackupResponseType.Pursuit, EBackupUnitType.LocalUnit);
            Functions.RequestBackup(thief.Position, EBackupResponseType.Pursuit, EBackupUnitType.LocalUnit);
            Functions.RequestBackup(thief.Position, EBackupResponseType.Pursuit, EBackupUnitType.AirUnit);

            return(base.OnCalloutAccepted());
        }
        public override bool OnCalloutAccepted()
        {
            suspect = new Ped(SpawnPoint.Around(0.5f, 0.8f))
            {
                BlockPermanentEvents = true,
                IsPersistent         = true
            };

            var chaser = Functions.RequestBackup(SpawnPoint, EBackupResponseType.Code3, EBackupUnitType.LocalUnit, string.Empty, true, false);

            if (chaser == null)
            {
                Game.LogTrivial("Rel.C: Failed to spawn cop");
                return(false);
            }

            chaser.IsPersistent = true;
            chaser.Position     = World.GetNextPositionOnStreet(SpawnPoint);

            var openDoor = MathHelper.GetRandomInteger(4) == 2;

            cop = chaser.Driver;
            cop.IsPersistent = true;
            cop.Tasks.LeaveVehicle(LeaveVehicleFlags.WarpOut);
            if (openDoor)
            {
                chaser.Doors[0].Open(true);
            }

            if (!chaser.IsSeatFree(0))
            {
                passenger = chaser.GetPedOnSeat(0);
                passenger.IsPersistent = true;
                passenger.Tasks.LeaveVehicle(LeaveVehicleFlags.WarpOut);
                if (openDoor)
                {
                    chaser.Doors[1].Open(true);
                }
            }

            pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(pursuit, suspect);
            Functions.AddCopToPursuit(pursuit, cop);
            if (passenger)
            {
                Functions.AddCopToPursuit(pursuit, passenger);
            }
            Functions.SetPursuitIsActiveForPlayer(pursuit, true);
            Functions.SetPursuitCopsCanJoin(pursuit, true);

            ScannerMessages.DisplayDispatchText("Foot Pursuit", "Get to the target and catch the suspect!");
            return(base.OnCalloutAccepted());
        }
Example #6
0
        public override bool OnCalloutAccepted()
        {
            var model = SpawnUtil.GetRandomCivilianCarModel();

            car = new Vehicle(model, SpawnPoint)
            {
                IsPersistent = true
            };

            car.Windows[0].Smash();                              // so it's stolen recently
            car.DirtLevel = MathHelper.GetRandomSingle(0f, 15f); // add some dirt
            car.IsStolen  = true;

            // Only if STP installed
            if (ExternManager.StopThePedInstalled && MathHelper.GetRandomInteger(0, 5) == 3)
            {
                StopThePedFunctions.SetVehicleHasNoRegistration(car);
            }

            thief = car.CreateRandomDriver();
            thief.IsPersistent         = true;
            thief.BlockPermanentEvents = true;

            if (MathHelper.GetRandomInteger(0, 4) == 2)
            {
                Functions.AddPedContraband(thief, ContrabandType.Misc, "Brick");
            }

            Blip        = car.AttachBlip();
            Blip.Sprite = BlipSprite.Enemy;
            Blip.Scale  = 0.5f;
            Blip.SetColor(BlipColor.Red);
            Blip.SetRouteColor(BlipColor.Red);
            Blip.IsRouteEnabled = true;

            var attribute = Functions.GetPedPursuitAttributes(thief);

            attribute.SurrenderChanceCarBadlyDamaged     = 20.5f;
            attribute.BurstTireMaxDrivingSpeedMult       = 0.30f;
            attribute.SurrenderChancePitted              = 34.2f;
            attribute.SurrenderChanceTireBurst           = 20.2f;
            attribute.SurrenderChanceTireBurstAndCrashed = 50.2f;
            attribute.SurrenderChancePittedAndCrashed    = 42.2f;

            Functions.SetPedResistanceChance(thief, 80f);
            thief.Tasks.CruiseWithVehicle(30f);

            ScannerMessages.DisplayDispatchText("Stolen Vehicle", "Track down the ~g~vehicle~w~ and arrest the ~r~suspect.");

            return(base.OnCalloutAccepted());
        }
        public bool PreFilterMessage(ref Message m)
        {
            ScannerMessages msg = scannerManager.PassMessage(ref m);

            if (msg == ScannerMessages.Undefined)
            {
                return(false);
            }

            switch (msg)
            {
            case ScannerMessages.FinishScanning:
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.FileName    = "Scan";
                sfd.Title       = "Save bitmap as...";
                sfd.Filter      = "Bitmap file (*.bmp)|*.bmp|TIFF file (*.tif)|*.tif|JPEG file (*.jpg)|*.jpg|PNG file (*.png)|*.png|GIF file (*.gif)|*.gif|All files (*.*)|*.*";
                sfd.FilterIndex = 1;
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    string[] savedFiles = scannerManager.SaveScanImages(sfd.FileName);
                    if (savedFiles.Length > 0)
                    {
                        files.AddRange(savedFiles);
                        if (imageIndex < 0)
                        {
                            pictureBox1.Image = Image.FromFile(files[0]);
                            imageIndex        = 0;
                        }
                    }
                }
                break;

            case ScannerMessages.CloseScannerOk:
                Application.RemoveMessageFilter(this);
                break;
            }
            return(true);
        }
Example #8
0
        public override bool OnCalloutAccepted()
        {
            ScannerMessages.DisplayResponseCode(ResponseType);

            return(base.OnCalloutAccepted());
        }