예제 #1
0
 public override void Process()
 {
     if (!_PursuitCreated && Game.LocalPlayer.Character.DistanceTo(_Suspect.Position) < 60f)
     {
         _Pursuit = Functions.CreatePursuit();
         Functions.AddPedToPursuit(_Pursuit, _Suspect);
         Functions.SetPursuitIsActiveForPlayer(_Pursuit, true);
         _PursuitCreated = true;
     }
     if (_PursuitCreated && !Functions.IsPursuitStillRunning(_Pursuit))
     {
         End();
     }
     if (Game.LocalPlayer.Character.IsDead)
     {
         End();
     }
     if (Game.IsKeyDown(Settings.EndCall))
     {
         End();
     }
     if (_Suspect.IsDead)
     {
         End();
     }
     if (Functions.IsPedArrested(_Suspect))
     {
         End();
     }
     base.Process();
 }
예제 #2
0
        public override bool OnCalloutAccepted()
        {
            Game.LogTrivial("UnitedCallouts Log: StolenEmergencyVehicle2 callout accepted.");

            _PoliceCar           = new Vehicle(copVehicles[new Random().Next((int)copVehicles.Length)], _SpawnPoint);
            _PoliceCar.IsSirenOn = true;

            Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~Dispatch", "Loading ~g~Information~w~ of the ~y~LSPD Database~w~...");
            Functions.DisplayVehicleRecord(_PoliceCar, true);

            _subject = new Ped(_SpawnPoint);
            _subject.WarpIntoVehicle(_PoliceCar, -1);
            _subject.Inventory.GiveNewWeapon("WEAPON_PISTOL", 500, true);
            _subject.BlockPermanentEvents = true;

            _Blip = _subject.AttachBlip();

            _pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(_pursuit, _subject);
            Functions.SetPursuitIsActiveForPlayer(_pursuit, true);
            _pursuitCreated = true;

            if (Settings.ActivateAIBackup)
            {
                Functions.RequestBackup(_SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                Functions.RequestBackup(_SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                Functions.RequestBackup(_SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit);
            }
            return(base.OnCalloutAccepted());
        }
예제 #3
0
        public override bool OnCalloutAccepted()
        {
            base.OnCalloutAccepted();

            this.pursuit = Functions.CreatePursuit();
            Functions.SetPursuitCopsCanJoin(this.pursuit, false);
            Functions.SetPursuitDontEnableCopBlips(this.pursuit, true);

            this.blip             = Functions.CreateBlipForArea(this.spawnPosition, 20f);
            this.blip.Display     = BlipDisplay.ArrowAndMap;
            this.blip.RouteActive = true;

            this.vehicle1 = new LVehicle(World.GetNextPositionOnStreet(this.spawnPosition), Common.GetRandomCollectionValue <string>(this.vehicleModels));
            if (this.vehicle1.Exists())
            {
                // Ensure vehicle is freed on end
                Functions.AddToScriptDeletionList(this.vehicle1, this);
                this.vehicle1.PlaceOnNextStreetProperly();
                this.vehicle1.AttachBlip();
                this.vehicle1.EngineHealth = 50;
                driver = this.vehicle1.CreatePedOnSeat(VehicleSeat.Driver);
                Functions.SetPedIsOwnedByScript(driver, this, true);
                DelayedCaller.Call(delegate
                {
                    driver.Task.CruiseWithVehicle(vehicle1, 20, true);
                }, this, 1000);
                DelayedCaller.Call(delegate
                {
                    this.vehicle1.HazardLightsOn = true;
                    this.vehicle1.EngineHealth   = 0;
                }, this, 4000);
                Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000);
            }
            return(true);
        }
예제 #4
0
 public override void Process()
 {
     if (_Truck.DistanceTo(Game.LocalPlayer.Character) < 20f && !_notificationDisplayed)
     {
         Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~DutchCallouts", "~y~Meldkamer", " ~g~Informatie~w~ laden uit de ~y~LSPD Database~w~...");
         GameFiber.Wait(1000);
         Functions.DisplayVehicleRecord(_Truck, true);
         _notificationDisplayed = true;
     }
     if (!_PursuitCreated && Game.LocalPlayer.Character.DistanceTo(_Suspect.Position) < 30f)
     {
         _Pursuit = Functions.CreatePursuit();
         Functions.AddPedToPursuit(_Pursuit, _Suspect);
         Functions.SetPursuitIsActiveForPlayer(_Pursuit, true);
         _PursuitCreated = true;
     }
     if (_PursuitCreated && !Functions.IsPursuitStillRunning(_Pursuit))
     {
         End();
     }
     if (Game.LocalPlayer.Character.IsDead) End();
     if (Game.IsKeyDown(Settings.EndCall)) End();
     if (_Suspect.IsDead) End();
     if (Functions.IsPedArrested(_Suspect)) End();
     base.Process();
 }
예제 #5
0
        private void PlayerSearching()
        {
            if (LastKnownBlip.Exists() && LPlayer.LocalPlayer.Ped.Position.DistanceTo(LastKnownBlip.Position) < 50f)
            {
                //LastKnownBlip.Display = BlipDisplay.Hidden;
                LastKnownBlip.Delete();
            }
            //Has the player spotted the suspect (in front is set to false meaning position can be anywhere)
            if (LPlayer.LocalPlayer.Ped.HasSpottedPed(suspect, false))
            {
                pursuit = Functions.CreatePursuit();
                suspect.AttachBlip().Color = BlipColor.Red;
                Functions.AddTextToTextwall("Control I've located the suspect, in pursuit.", "Officer " + LPlayer.LocalPlayer.Username);
                Functions.AddPedToPursuit(pursuit, suspect);
                Functions.SetPursuitCalledIn(pursuit, true);

                Functions.SetPursuitCopsCanJoin(pursuit, true);
                Functions.SetPursuitIsActiveForPlayer(pursuit, true);
                State = EPedState.None;
            }

            if (LPlayer.LocalPlayer.Ped.Position.DistanceTo(getawayCar.Position) > 600f)
            {
                Functions.AddTextToTextwall("Control, suspect was never found, resuming patrol.", "Officer " + LPlayer.LocalPlayer.Username);
                Functions.AddTextToTextwall("Affirmative, we'll send details to ANPR database.", "CONTROL");
                End();
            }
        }
예제 #6
0
        public override bool OnCalloutAccepted()
        {
            try
            {
                // Attach the blips
                B1 = A1.AttachBlip();
                B2 = C1.AttachBlip();

                B2.Color = Color.Blue;

                A1.BlockPermanentEvents = true;
                C1.BlockPermanentEvents = true;

                // Shows the player to respond to the scene.
                Game.DisplaySubtitle("Get to the ~r~pursuit~w~.", 6500);
                B1.EnableRoute(Color.Red);

                // Create the pursuit and add the peds to the pursuit
                pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(pursuit, A1);
                Functions.AddCopToPursuit(pursuit, C1);

                // Request backup
                Functions.RequestBackup(spawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
            }
            catch (System.Exception ex)
            {
                Game.LogTrivial("Error is: " + ex);
            }

            return(base.OnCalloutAccepted());
        }
예제 #7
0
        private void PreparationSequence()
        {
            if (ZoneBlip.Exists())
            {
                ZoneBlip.Delete();
            }
            SpawnSequenceInitiated = true;
            Game.SetRelationshipBetweenRelationshipGroups(RelationshipGroup.Cop, RelationshipGroup.Gang1, Relationship.Hate);
            Game.SetRelationshipBetweenRelationshipGroups(RelationshipGroup.Gang1, RelationshipGroup.Cop, Relationship.Hate);
            Game.SetRelationshipBetweenRelationshipGroups(RelationshipGroup.Gang1, RelationshipGroup.Player, Relationship.Hate);
            Game.SetRelationshipBetweenRelationshipGroups(RelationshipGroup.Player, RelationshipGroup.Gang1, Relationship.Hate);

            TargetFlees = Rdm.NextDouble() < 0.5f;
            if (!TargetFlees)
            {
                AlienBlip            = Alien.AttachBlip();
                AlienBlip.IsFriendly = false;
                AlienBlip.Name       = "Fake Alien";
                AlienBlip.Scale      = 0.75f;
                Alien.Tasks.FightAgainst(Game.LocalPlayer.Character);
            }
            else
            {
                if (Functions.GetActivePursuit() != null)
                {
                    Functions.ForceEndPursuit(Functions.GetActivePursuit());
                }
                Pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(Pursuit, Alien);
                Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
            }
        }
예제 #8
0
        public override bool OnCalloutAccepted()
        {
            int r = new Random().Next(1, 3);

            // Create the pursuit and add the peds to the pursuit
            pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(pursuit, A1);
            Functions.AddPedToPursuit(pursuit, A2);

            // Attach the blips
            B1 = A1.AttachBlip();
            B2 = A2.AttachBlip();

            if (r == 1)
            {
                // Make the peds attack the player
                //A2.Tasks.FightAgainstClosestHatedTarget(500f);
                NativeFunction.CallByName <uint>("TASK_COMBAT_PED", A2, Game.LocalPlayer.Character, 0, 1);
            }

            // Request backup
            Functions.RequestBackup(vehicleSpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit);
            Functions.RequestBackup(vehicleSpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);


            // Shows the player to respond to the scene.
            Game.DisplaySubtitle("Get to the ~r~pursuit~w~.", 6500);

            return(base.OnCalloutAccepted());
        }
예제 #9
0
 public override void Process()
 {
     GameFiber.StartNew(delegate
     {
         if (_Dealer.DistanceTo(Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront)) < 75f && !_isArmed)
         {
             _Dealer.Face(_Victim);
             _Victim.Face(_Dealer);
             _Dealer.Inventory.GiveNewWeapon(new WeaponAsset(wepList[new Random().Next((int)wepList.Length)]), 500, true);
             _isArmed = true;
         }
         if (_Dealer.DistanceTo(Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront)) < 60f && !_hasBegunAttacking)
         {
             if (_scenario > 40)
             {
                 new RelationshipGroup("AG");
                 new RelationshipGroup("VI");
                 _Dealer.RelationshipGroup = "AG";
                 _Victim.RelationshipGroup = "AG";
                 Game.LocalPlayer.Character.RelationshipGroup = "VI";
                 Game.SetRelationshipBetweenRelationshipGroups("AG", "VI", Relationship.Hate);
                 _Dealer.Tasks.FightAgainst(Game.LocalPlayer.Character);
                 Game.DisplayNotification("Arresteer de ~o~koper~w~!");
                 _Victim.Tasks.PutHandsUp(-1, Game.LocalPlayer.Character);
                 _hasBegunAttacking = true;
                 GameFiber.Wait(2000);
             }
             else
             {
                 if (!_hasPursuitBegun)
                 {
                     _pursuit = Functions.CreatePursuit();
                     Functions.AddPedToPursuit(_pursuit, _Dealer);
                     Functions.AddPedToPursuit(_pursuit, _Victim);
                     Functions.SetPursuitIsActiveForPlayer(_pursuit, true);
                     _hasPursuitBegun = true;
                 }
             }
         }
         if (Game.LocalPlayer.Character.IsDead)
         {
             End();
         }
         if (Game.IsKeyDown(Settings.EndCall))
         {
             End();
         }
         if (_Dealer.IsDead && _Victim.IsDead)
         {
             End();
         }
         if (Functions.IsPedArrested(_Dealer) && Functions.IsPedArrested(_Victim))
         {
             End();
         }
     }, "Drug [DutchCallouts]");
     base.Process();
 }
