Beispiel #1
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();
                    }
                }
            });
        }