Пример #1
0
        public override bool OnCalloutAccepted()
        {
            SuspectCar = new Vehicle("STOCKADE", SpawnPoint);
            SuspectCar.MakePersistent();
            new Ped(Vector3.Zero);
            Suspect.MakeMissionPed();
            SuspectBlip       = Suspect.AttachBlip();
            SuspectBlip.Color = Color.Red;

            Suspect.Inventory.GiveNewWeapon(new WeaponAsset(firearmsToSelectFrom[AssortedCalloutsHandler.rnd.Next(firearmsToSelectFrom.Length)]), -1, true);
            Suspect.WarpIntoVehicle(SuspectCar, -1);
            if (!CalloutRunning)
            {
                CalloutHandler();
            }
            return(base.OnCalloutAccepted());
        }
Пример #2
0
 private void WaitForGetClose()
 {
     while (CalloutRunning)
     {
         GameFiber.Yield();
         PoliceCar.ShouldVehiclesYieldToThisVehicle = false;
         if (Vector3.Distance(Game.LocalPlayer.Character.Position, PoliceOfficer.Position) < 45f)
         {
             Game.DisplayHelp("Park up behind the vehicles and make contact with the officer.");
             SuspectBlip       = Suspect.AttachBlip();
             SuspectBlip.Color = Color.Red;
             SuspectBlip.Scale = 0.7f;
             PoliceOfficerBlip.IsRouteEnabled = false;
             PoliceOfficerBlip.Scale          = 0.7f;
             if (ComputerPlusRunning)
             {
                 API.ComputerPlusFuncs.SetCalloutStatusToAtScene(CalloutID);
             }
             break;
         }
     }
 }