예제 #10
0
        /// <summary>
        /// OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from eariler to the pursuit as well
        /// </summary>
        /// <returns></returns>
        public override bool OnCalloutAccepted()
        {
            //We accepted the callout, so lets initilize our blip from before and attach it to our ped so we know where he is.
            myBlip = myPed.AttachBlip();
            this.pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(this.pursuit, this.myPed);

            return base.OnCalloutAccepted();
        }
예제 #11
0
        /// <summary>
        /// OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from eariler to the pursuit as well
        /// </summary>
        /// <returns></returns>
        public override bool OnCalloutAccepted()
        {
            //We accepted the callout, so lets initilize our blip from before and attach it to our ped so we know where he is.
            myBlip       = myPed.AttachBlip();
            this.pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(this.pursuit, this.myPed);

            return(base.OnCalloutAccepted());
        }
예제 #12
0
        public void StartMurderScenario()
        {
            GameFiber.StartNew(delegate
            {
                this.pursuit = Functions.CreatePursuit();

                int r = new Random().Next(1, 5);
                int t = new Random().Next(1, 3);

                state = EMurderState.DecisionMade;

                if (r == 1)
                {
                    NativeFunction.CallByName <uint>("TASK_COMBAT_PED", Aggressor, Victim, 0, 1);
                    NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor);

                    GameFiber.Sleep(5000);

                    NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor);

                    if (t == 1)
                    {
                        NativeFunction.CallByName <uint>("TASK_COMBAT_PED", Aggressor, Game.LocalPlayer.Character, 0, 1);

                        GameFiber.Sleep(4500);
                    }

                    if (t == 2)
                    {
                        Victim.Kill();

                        if (!Victim.IsAlive)
                        {
                            isDead = true;
                        }

                        if (isDead == true)
                        {
                            NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", Aggressor, Victim, -1, true);
                        }
                    }
                }
                else
                {
                    NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor);
                }

                if (Aggressor.Exists())
                {
                    Aggressor.Dismiss();
                }

                Functions.AddPedToPursuit(this.pursuit, Aggressor);

                Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
            });
        }
예제 #13
0
        public override bool OnCalloutAccepted()
        {
            base.OnCalloutAccepted();

            this.pursuit = Functions.CreatePursuit();
            Functions.SetPursuitCopsCanJoin(this.pursuit, false);
            Functions.SetPursuitDontEnableCopBlips(this.pursuit, true);

            this.blip             = Functions.CreateBlipForArea(this.spawnPoint.Position, 20f);
            this.blip.Display     = BlipDisplay.ArrowAndMap;
            this.blip.RouteActive = true;

            this.victim = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.criminalModels), LPed.EPedGroup.MissionPed);
            if (victim.Exists())
            {
                if (victim.EnsurePedIsNotInBuilding(victim.Position))
                {
                    Functions.AddToScriptDeletionList(victim, this);
                    Functions.SetPedIsOwnedByScript(victim, this, true);
                    Functions.AddPedToPursuit(this.pursuit, victim);
                    //this.victim.Die();

                    this.victim.AttachBlip();
                    int random = Common.GetRandomValue(0, 100);
                    if (random <= 14)
                    {
                        this.victim.Health = 10;
                        //victim.FreezePosition = true;
                        //victim.ForceRagdoll(-1, false);
                        victim.Die();

                        victim.Task.AlwaysKeepTask = true;
                        this.victim.HasBeenDamagedBy(Weapon.Melee_Knife);
                        alive = true;
                    }
                    else
                    {
                        //this.victim.Health = 0;
                        this.victim.HasBeenDamagedBy(Weapon.Melee_Knife);
                        this.victim.Die();
                        alive = false;
                    }
                }
                else
                {
                    Log.Debug("OnCalloutAccepted: Failed to place ped properly outside of building", this);
                    victim.Delete();
                }
            }
            this.RegisterStateCallback(EPedState.WaitingForPlayer, this.WaitingForPlayer);
            this.RegisterStateCallback(EPedState.PlayerIsClose, this.PlayerIsClose);
            this.RegisterStateCallback(EPedState.PlayerOnScene, this.PlayerOnScene);
            this.RegisterStateCallback(EPedState.None, this.CalloutOver);
            this.State = EPedState.WaitingForPlayer;
            Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000);
            return(true);
        }
예제 #14
0
        public LHandle Function(bool activeForPlayer, Ped p)
        {
            Game.DisplaySubtitle(Context);
            LHandle result = Functions.CreatePursuit();

            Functions.AddPedToPursuit(result, p);
            Functions.SetPursuitIsActiveForPlayer(result, activeForPlayer);
            return(result);
        }
        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());
        }
예제 #16
0
 private static void EventsOnOnCalloutAccepted(LHandle handle)
 {
     if (!Globals.Config.AutoChangeAvailability)
     {
         return;
     }
     Functions.SetPlayerAvailableForCalls(false);
     Logger.DebugLog("Player accepted callout and AutoChangeAvailability is set to " +
                     Globals.Config.AutoChangeAvailability + ", setting player to unavailable");
 }
예제 #17
0
        public override void OnArrivalAtScene()
        {
            base.OnArrivalAtScene();

            Suspect mySuspect = (Suspect)GetPed("Suspect1");

            if (mySuspect != null && mySuspect.Exists())
            {
                pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(pursuit, mySuspect);
            }
        }
예제 #18
0
        // OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from earlier to the pursuit as well
        public override bool OnCalloutAccepted()
        {
            // We accepted the callout, so lets initialize our blip from before and attach it to our ped so we know where he is.
            myBlip = myPed.AttachBlip();

            Game.DisplaySubtitle("Get to the ~r~scene~w~.", 6500);
            this.pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(this.pursuit, this.myPed);
            Functions.RequestBackup(SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);

            return(base.OnCalloutAccepted());
        }