Пример #3
0
        private void CalloutHandler()
        {
            CalloutRunning = true;
            GameFiber.StartNew(delegate
            {
                try
                {
                    Pursuit = Functions.CreatePursuit();

                    NativeFunction.CallByName <uint>("SET_DRIVER_ABILITY", Suspect, 1.0f);
                    NativeFunction.CallByName <uint>("SET_DRIVER_AGGRESSIVENESS", Suspect, 1.0f);

                    Functions.AddPedToPursuit(Pursuit, Suspect);

                    if (AssortedCalloutsHandler.rnd.Next(3) == 0)
                    {
                        Passenger = new Ped(Vector3.Zero);
                        Passenger.MakeMissionPed();

                        Passenger.WarpIntoVehicle(SuspectCar, 0);
                        Functions.AddPedToPursuit(Pursuit, Passenger);
                    }
                    Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
                    GameFiber.Wait(3000);
                    Vehicle Backupveh  = Functions.RequestBackup(Suspect.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                    Backupveh.Position = SpawnPoint;
                    Backupveh.Heading  = SpawnHeading;
                    NativeFunction.Natives.SET_VEHICLE_FORWARD_SPEED(Backupveh, 10f);
                    Game.DisplayNotification("~b~Pursuing Officer: ~s~Suspect is on ~b~" + World.GetStreetName(Suspect.Position) + ". ~s~Speed is ~r~" + Math.Round(MathHelper.ConvertMetersPerSecondToMilesPerHour(Suspect.Speed)).ToString() + " MPH.");
                    SuspectBlip                = Suspect.AttachBlip();
                    SuspectBlip.Scale          = 0.1f;
                    SuspectBlip.IsRouteEnabled = true;
                    SuspectBlip.RouteColor     = Color.Red;
                    if (SuspectCar.HasSiren)
                    {
                        SuspectCar.IsSirenOn = true;
                    }
                    if (!Passenger.Exists())
                    {
                        while (CalloutRunning)
                        {
                            GameFiber.Yield();


                            if (!Suspect.Exists())
                            {
                                msg = "Control, the ~r~suspect~s~ has ~r~escaped.~s~ Hot pursuit is code 4, over.";
                                break;
                            }
                            else if (Functions.IsPedArrested(Suspect))
                            {
                                msg = "Control, the ~r~suspect~s~ is ~g~under arrest.~s~ Hot pursuit is code 4, over.";
                                break;
                            }
                            else if (Suspect.IsDead)
                            {
                                msg = "Control, the ~r~suspect~s~ is ~o~dead.~s~ Hot pursuit is code 4, over.";
                                break;
                            }

                            if (Vector3.Distance(Suspect.Position, Game.LocalPlayer.Character.Position) < 60f)
                            {
                                if (SuspectBlip.Exists())
                                {
                                    SuspectBlip.Delete();
                                }
                            }
                        }
                    }
                    else if (CalloutRunning)
                    {
                        Functions.AddPedToPursuit(Pursuit, Passenger);
                        PassengerState = SuspectStates.InPursuit;
                        SuspectState   = SuspectStates.InPursuit;

                        while (CalloutRunning)
                        {
                            GameFiber.Yield();

                            if (SuspectState == SuspectStates.InPursuit)
                            {
                                if (!Suspect.Exists())
                                {
                                    SuspectState = SuspectStates.Escaped;
                                }
                                else if (Suspect.IsDead)
                                {
                                    SuspectState = SuspectStates.Dead;
                                }
                                else if (Functions.IsPedArrested(Suspect))
                                {
                                    SuspectState = SuspectStates.Arrested;
                                }
                            }
                            if (PassengerState == SuspectStates.InPursuit)
                            {
                                if (!Passenger.Exists())
                                {
                                    PassengerState = SuspectStates.Escaped;
                                }
                                else if (Passenger.IsDead)
                                {
                                    PassengerState = SuspectStates.Dead;
                                }
                                else if (Functions.IsPedArrested(Passenger))
                                {
                                    PassengerState = SuspectStates.Arrested;
                                }
                            }
                            if ((SuspectState != SuspectStates.InPursuit) && (PassengerState != SuspectStates.InPursuit))
                            {
                                break;
                            }

                            if (Vector3.Distance(Suspect.Position, Game.LocalPlayer.Character.Position) < 60f)
                            {
                                if (SuspectBlip.Exists())
                                {
                                    SuspectBlip.Delete();
                                }
                            }
                        }
                        msg = "Control, the driver's ";
                        if (SuspectState == SuspectStates.Arrested)
                        {
                            msg += "~g~under arrest.";
                        }
                        else if (SuspectState == SuspectStates.Dead)
                        {
                            msg += "~o~dead.";
                        }
                        else if (SuspectState == SuspectStates.Escaped)
                        {
                            msg += "~r~escaped.";
                        }

                        msg += "~s~ The passenger's ";
                        if (PassengerState == SuspectStates.Arrested)
                        {
                            msg += "~g~under arrest.";
                        }
                        else if (PassengerState == SuspectStates.Dead)
                        {
                            msg += "~o~dead.";
                        }
                        else if (PassengerState == SuspectStates.Escaped)
                        {
                            msg += "~r~escaped.";
                        }
                        msg += "~s~ Hot pursuit is code 4, over.";
                    }
                    DisplayCodeFourMessage();
                }
                catch (System.Threading.ThreadAbortException e)
                {
                    End();
                }
                catch (Exception e)
                {
                    if (CalloutRunning)
                    {
                        Game.LogTrivial(e.ToString());
                        Game.LogTrivial("British Policing Script handled the exception successfully.");
                        Game.DisplayNotification("~O~Failtostop~s~ callout crashed, sorry. Please send me your log file.");
                        Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully.");
                        End();
                    }
                }
            });
        }
Пример #4
0
        private void HandleSearchForVehicleWithANPR()
        {
            float Radius = 180f;

            SearchArea       = new Blip(SuspectCar.Position.Around(35f), Radius);
            SearchArea.Color = System.Drawing.Color.Yellow;
            SearchArea.Alpha = 0.5f;
            int  WaitCount       = 0;
            int  WaitCountTarget = 1900;
            bool RouteEnabled    = false;
            int  audiocount      = 0;

            while (CalloutRunning)
            {
                GameFiber.Yield();
                WaitCount++;
                Rage.Native.NativeFunction.Natives.SET_DRIVE_TASK_DRIVING_STYLE(Suspect, 786603);
                if (Functions.IsPlayerPerformingPullover())
                {
                    if (Functions.GetPulloverSuspect(Functions.GetCurrentPullover()) == Suspect)
                    {
                        Game.DisplayNotification("Control, I have located the ~b~" + SuspectCarRecords.ModelName + ".");
                        Game.DisplayNotification("I'm preparing to ~b~stop them,~s~ over.");
                        SuspectBlip = Suspect.AttachBlip();
                        if (SearchArea.Exists())
                        {
                            SearchArea.Delete();
                        }
                        Functions.PlayScannerAudio("BRITISH_DISPATCH_SUSPECT_LOCATED_ENGAGE");
                        break;
                    }
                }

                if (Vector3.Distance(Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront * 9f), SuspectCar.Position) < 9f)
                {
                    GameFiber.Sleep(3000);
                    if (Vector3.Distance(Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront * 9f), SuspectCar.Position) < 9f)
                    {
                        Game.DisplayNotification("Control, I have located the ~b~" + SuspectCarRecords.ModelName + ".");
                        Game.DisplayNotification("I'm preparing to ~b~stop them,~s~ over.");
                        SuspectBlip = Suspect.AttachBlip();
                        if (SearchArea.Exists())
                        {
                            SearchArea.Delete();
                        }
                        Functions.PlayScannerAudio("BRITISH_DISPATCH_SUSPECT_LOCATED_ENGAGE");

                        break;
                    }
                }
                else if (((Vector3.Distance(SuspectCar.Position, SearchArea.Position) > Radius + 20f) && (WaitCount > 400)) || (WaitCount > WaitCountTarget))
                {
                    Game.DisplayNotification("~b~Control: ~s~We have an ~o~ANPR Hit ~s~on the ~b~" + SuspectCarRecords.CarColour + " " + SuspectCarRecords.ModelName + ", ~s~plate ~b~" + SuspectCarRecords.LicencePlate + ".");
                    audiocount++;
                    if (audiocount >= 3)
                    {
                        Functions.PlayScannerAudioUsingPosition("WE_HAVE_01 CRIME_TRAFFIC_ALERT IN_OR_ON_POSITION", SuspectCar.Position);
                        audiocount = 0;
                    }
                    SearchArea.Delete();
                    Radius -= 10f;
                    if (Radius < 110f)
                    {
                        Radius = 110f;
                    }
                    SearchArea       = new Blip(SuspectCar.Position.Around(5f, 15f), Radius);
                    SearchArea.Color = System.Drawing.Color.Yellow;
                    SearchArea.Alpha = 0.5f;


                    RouteEnabled = false;
                    if (WaitCount > WaitCountTarget)
                    {
                        Game.LogTrivial("Updated for waitcount");
                    }
                    WaitCount = 0;

                    Suspect.Tasks.CruiseWithVehicle(SuspectCar, 20f, VehicleDrivingFlags.DriveAroundVehicles | VehicleDrivingFlags.DriveAroundObjects | VehicleDrivingFlags.DriveAroundPeds);
                    WaitCountTarget -= EntryPoint.rnd.Next(200, 500);
                    if (WaitCountTarget < 1000)
                    {
                        WaitCountTarget = 1000;
                    }
                    SuspectBlip       = new Blip(Suspect.Position);
                    SuspectBlip.Color = Color.Red;
                    GameFiber.Wait(4000);
                    SuspectBlip.Delete();
                }
                if (Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea.Position) > Radius + 90f)
                {
                    if (!RouteEnabled)
                    {
                        SearchArea.IsRouteEnabled = true;
                        RouteEnabled = true;
                    }
                }
                else
                {
                    if (RouteEnabled)
                    {
                        SearchArea.IsRouteEnabled = false;
                        RouteEnabled = false;
                    }
                }
            }
        }
        private void CalloutHandler()
        {
            CalloutRunning = true;
            GameFiber.StartNew(delegate
            {
                try
                {
                    GameFiber.Wait(1000);
                    Pursuit = Functions.CreatePursuit();
                    SuspectBritishPersona = BritishPersona.GetBritishPersona(Suspect);


                    Functions.AddPedToPursuit(Pursuit, Suspect);

                    if (EntryPoint.rnd.Next(3) == 0)
                    {
                        Passenger = new Ped(Vector3.Zero);
                        Passenger.MakeMissionPed();

                        Passenger.WarpIntoVehicle(SuspectCar, 0);
                        Functions.AddPedToPursuit(Pursuit, Passenger);
                    }

                    Functions.SetPursuitIsActiveForPlayer(Pursuit, true);

                    GameFiber.Wait(3000);
                    Vehicle Backupveh  = Functions.RequestBackup(Suspect.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                    Backupveh.Position = sp;
                    Backupveh.Heading  = sp;
                    Game.DisplayNotification("~b~Pursuing Officer: ~s~Suspect is on ~b~" + World.GetStreetName(Suspect.Position) + ". ~s~Speed is ~r~" + Math.Round(MathHelper.ConvertMetersPerSecondToMilesPerHour(Suspect.Speed)).ToString() + " MPH.");
                    SuspectBlip                = Suspect.AttachBlip();
                    SuspectBlip.Scale          = 0.1f;
                    SuspectBlip.IsRouteEnabled = true;
                    SuspectBlip.RouteColor     = Color.Red;



                    if (!Passenger.Exists())
                    {
                        while (CalloutRunning)
                        {
                            GameFiber.Yield();

                            Rage.Native.NativeFunction.Natives.SET_AI_MELEE_WEAPON_DAMAGE_MODIFIER(5.5f);
                            if (!Suspect.Exists())
                            {
                                msg = "Control, the ~r~suspect~s~ has ~r~escaped.~s~ I'm state 2, over.";
                                break;
                            }
                            else if (Functions.IsPedArrested(Suspect))
                            {
                                msg = "Control, the ~r~suspect~s~ is ~g~under arrest.~s~ I'm state 2, over.";
                                string sentence;
                                if (EntryPoint.rnd.Next(6) < 3)
                                {
                                    int HoursUnpaidWork = (int)Math.Round(((float)EntryPoint.rnd.Next(150, 300)) / 5.0f) * 5;

                                    int Costs = (int)Math.Round(((float)EntryPoint.rnd.Next(165)) / 5.0f) * 5;
                                    sentence  = "Community order made with " + HoursUnpaidWork.ToString() + " hours unpaid work. Disqualified from driving for " + EntryPoint.rnd.Next(12, 24).ToString() + " months. " + Costs.ToString() + " pounds in costs.";
                                }
                                else
                                {
                                    int JailMonths = (int)Math.Round(((float)EntryPoint.rnd.Next(4, 19)) / 5.0f) * 5;
                                    int Costs      = (int)Math.Round(((float)EntryPoint.rnd.Next(165)) / 5.0f) * 5;
                                    sentence       = "Sentenced to  " + JailMonths.ToString() + " months in prison. Disqualified from driving for " + EntryPoint.rnd.Next(12, 24).ToString() + " months. " + Costs.ToString() + " pounds in costs.";
                                }



                                CourtSystem.CreateNewCourtCase(SuspectBritishPersona, "failing to stop for police and dangerous driving", 100, sentence);
                                break;
                            }
                            else if (Suspect.IsDead)
                            {
                                msg = "Control, the ~r~suspect~s~ is ~o~dead.~s~ I'm state 2, over.";
                                break;
                            }

                            if (Vector3.Distance(Suspect.Position, Game.LocalPlayer.Character.Position) < 60f)
                            {
                                if (SuspectBlip.Exists())
                                {
                                    SuspectBlip.Delete();
                                }
                            }
                        }
                    }
                    else if (CalloutRunning)
                    {
                        Functions.AddPedToPursuit(Pursuit, Passenger);
                        PassengerState = SuspectStates.InPursuit;
                        SuspectState   = SuspectStates.InPursuit;

                        while (CalloutRunning)
                        {
                            GameFiber.Yield();

                            if (SuspectState == SuspectStates.InPursuit)
                            {
                                if (!Suspect.Exists())
                                {
                                    SuspectState = SuspectStates.Escaped;
                                }
                                else if (Suspect.IsDead)
                                {
                                    SuspectState = SuspectStates.Dead;
                                }
                                else if (Functions.IsPedArrested(Suspect))
                                {
                                    SuspectState = SuspectStates.Arrested;
                                }
                            }



                            if (PassengerState == SuspectStates.InPursuit)
                            {
                                if (!Passenger.Exists())
                                {
                                    PassengerState = SuspectStates.Escaped;
                                }
                                else if (Passenger.IsDead)
                                {
                                    PassengerState = SuspectStates.Dead;
                                }
                                else if (Functions.IsPedArrested(Passenger))
                                {
                                    PassengerState = SuspectStates.Arrested;
                                }
                            }
                            if ((SuspectState != SuspectStates.InPursuit) && (PassengerState != SuspectStates.InPursuit))
                            {
                                break;
                            }

                            if (Vector3.Distance(Suspect.Position, Game.LocalPlayer.Character.Position) < 60f)
                            {
                                if (SuspectBlip.Exists())
                                {
                                    SuspectBlip.Delete();
                                }
                            }
                        }
                        msg = "Control, the driver's ";
                        if (SuspectState == SuspectStates.Arrested)
                        {
                            msg += "~g~under arrest.";
                        }
                        else if (SuspectState == SuspectStates.Dead)
                        {
                            msg += "~o~dead.";
                        }
                        else if (SuspectState == SuspectStates.Escaped)
                        {
                            msg += "~r~escaped.";
                        }

                        msg += "~s~ The passenger's ";
                        if (PassengerState == SuspectStates.Arrested)
                        {
                            msg += "~g~under arrest.";
                        }
                        else if (PassengerState == SuspectStates.Dead)
                        {
                            msg += "~o~dead.";
                        }
                        else if (PassengerState == SuspectStates.Escaped)
                        {
                            msg += "~r~escaped.";
                        }
                        msg += "~s~ I'm state 2, over.";
                    }
                    DisplayCodeFourMessage();
                }
                catch (System.Threading.ThreadAbortException e)
                {
                    End();
                }
                catch (Exception e)
                {
                    if (CalloutRunning)
                    {
                        Game.LogTrivial(e.ToString());
                        Game.LogTrivial("British Policing Script handled the exception successfully.");
                        Game.DisplayNotification("~O~Failtostop~s~ callout crashed, sorry. Please send me your log file.");
                        Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully.");
                        End();
                    }
                }
            });
        }
Пример #6
0
        private void HandleSearchForVehicleWithANPR()
        {
            float Radius = 220f;

            SearchArea       = new Blip(SuspectCar.Position.Around(25f), Radius);
            SearchArea.Color = Color.Yellow;
            SearchArea.Alpha = 0.5f;
            int  WaitCount       = 0;
            int  WaitCountTarget = 2200;
            bool RouteEnabled    = false;

            while (CalloutRunning)
            {
                GameFiber.Yield();
                WaitCount++;
                NativeFunction.Natives.SET_DRIVE_TASK_DRIVING_STYLE(Suspect, 786603);

                if (Vector3.Distance(PlayerPed.GetOffsetPosition(Vector3.RelativeFront * 9f), SuspectCar.Position) < 9f)
                {
                    GameFiber.Sleep(3000);
                    if (Vector3.Distance(PlayerPed.GetOffsetPosition(Vector3.RelativeFront * 9f), SuspectCar.Position) < 9f)
                    {
                        Game.DisplayNotification("Control, I have located the ~b~" + CarModelName + ".");
                        Game.DisplayNotification("I'm preparing to ~b~stop them,~s~ over.");
                        SuspectBlip = Suspect.AttachBlip();
                        if (SearchArea.Exists())
                        {
                            SearchArea.Delete();
                        }
                        Functions.PlayScannerAudio("DISPATCH_SUSPECT_LOCATED_ENGAGE");

                        break;
                    }
                }
                else if (((Vector3.Distance(SuspectCar.Position, SearchArea.Position) > Radius + 20f) && (WaitCount > 400)) || (WaitCount > WaitCountTarget))
                {
                    Game.DisplayNotification("~o~ANPR Hit ~s~on the ~b~" + CarColor + " " + CarModelName + ", ~s~plate ~b~" + SuspectCar.LicensePlate + ".");
                    Functions.PlayScannerAudioUsingPosition("WE_HAVE_01 CRIME_TRAFFIC_ALERT IN_OR_ON_POSITION", SuspectCar.Position);
                    SearchArea.Delete();
                    Radius -= 5f;
                    if (Radius < 120f)
                    {
                        Radius = 120f;
                    }
                    SearchArea       = new Blip(SuspectCar.Position.Around(5f, 15f), Radius);
                    SearchArea.Color = Color.Yellow;
                    SearchArea.Alpha = 0.5f;


                    RouteEnabled = false;
                    if (WaitCount > WaitCountTarget)
                    {
                        Game.LogTrivial("Updated for waitcount");
                    }
                    WaitCount = 0;

                    Suspect.Tasks.CruiseWithVehicle(SuspectCar, 20f, VehicleDrivingFlags.DriveAroundVehicles | VehicleDrivingFlags.DriveAroundObjects | VehicleDrivingFlags.DriveAroundPeds);
                    WaitCountTarget -= AssortedCalloutsHandler.rnd.Next(200, 400);
                    if (WaitCountTarget < 1200)
                    {
                        WaitCountTarget = 1900;
                    }
                    SuspectBlip       = Suspect.AttachBlip();
                    SuspectBlip.Color = Color.Red;
                    GameFiber.Wait(4000);
                    SuspectBlip.Delete();
                }
                if (Vector3.Distance(PlayerPed.Position, SearchArea.Position) > Radius + 90f)
                {
                    if (!RouteEnabled)
                    {
                        SearchArea.IsRouteEnabled = true;
                        RouteEnabled = true;
                    }
                }
                else
                {
                    if (RouteEnabled)
                    {
                        SearchArea.IsRouteEnabled = false;
                        RouteEnabled = false;
                    }
                }
            }
        }
Пример #7
0
        private void SituationWaitForArriveFleeStab()
        {
            GameFiber.StartNew(delegate
            {
                try
                {
                    Suspect.Tasks.Wander();
                    Suspect.Inventory.GiveNewWeapon("WEAPON_KNIFE", -1, true);
                    Functions.SetPedCantBeArrestedByPlayer(Suspect, true);
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea.Position) < 55f)
                        {
                            PlaySuspectDescriptionAudio();
                            break;
                        }
                    }
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Vector3.Distance(Game.LocalPlayer.Character.Position, Suspect.Position) < 15f && !Game.LocalPlayer.Character.IsInAnyVehicle(false))
                        {
                            SuspectBlip       = Suspect.AttachBlip();
                            SuspectBlip.Color = Color.Red;
                            SuspectBlip.Scale = 0.6f;
                            Pursuit           = Functions.CreatePursuit();
                            Functions.AddPedToPursuit(Pursuit, Suspect);
                            Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
                            Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESIST_ARREST IN_OR_ON_POSITION", Game.LocalPlayer.Character.Position);
                            GameFiber.Yield();
                            NativeFunction.Natives.TASK_SMART_FLEE_PED(Suspect, Game.LocalPlayer.Character, 150f, 30000, true, true);
                            SearchArea.Delete();
                            GameFiber.Wait(3000);
                            break;
                        }
                        if (Vector3.Distance(Suspect.Position, SearchArea.Position) > 42f)
                        {
                            SearchAreaLocation  = Suspect.Position.Around(10f, 30f);
                            SearchArea.Position = SearchAreaLocation;
                        }
                    }

                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Vector3.Distance(Game.LocalPlayer.Character.Position, Suspect.Position) < 8.5f && !Game.LocalPlayer.Character.IsInAnyVehicle(false))
                        {
                            if (Suspect.Speed > 3f)
                            {
                                GameFiber.Wait(2500);
                            }

                            Rage.Native.NativeFunction.Natives.SET_AI_MELEE_WEAPON_DAMAGE_MODIFIER(1.5f);

                            Suspect.Tasks.FightAgainst(Game.LocalPlayer.Character);

                            break;
                        }
                    }
                    bool isragdoll = false;
                    if (CalloutRunning)
                    {
                        suspecthealth = Suspect.Health;
                        paincount     = 0;
                    }
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Suspect.IsDead || Functions.IsPedArrested(Suspect))
                        {
                            break;
                        }

                        if (Suspect.IsRagdoll && !isragdoll)
                        {
                            isragdoll = true;
                            paincount++;
                            //Game.LogTrivial("Paincount ragdoll");
                        }
                        else if (!Suspect.IsRagdoll && isragdoll)
                        {
                            isragdoll = false;
                        }

                        else if (Suspect.Health < suspecthealth)
                        {
                            paincount++;

                            //Game.LogTrivial("Paincount health");
                        }
                        suspecthealth = Suspect.Health;
                        if (paincount >= 3)
                        {
                            Functions.SetPedCantBeArrestedByPlayer(Suspect, false);
                        }
                    }
                    DisplayCodeFourMessage();
                }
                catch (System.Threading.ThreadAbortException e)
                {
                    End();
                }
                catch (Exception e)
                {
                    if (CalloutRunning)
                    {
                        Game.LogTrivial(e.ToString());
                        Game.LogTrivial("Assorted Callouts handled the exception successfully.");
                        Game.DisplayNotification("~O~Personwithaknife~s~ callout crashed, sorry. Please send me your log file.");
                        Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully.");
                        End();
                    }
                }
            });
        }