예제 #19
0
 public override void Process()
 {
     GameFiber.StartNew(delegate
     {
         if (_subject.DistanceTo(Game.LocalPlayer.Character) < 20f)
         {
             if (_IsStolen == true && _startedPursuit == false)
             {
                 if (_Blip.Exists())
                 {
                     _Blip.Delete();
                 }
                 _pursuit = Functions.CreatePursuit();
                 Functions.AddPedToPursuit(_pursuit, _subject);
                 Functions.SetPursuitIsActiveForPlayer(_pursuit, true);
                 _startedPursuit = true;
                 _Bike.IsStolen  = true;
                 Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~DutchCallouts Computer", "~y~Meldkamer Informatie", "De ~g~fiets~w~ van de verdachte is een ~o~" + _Bike.Model.Name + "~w~. De ~g~fiets~w~ is ~r~gestolen~w~!");
                 GameFiber.Wait(2000);
             }
             if (_subject.DistanceTo(Game.LocalPlayer.Character) < 25f && Game.LocalPlayer.Character.IsOnFoot && _alreadySubtitleIntrod == false && _pursuit == null)
             {
                 Game.DisplayNotification("Doe een normale aanhouding van de ~o~verdachte~w~.");
                 Game.DisplayNotification("~b~Meldkamer:~w~ Serienummer controleren.....");
                 GameFiber.Wait(600);
                 Game.DisplayNotification("~b~Meldkamer:~w~ We hebben het serienummer van de fiets nagetrokken.<br>Model: ~o~" + _Bike.Model.Name + "<br>~w~Serienummer: ~o~" + _Bike.LicensePlate + "");
                 _alreadySubtitleIntrod = true;
                 return;
             }
         }
         if (_subject.Exists() && Functions.IsPedArrested(_subject) && _IsStolen && _subject.DistanceTo(Game.LocalPlayer.Character) < 15f)
         {
             Game.DisplaySubtitle("~y~Verdachte: ~w~Laat me alsjeblieft gaan! ik breng de fiets direct terug!", 4000);
         }
         if (Game.LocalPlayer.Character.IsDead)
         {
             End();
         }
         if (Game.IsKeyDown(Settings.EndCall))
         {
             End();
         }
         if (_subject.IsDead)
         {
             End();
         }
         if (Functions.IsPedArrested(_subject))
         {
             End();
         }
     }, "FietserSW [DutchCallouts]");
     base.Process();
 }
예제 #20
0
        public override void OnArrivalAtScene()
        {
            base.OnArrivalAtScene();

            Suspect mySuspect = (Suspect)GetPed("Suspect1");

            if (mySuspect != null && mySuspect.Exists())
            {
                pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(pursuit, mySuspect);
            }
        }
예제 #21
0
        private void StartPursuit()
        {
            if (!PursuitStarted)
            {
                Game.SetRelationshipBetweenRelationshipGroups("COP", "CRIMINAL", Relationship.Hate);
                Game.SetRelationshipBetweenRelationshipGroups("CRIMINAL", "COP", Relationship.Hate);
                Game.SetRelationshipBetweenRelationshipGroups("CRIMINAL", "PLAYER", Relationship.Hate);
                Game.SetRelationshipBetweenRelationshipGroups("PLAYER", "CRIMINAL", Relationship.Hate);

                if (Functions.GetActivePursuit() != null)
                {
                    Functions.ForceEndPursuit(Functions.GetActivePursuit());
                }
                Pursuit = Functions.CreatePursuit();

                if (CVDriver.Exists() && !CVDriver.IsDead)
                {
                    CVDriver.Tasks.Clear();
                    Functions.AddPedToPursuit(Pursuit, CVDriver);
                }

                if (FVDriver.Exists() && !FVDriver.IsDead)
                {
                    FVDriver.Tasks.Clear();
                    FVDBlip            = FVDriver.AttachBlip();
                    FVDBlip.IsFriendly = false;
                    FVDBlip.Scale      = 0.75f;
                    FVDriver.Tasks.FightAgainst(Game.LocalPlayer.Character);
                }

                if (FVBrute.Exists() && !FVBrute.IsDead)
                {
                    FVBBlip            = FVBrute.AttachBlip();
                    FVBBlip.IsFriendly = false;
                    FVBBlip.Scale      = 0.75f;
                    FVBrute.Tasks.FightAgainst(Game.LocalPlayer.Character);
                }

                if (Criminal.Exists() && !Criminal.IsDead)
                {
                    Functions.AddPedToPursuit(Pursuit, Criminal);
                }

                if (CriminalBlip.Exists())
                {
                    CriminalBlip.Delete();
                }

                Functions.SetPursuitIsActiveForPlayer(Pursuit, true);

                PursuitStarted = true;
            }
        }
예제 #22
0
 public override void Process()
 {
     GameFiber.StartNew(delegate
     {
         if (_subject.DistanceTo(Game.LocalPlayer.Character) < 20f)
         {
             if (_IsStolen == true && _startedPursuit == false)
             {
                 if (_Blip)
                 {
                     _Blip.Delete();
                 }
                 _pursuit = Functions.CreatePursuit();
                 Functions.AddPedToPursuit(_pursuit, _subject);
                 Functions.SetPursuitIsActiveForPlayer(_pursuit, true);
                 _startedPursuit = true;
                 _Bike.IsStolen  = true;
                 Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~Dispatch Information", "The ~g~bicycle~w~ from the suspect is a ~o~" + _Bike.Model.Name + "~w~. The ~g~bicycle~w~ was ~r~stolen~w~.");
                 GameFiber.Wait(2000);
             }
             if (_subject.DistanceTo(Game.LocalPlayer.Character) < 25f && Game.LocalPlayer.Character.IsOnFoot && _alreadySubtitleIntrod == false && _pursuit == null)
             {
                 Game.DisplayNotification("Perform a normal traffic stop with the ~o~suspect~w~.");
                 Game.DisplayNotification("~b~Dispatch:~w~ Checking the serial number of the bike...");
                 GameFiber.Wait(2000);
                 Game.DisplayNotification("~b~Dispatch~w~ We checked the serial number of the bike.<br>Model: ~o~" + _Bike.Model.Name + "<br>~w~Serial number: ~o~" + _Bike.LicensePlate);
                 _alreadySubtitleIntrod = true;
                 return;
             }
         }
         if (_subject && Functions.IsPedArrested(_subject) && _IsStolen && _subject.DistanceTo(Game.LocalPlayer.Character) < 15f)
         {
             Game.DisplaySubtitle("~y~Suspect: ~w~Please let me go! I bring the bike back.", 4000);
         }
         if (Game.LocalPlayer.Character.IsDead)
         {
             End();
         }
         if (Game.IsKeyDown(Settings.EndCall))
         {
             End();
         }
         if (_subject && _subject.IsDead)
         {
             End();
         }
         if (_subject && Functions.IsPedArrested(_subject))
         {
             End();
         }
     }, "Bicycle on the Freeway [UnitedCallouts]");
     base.Process();
 }
예제 #23
0
        public override bool OnCalloutAccepted()
        {
            try
            {
                // Show the player to respond
                Game.DisplaySubtitle("~Get to the ~r~pursuit~w~.", 6500);
            }
            catch (System.Exception ex)
            {
                Game.LogVerbose("An error occurred when trying to display the text. Error is: " + ex);
            }

            // Create the pursuit
            pursuit = Functions.CreatePursuit();

            // Add our peds to the pursuits
            Functions.AddPedToPursuit(pursuit, Aggressor1);
            Functions.AddPedToPursuit(pursuit, Aggressor2);
            if (Aggressor3.Exists())
            {
                Functions.AddPedToPursuit(pursuit, Aggressor3);
            }
            if (Aggressor4.Exists())
            {
                Functions.AddPedToPursuit(pursuit, Aggressor4);
            }

            // Add blips to our peds
            ABlip1 = Aggressor1.AttachBlip();
            ABlip2 = Aggressor2.AttachBlip();
            if (Aggressor3.Exists())
            {
                ABlip3 = Aggressor3.AttachBlip();
            }
            if (Aggressor4.Exists())
            {
                ABlip4 = Aggressor4.AttachBlip();
            }

            if (Aggressor3.Exists() && Aggressor4.Exists())
            {
                // Make the peds attack the player
                NativeFunction.CallByName <uint>("TASK_COMBAT_PED", Aggressor3, Game.LocalPlayer.Character, 0, 1);
                NativeFunction.CallByName <uint>("TASK_COMBAT_PED", Aggressor4, Game.LocalPlayer.Character, 0, 1);
                //Aggressor3.Tasks.FightAgainstClosestHatedTarget(500f);
                //Aggressor4.Tasks.FightAgainstClosestHatedTarget(500f);
            }

            // Request a NOOSE unit
            Functions.RequestBackup(vehicleSpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.SwatTeam);

            return(base.OnCalloutAccepted());
        }
예제 #24
0
        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());
        }
예제 #25
0
 public override void Process()
 {
     GameFiber.StartNew(delegate
     {
         if (_subject.DistanceTo(Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront)) < 25f && !_isArmed)
         {
             _subject.Inventory.GiveNewWeapon(new WeaponAsset(wepList[new Random().Next((int)wepList.Length)]), 500, true);
             _isArmed = true;
         }
         if (_subject.Exists() && _subject.DistanceTo(Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront)) < 25f && !_hasBegunAttacking)
         {
             if (_scenario > 40)
             {
                 _subject.KeepTasks = true;
                 _subject.Tasks.FightAgainst(Game.LocalPlayer.Character);
                 _hasBegunAttacking = true;
                 GameFiber.Wait(2000);
             }
             else
             {
                 if (!_hasPursuitBegun)
                 {
                     if (_Blip.Exists())
                     {
                         _Blip.Delete();
                     }
                     _pursuit = Functions.CreatePursuit();
                     Functions.AddPedToPursuit(_pursuit, _subject);
                     Functions.SetPursuitIsActiveForPlayer(_pursuit, true);
                     _hasPursuitBegun = true;
                 }
             }
         }
         if (Game.LocalPlayer.Character.IsDead)
         {
             End();
         }
         if (Game.IsKeyDown(Settings.EndCall))
         {
             End();
         }
         if (_subject.IsDead)
         {
             End();
         }
         if (Functions.IsPedArrested(_subject))
         {
             End();
         }
     }, "KillerClown was seen [UnitedCallouts]");
     base.Process();
 }
예제 #26
0
 public override void Process()
 {
     GameFiber.StartNew(delegate
     {
         if (_A1.DistanceTo(Game.LocalPlayer.Character) < 25f)
         {
             if (_Scene1 == true && !_hasBegunAttacking)
             {
                 _A1.Tasks.FightAgainstClosestHatedTarget(1000f);
                 _A2.Tasks.FightAgainstClosestHatedTarget(1000f);
                 _A1.Tasks.FightAgainst(Game.LocalPlayer.Character);
                 _A2.Tasks.FightAgainst(Game.LocalPlayer.Character);
                 GameFiber.Wait(2000);
                 _hasBegunAttacking = true;
             }
             else if (_Scene2 == true && !_notificationDisplayed && !_check)
             {
                 _A1.Tasks.FightAgainstClosestHatedTarget(1000f);
                 _A2.Tasks.FightAgainstClosestHatedTarget(1000f);
                 _A1.Tasks.FightAgainst(Game.LocalPlayer.Character);
                 _A2.Tasks.FightAgainst(Game.LocalPlayer.Character);
                 GameFiber.Wait(2000);
                 _hasBegunAttacking = true;
             }
             else if (_Scene3 == true && !_pursuitCreated)
             {
                 _pursuit = Functions.CreatePursuit();
                 Functions.AddPedToPursuit(_pursuit, _A1);
                 Functions.AddPedToPursuit(_pursuit, _A2);
                 Functions.SetPursuitIsActiveForPlayer(_pursuit, true);
                 _pursuitCreated = true;
             }
         }
         if (_A1 && _A1.IsDead && _A2 && _A2.IsDead)
         {
             End();
         }
         if (_A1 && Functions.IsPedArrested(_A1) && _A2 && Functions.IsPedArrested(_A2))
         {
             End();
         }
         if (Game.LocalPlayer.Character.IsDead)
         {
             End();
         }
         if (Game.IsKeyDown(Settings.EndCall))
         {
             End();
         }
     }, "Store Robbery [UnitedCallouts]");
     base.Process();
 }