Пример #8
0
        private void SituationAttackOtherPed()
        {
            GameFiber.StartNew(delegate
            {
                try
                {
                    Suspect.Tasks.Wander();
                    Suspect.Inventory.GiveNewWeapon("WEAPON_KNIFE", -1, true);
                    Functions.SetPedCantBeArrestedByPlayer(Suspect, true);
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();

                        if (Vector3.Distance(Game.LocalPlayer.Character.Position, Suspect.Position) < 120f)
                        {
                            //Victim = new Ped(Model.PedModels.ToList().Shuffle()[0], Suspect.GetOffsetPosition(Vector3.RelativeFront * 3f), 0f);
                            Victim = NativeFunction.Natives.CREATE_RANDOM_PED <Ped>(Suspect.GetOffsetPosition(Vector3.RelativeFront * 3f).X, Suspect.GetOffsetPosition(Vector3.RelativeFront * 3f).Y, Suspect.GetOffsetPosition(Vector3.RelativeFront * 3f).Z);
                            Victim.MakeMissionPed();
                            Rage.Native.NativeFunction.Natives.SET_AI_MELEE_WEAPON_DAMAGE_MODIFIER(1.5f);
                            Game.LogTrivial("Victim health: " + Victim.Health.ToString());
                            Victim.Health = 150;
                            Functions.PlayScannerAudio("WE_HAVE CRIME_STABBING UNITS_RESPOND_CODE_99");
                            Game.DisplayNotification("~b~Control: ~s~Suspect is reportedly stabbing a victim. Respond ~b~CODE 99!");
                            if (ComputerPlusRunning)
                            {
                                API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Suspect is stabbing a victim. Units urgently required at scene.");
                            }
                            GameFiber.Wait(2000);
                            Suspect.Tasks.FightAgainst(Victim);
                            GameFiber.Wait(600);
                            NativeFunction.Natives.TASK_SMART_FLEE_PED(Victim, Suspect, 10f, -1, true, true);
                            Functions.RequestBackup(Suspect.Position, LSPD_First_Response.EBackupResponseType.Code3, LSPD_First_Response.EBackupUnitType.LocalUnit);

                            break;
                        }
                    }
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Vector3.Distance(Game.LocalPlayer.Character.Position, Suspect.Position) < 30f)
                        {
                            PlaySuspectDescriptionAudio();

                            break;
                        }
                    }
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Vector3.Distance(Game.LocalPlayer.Character.Position, Suspect.Position) < 15f && !Game.LocalPlayer.Character.IsInAnyVehicle(false))
                        {
                            SuspectBlip       = Suspect.AttachBlip();
                            SuspectBlip.Color = Color.Red;
                            SuspectBlip.Scale = 0.6f;
                            VictimBlip        = Victim.AttachBlip();
                            VictimBlip.Color  = Color.Green;
                            VictimBlip.Scale  = 0.6f;
                            Pursuit           = Functions.CreatePursuit();
                            Functions.AddPedToPursuit(Pursuit, Suspect);
                            Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
                            Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESIST_ARREST IN_OR_ON_POSITION", Game.LocalPlayer.Character.Position);
                            GameFiber.Yield();
                            NativeFunction.Natives.TASK_SMART_FLEE_PED(Suspect, Game.LocalPlayer.Character, 150f, -1, true, true);
                            SearchArea.Delete();
                            GameFiber.Wait(3000);

                            break;
                        }
                        if (Vector3.Distance(Suspect.Position, SearchArea.Position) > 42f)
                        {
                            SearchAreaLocation  = Suspect.Position.Around(10f, 30f);
                            SearchArea.Position = SearchAreaLocation;
                        }
                    }
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Vector3.Distance(Game.LocalPlayer.Character.Position, Suspect.Position) < 10f && !Game.LocalPlayer.Character.IsInAnyVehicle(false))
                        {
                            GameFiber.Wait(2500);
                            Rage.Native.NativeFunction.Natives.SET_AI_MELEE_WEAPON_DAMAGE_MODIFIER(1.5f);

                            Suspect.Tasks.FightAgainst(Game.LocalPlayer.Character);

                            break;
                        }
                    }
                    //bool isragdoll = false;
                    if (CalloutRunning)
                    {
                        suspecthealth = Suspect.Health;
                        paincount     = 0;
                    }
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        if (Suspect.IsDead || Functions.IsPedArrested(Suspect))
                        {
                            break;
                        }

                        //if (Suspect.IsRagdoll && !isragdoll)
                        //{
                        //    isragdoll = true;
                        //    paincount++;
                        //    Game.LogTrivial("Paincount ragdoll");
                        //}
                        //else if (!Suspect.IsRagdoll)
                        //{
                        //    isragdoll = false;
                        //}

                        if (Suspect.Health < suspecthealth)
                        {
                            paincount++;
                            suspecthealth = Suspect.Health;
                            //Game.LogTrivial("Paincount health");
                        }

                        if (paincount >= 2)
                        {
                            Functions.SetPedCantBeArrestedByPlayer(Suspect, false);
                        }
                    }
                    while (CalloutRunning)
                    {
                        GameFiber.Yield();
                        Game.DisplayHelp("When you're done, press ~b~" + AssortedCalloutsHandler.kc.ConvertToString(AssortedCalloutsHandler.EndCallKey) + " ~s~to end the call.");
                        if (Game.IsKeyDown(AssortedCalloutsHandler.EndCallKey))
                        {
                            Game.HideHelp();
                            break;
                        }
                    }
                    DisplayCodeFourMessage();
                }
                catch (System.Threading.ThreadAbortException e)
                {
                    End();
                }
                catch (Exception e)
                {
                    if (CalloutRunning)
                    {
                        Game.LogTrivial(e.ToString());
                        Game.LogTrivial("Assorted Callouts handled the exception successfully.");
                        Game.DisplayNotification("~O~Personwithaknife~s~ callout crashed, sorry. Please send me your log file.");
                        Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully.");
                        End();
                    }
                }
            });
        }