예제 #27
0
        public override bool OnCalloutAccepted()
        {
            myBlip = myPed.AttachBlip();

            string myPedsGun = pedsGun[myRand.Next(pedsGun.Length)];

            myPed.Inventory.GiveNewWeapon(myPedsGun, 100, true);

            this.pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(this.pursuit, myPed);

            return(base.OnCalloutAccepted());
        }
        public override bool OnCalloutAccepted()
        {
            this.pursuit = Functions.CreatePursuit();

            foreach (Ped peds2 in pedsList)
            {
                Functions.AddPedToPursuit(this.pursuit, peds2);
            }

            Functions.RequestBackup(player.Position.Around(25f), LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);

            return(base.OnCalloutAccepted());
        }
예제 #29
0
        // OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from earlier to the pursuit as well
        public override bool OnCalloutAccepted()
        {
            // We accepted the callout, so lets initialize our blip from before and attach it to our ped so we know where he is.
            ABlip        = Aggressor.AttachBlip();
            this.pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(this.pursuit, this.Aggressor);
            Functions.RequestBackup(SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
            Functions.RequestBackup(SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
            Functions.RequestBackup(SpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit);


            return(base.OnCalloutAccepted());
        }
예제 #30
0
        public void StartMurderScenario()
        {
            GameFiber.StartNew(delegate
            {
                this.pursuit = Functions.CreatePursuit();

                int r = new Random().Next(1, 5);
                int t = new Random().Next(1, 3);

                if (r == 1)
                {
                    NativeFunction.CallByName <uint>("TASK_COMBAT_PED", Attacker, myPed2, 0, 1);
                    NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", myPed2, Attacker);

                    GameFiber.Sleep(5000);

                    NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", myPed2, Attacker);

                    if (t == 1)
                    {
                        NativeFunction.CallByName <uint>("TASK_COMBAT_PED", Attacker, Game.LocalPlayer.Character, 0, 1);

                        GameFiber.Sleep(4500);
                    }

                    if (t == 2)
                    {
                        myPed2.Kill();

                        if (!myPed2.IsAlive)
                        {
                            isDead = true;
                        }

                        if (isDead == true)
                        {
                            NativeFunction.CallByName <uint>("TASK_AIM_GUN_AT_ENTITY", Attacker, myPed2, -1, true);
                        }
                    }
                }
                else
                {
                    NativeFunction.CallByName <uint>("TASK_REACT_AND_FLEE_PED", myPed2, Attacker);
                }

                if (Attacker.Exists())
                {
                    Attacker.Dismiss();
                }
            });
        }
예제 #31
0
        public override bool OnCalloutAccepted()
        {
            Game.LogTrivial("UnitedCallouts Log: MoneyTruckIsRobbed callout accepted.");
            Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~MoneyTruck is robbed", "~b~Dispatch: ~w~Get the MoneyTruck back. Respond with ~r~Code3");

            _stockade   = new Vehicle("STOCKADE", _vehicleSpawnPoint);
            _Aggressor1 = new Ped("g_m_m_chemwork_01", _SpawnPoint, 0f);
            _Aggressor2 = new Ped("g_m_m_chemwork_01", _SpawnPoint, 0f);
            _Aggressor3 = new Ped("g_m_m_chemwork_01", _SpawnPoint, 0f);
            _Aggressor4 = new Ped("g_m_m_chemwork_01", _SpawnPoint, 0f);
            _Aggressor1.WarpIntoVehicle(_stockade, -1);
            _Aggressor2.WarpIntoVehicle(_stockade, -2);
            _Aggressor3.WarpIntoVehicle(_stockade, 1);
            _Aggressor4.WarpIntoVehicle(_stockade, 2);
            _Aggressor1.Inventory.GiveNewWeapon("WEAPON_CARBINERIFLE", 5000, true);
            _Aggressor2.Inventory.GiveNewWeapon("WEAPON_CARBINERIFLE", 5000, true);
            _Aggressor3.Inventory.GiveNewWeapon("WEAPON_CARBINERIFLE", 5000, true);
            _Aggressor4.Inventory.GiveNewWeapon("WEAPON_CARBINERIFLE", 5000, true);
            _Aggressor1.Armor = 100;
            _Aggressor2.Armor = 100;
            _Aggressor3.Armor = 100;
            _Aggressor4.Armor = 100;

            _Pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(_Pursuit, _Aggressor1);
            Functions.AddPedToPursuit(_Pursuit, _Aggressor2);
            Functions.AddPedToPursuit(_Pursuit, _Aggressor3);
            Functions.AddPedToPursuit(_Pursuit, _Aggressor4);
            Functions.SetPursuitIsActiveForPlayer(_Pursuit, true);
            _PursuitCreated = true;

            _Blip1 = _Aggressor1.AttachBlip();
            _Blip2 = _Aggressor2.AttachBlip();
            _Blip3 = _Aggressor3.AttachBlip();
            _Blip4 = _Aggressor4.AttachBlip();

            NativeFunction.CallByName <uint>("TASK_COMBAT_PED", _Aggressor1, Game.LocalPlayer.Character, 0, 1);
            NativeFunction.CallByName <uint>("TASK_COMBAT_PED", _Aggressor2, Game.LocalPlayer.Character, 0, 1);
            NativeFunction.CallByName <uint>("TASK_COMBAT_PED", _Aggressor3, Game.LocalPlayer.Character, 0, 1);
            NativeFunction.CallByName <uint>("TASK_COMBAT_PED", _Aggressor4, Game.LocalPlayer.Character, 0, 1);

            _Aggressor1.Tasks.FightAgainst(Game.LocalPlayer.Character);
            _Aggressor2.Tasks.FightAgainst(Game.LocalPlayer.Character);
            _Aggressor3.Tasks.FightAgainst(Game.LocalPlayer.Character);
            _Aggressor4.Tasks.FightAgainst(Game.LocalPlayer.Character);

            Functions.RequestBackup(_vehicleSpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.SwatTeam);
            Functions.RequestBackup(_vehicleSpawnPoint, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit);
            return(base.OnCalloutAccepted());
        }
예제 #32
0
        public override bool OnCalloutAccepted()
        {
            base.OnCalloutAccepted();

            this.pursuit = Functions.CreatePursuit();

            this.suspect = new LPed(World.GetNextPositionOnStreet(this.spawnPosition), Common.GetRandomCollectionValue <string>(this.criminalModels), LPed.EPedGroup.Criminal);

            this.suspect.BlockPermanentEvents = true;
            this.suspect.Task.AlwaysKeepTask  = true;

            Functions.AddToScriptDeletionList(this.suspect, this);
            Functions.AddPedToPursuit(this.pursuit, this.suspect);

            if (!Functions.DoesPedHaveAnOwner(this.suspect))
            {
                Functions.SetPedIsOwnedByScript(this.suspect, this, true);
            }

            if (this.calloutType == ECalloutType.FootChase)
            {
                Functions.SetPursuitCalledIn(this.pursuit, true);
                Functions.SetPursuitIsActiveForPlayer(this.pursuit, true);
                Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_ROBBERY_CATCH_UP"), 25000);

                this.suspect.WantedByPolice = true;

                LPed cop = new LPed(this.spawnPosition, "M_Y_COP");
                Functions.AddToScriptDeletionList(cop, this);

                if (cop.Exists())
                {
                    cop.Task.AimAt(suspect, 4000);
                    cop.Task.AlwaysKeepTask = true;
                }
                //Functions.RequestPoliceBackupAtPosition(this.suspect.Position);
            }
            else
            {
                Functions.SetPursuitCalledIn(this.pursuit, true);
                Functions.SetPursuitIsActiveForPlayer(this.pursuit, true);
                Functions.RequestPoliceBackupAtPosition(this.spawnPosition);
                this.suspect.DeleteBlip();
                this.suspect.WantedByPolice       = true;
                this.suspect.RangeToDetectEnemies = 10f;
                this.suspect.EquipWeapon();
            }

            return(true);
        }
예제 #33
0
        public override void Process()
        {
            base.Process();
            if (!PursuitCreated && Game.LocalPlayer.Character.DistanceTo(Suspect.Position) < 30f)
            {
                Pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(Pursuit, Suspect);
                Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
                PursuitCreated = true;
            }

            if (PursuitCreated && !Functions.IsPursuitStillRunning(Pursuit))
            {
                End();
            }
        }
예제 #34
0
        /// <summary>
        /// Called when the callout has been accepted. Call base to set state to Running.
        /// </summary>
        /// <returns>
        /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed.
        /// </returns>
        public override bool OnCalloutAccepted()
        {
            base.OnCalloutAccepted();

            this.pursuit = Functions.CreatePursuit();
            Functions.SetPursuitCopsCanJoin(this.pursuit, false);
            Functions.SetPursuitDontEnableCopBlips(this.pursuit, true);

            // Add blip
            this.blip = Functions.CreateBlipForArea(this.spawnPoint.Position, 30f);
            this.blip.Display = BlipDisplay.ArrowAndMap;
            this.blip.RouteActive = true;

            // Decide whether prank call or not
            if (Common.GetRandomBool(0, 5, 1))
            {
                Log.Debug("OnCalloutAccepted: Is prank", this);
                this.SetAsPrankCall();
            }
            else
            {
                this.criminals = new List<LPed>();

                int random = Common.GetRandomValue(2, 10);
                for (int i = 0; i < random; i++)
                {
                    LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue<string>(this.criminalModels), LPed.EPedGroup.Criminal);
                    if (criminal.Exists())
                    {
                        // Ensure ped is not in a building
                        if (criminal.EnsurePedIsNotInBuilding(criminal.Position))
                        {
                            Functions.AddToScriptDeletionList(criminal, this);
                            Functions.SetPedIsOwnedByScript(criminal, this, true);
                            criminal.RelationshipGroup = RelationshipGroup.Special;
                            criminal.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion);
                            criminal.ChangeRelationship(RelationshipGroup.Gang_Albanian, Relationship.Hate);

                            // We don't want the criminal to flee yet
                            criminal.DisablePursuitAI = true;
                            criminal.EquipWeapon();

                            Functions.AddPedToPursuit(this.pursuit, criminal);
                            this.criminals.Add(criminal);
                        }
                        else
                        {
                            Log.Debug("OnCalloutAccepted: Failed to place ped properly outside of building", this);
                            criminal.Delete();
                        }
                    }
                }

                if (this.criminals.Count == 0)
                {
                    return false;
                }

                // Chance to spawn another bunch of suspects fighting each other
                if (Common.GetRandomBool(0, 2, 1))
                {
                    random = Common.GetRandomValue(2, 10);
                    for (int i = 0; i < random; i++)
                    {
                        LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue<string>(this.criminalModels), LPed.EPedGroup.Criminal);
                        if (criminal.Exists())
                        {
                            Functions.AddToScriptDeletionList(criminal, this);
                            Functions.SetPedIsOwnedByScript(criminal, this, true);
                            criminal.RelationshipGroup = RelationshipGroup.Gang_Albanian;
                            criminal.ChangeRelationship(RelationshipGroup.Gang_Albanian, Relationship.Companion);
                            criminal.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate);

                            // We don't want the criminal to flee yet
                            criminal.DisablePursuitAI = true;
                            criminal.EquipWeapon();

                            Functions.AddPedToPursuit(this.pursuit, criminal);
                            this.criminals.Add(criminal);
                        }
                    }

                    // Chance to start fighting immediately
                    if (Common.GetRandomBool(0, 2, 1))
                    {
                        this.State = EShootoutState.Fighting;
                        this.Engage();

                        // Request one backup unit automatically
                        Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position);
                    }
                }
            }

            // Add states
            this.RegisterStateCallback(EShootoutState.WaitingForPlayer, this.WaitingForPlayer);
            this.RegisterStateCallback(EShootoutState.PlayerIsClose, this.PlayerIsClose);
            this.RegisterStateCallback(EShootoutState.InCombat, this.InCombat);
            this.RegisterStateCallback(EShootoutState.Fighting, this.InCombat);
            this.RegisterStateCallback(EShootoutState.Prank, this.Prank);
            this.State = EShootoutState.WaitingForPlayer;
            Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000);

            return true;
        }
예제 #35
0
        /// <summary>
        /// Called when the callout has been accepted. Call base to set state to Running.
        /// </summary>
        /// <returns>
        /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed.
        /// </returns>
        public override bool OnCalloutAccepted()
        {
            base.OnCalloutAccepted();

            // Create pursuit instance
            this.pursuit = Functions.CreatePursuit();

            // Create
            this.vehicle = new LVehicle(World.GetNextPositionOnStreet(this.spawnPosition), Common.GetRandomCollectionValue<string>(this.vehicleModels));
            if (this.vehicle.Exists())
            {
                // Ensure vehicle is freed on end
                Functions.AddToScriptDeletionList(this.vehicle, this);
                this.vehicle.PlaceOnNextStreetProperly();

                int peds = Common.GetRandomValue(1, 3);
                if (this.calloutType == ECalloutType.Robbery)
                {
                    peds = 2;
                }

                // Create suspects
                this.robbers = new LPed[peds];
                for (int i = 0; i < this.robbers.Length; i++)
                {
                    // Spawn ped
                    this.robbers[i] = new LPed(World.GetNextPositionOnStreet(this.vehicle.Position), Common.GetRandomCollectionValue<string>(this.criminalModels), LPed.EPedGroup.Criminal);
                    if (this.robbers[i].Exists())
                    {
                        // If vehicle doesn't have a driver yet, warp robber as driver
                        if (!this.vehicle.HasDriver)
                        {
                            this.robbers[i].WarpIntoVehicle(this.vehicle, VehicleSeat.Driver);
                        }
                        else
                        {
                            this.robbers[i].WarpIntoVehicle(this.vehicle, VehicleSeat.AnyPassengerSeat);
                        }

                        // Make ignore all events and give default weapon
                        this.robbers[i].BlockPermanentEvents = true;
                        this.robbers[i].Task.AlwaysKeepTask = true;

                        if (this.calloutType == ECalloutType.Robbery)
                        {
                            this.robbers[i].EquipWeapon();
                        }
                        else
                        {
                            // When not a robbery, 1/6 chance of weapons allowed only
                            bool allowWeapons = Common.GetRandomBool(0, 7, 1);
                            Functions.SetPursuitAllowWeaponsForSuspects(this.pursuit, allowWeapons);
                        }

                        // Add to deletion list and to pursuit
                        Functions.AddToScriptDeletionList(this.robbers[i], this);
                        Functions.AddPedToPursuit(this.pursuit, this.robbers[i]);

                        // Parity check, just to show how to normally use this API. No need if you just created the ped,
                        // since no other script could own it already
                        if (!Functions.DoesPedHaveAnOwner(this.robbers[i]))
                        {
                            // Bind ped to script so it can't be used by other scripts, such as random scenarios
                            // Because we now own this script, we also have to define behavior what we want to do when another script
                            // takes over control, e.g. when being arrested. That's why we implement PedLeftScript below
                            Functions.SetPedIsOwnedByScript(this.robbers[i], this, true);
                        }
                    }
                }

                // Create Police
                LVehicle copCar = new LVehicle(World.GetNextPositionOnStreet(this.vehicle.Position), "POLICE");
                if (copCar.Exists())
                {
                    Functions.AddToScriptDeletionList(copCar, this);
                    copCar.PlaceOnNextStreetProperly();

                    LPed copDriver = copCar.CreatePedOnSeat(VehicleSeat.Driver);

                    if (copDriver != null && copDriver.Exists())
                    {
                        Functions.AddToScriptDeletionList(copDriver, this);
                        copCar.SirenActive = true;
                        copDriver.SayAmbientSpeech("PULL_OVER_WARNING");
                    }
                }

                // Since we want other cops to join, set as called in already and also active it for player
                Functions.SetPursuitCalledIn(this.pursuit, true);
                Functions.SetPursuitIsActiveForPlayer(this.pursuit, true);

                // Show message to the player
                Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_ROBBERY_CATCH_UP"), 25000);
            }

            return true;
        }
예제 #36
0
        /// <summary>
        /// The method that contains the callout's logic
        /// </summary>
        public void StartMuggingScenario()
        {
            //ALWAYS START A NEW GAME FIBER IF YOU'RE GOING TO USE GameFiber.Sleep, DON'T SLEEP THE MAIN FIBER.
            GameFiber.StartNew(delegate
            {
                //Create the pursuit
                this.pursuit = Functions.CreatePursuit();

                //Pick a random number, to choose a random outcome
                int r = new Random().Next(1, 4);

                //Set the state to decision made, since the outcome is chosen.
                state = EMuggingState.DecisionMade;

                //Execute one of the random outcomes
                if (r == 1)
                {
                    //The aggressor kills the victim before fleeing from the scene, and the victim flees the scene, trying to escape the aggressor.
                    NativeFunction.CallByName<uint>("TASK_COMBAT_PED", Aggressor, Victim, 0, 1);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor);

                    //The aggressor shoots at the victim for 5 seconds, which either kills them, or severely injures them.
                    GameFiber.Sleep(5000);

                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor);
                    //Now for another random outcome
                    if (new Random().Next(1, 3) == 2)
                    {
                        //The aggressor attacks the player.
                        NativeFunction.CallByName<uint>("TASK_COMBAT_PED", Aggressor, Game.LocalPlayer.Character, 0, 1);

                        //We wait 4.5 seconds before adding the ped to a pursuit, since as soon as we add the aggressor to a pursuit, LSPDFR takes over the AI, and they won't attack the player anymore. They'll flee instead.
                        GameFiber.Sleep(4500); 
                    }
                }
                else
                {
                    //The aggressor doesn't attack the victim, instead, both peds flee. We don't need to tell the aggressor to flee, as LSPDFR's pursuit system does that for us.
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", Victim, Aggressor);
                }
                //Dismiss the aggressor from our plugin
                Aggressor.Dismiss();

                //Add the aggressor to a pursuit
                Functions.AddPedToPursuit(this.pursuit, Aggressor);

                //Dispatch a backup unit.
                Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
            });
        }