/// <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.
            searchZoneBlip       = new Blip(ped.Position, 320.0f);
            searchZoneBlip.Color = Color.FromArgb(100, Color.Yellow);

            //Game.SetRelationshipBetweenRelationshipGroups(ped.RelationshipGroup, "COP", Relationship.Dislike);
            //Game.SetRelationshipBetweenRelationshipGroups(ped.RelationshipGroup, "PLAYER", Relationship.Dislike);



            state = EWantedFelonInVehicleState.Searching;

            GameFiber.StartNew(delegate
            {
                Vector3 position = ped.Position;
                Game.DisplayNotification("~b~Dispatch: ~w~Suspect last seen in a ~b~" + pedVehicle.Model.Name + "~w~, color ~b~" + pedVehicle.GetPrimaryColor().ToFriendlyName().ToLower());
                Game.DisplayNotification("~b~Dispatch: ~w~At ~b~" + position.GetStreetName() + "~w~, in ~b~" + position.GetZoneName() + "~w~, ~b~" + position.GetAreaName());
                Game.DisplayNotification("~b~Dispatch: ~w~Air unit deployed");

                GameFiber.Wait(Globals.Random.Next(1250, 2750));
                Game.DisplayNotification("~b~" + Settings.General.Name + ": ~w~10-4");
            });

            UpdateSearchArea();

            return(base.OnCalloutAccepted());
        }
Ejemplo n.º 2
0
 public static void StartCalloutSubMenuOnItemSelected(UIMenu sender, UIMenuItem selectedItem, int index)
 {
     GameFiber.StartNew(delegate
     {
         LSPD_First_Response.Mod.API.Functions.StartCallout(selectedItem.Text);
     });
 }
Ejemplo n.º 3
0
        protected override void WaitForKeyPress()
        {
            GameFiber.StartNew(delegate
            {
                while (Display)
                {
                    GameFiber.Yield();

                    int?mTempResponse = ReadKey();

                    if (Game.IsKeyDown(Keys.D0))
                    {
                        mResponse = -1;
                    }

                    if (mTempResponse != null && mTempResponse.HasValue && mTempResponse.Value >= 0)
                    {
                        int idx = mTempResponse.Value;

                        if (idx >= 0 && (idx < Responses.Count && idx < Questions.Count))
                        {
                            GameFiber.StartNew(delegate
                            {
                                string mAnswer = string.Format("~y~Subject: ~w~{0}", Questions[idx].Answer);
                                Game.DisplaySubtitle(mAnswer, 5000);
                            });
                        }
                    }
                }
            });
        }
Ejemplo n.º 4
0
 public static void Command_GetAllVehicleColor()
 {
     GameFiber.StartNew(() =>
     {
         var vehicles = World.GetAllVehicles();
         foreach (Vehicle vehicle in vehicles)
         {
             if (vehicle)
             {
                 VehicleColor vehicleColor = vehicle.GetColor();
                 List <string> log         = new List <string>()
                 {
                     $"Vehicle: {vehicle.GetMakeName()} - {vehicle.GetDisplayName()}",
                     $"Primary: {vehicleColor.PrimaryColorName}",
                     $"Secondary: {vehicleColor.SecondaryColorName}",
                 };
                 Game.LogTrivial(string.Join(", ", log));
                 if (vehicleColor.PrimaryColor == VehiclePaint.Unknown || vehicleColor.SecondaryColor == VehiclePaint.Unknown)
                 {
                     Game.LogTrivial("================UNKNOWN COLOR===============");
                 }
             }
         }
     }, "GetAllVehicleColors Command Fiber");
 }
 public void EnRoute()
 {
     _state = ELocation.Within80;
     GameFiber.StartNew(delegate
     {
         while (true)
         {
             _me.Task_Scenario("WORLD_HUMAN_COP_IDLES");
             while (NativeFunction.Natives.IS_PED_USING_ANY_SCENARIO <bool>(_me))
             {
                 if (_state == ELocation.Within15)
                 {
                     break;
                 }
                 GameFiber.Yield();
             }
             if (_state == ELocation.Within15)
             {
                 break;
             }
             GameFiber.Yield();
         }
     });
     DeactivateStage(EnRoute);
 }
Ejemplo n.º 6
0
        private void NavOnFormAdded(object sender, NavigationController.NavigationEntry entry)
        {
            try
            {
                GameFiber.StartNew(() =>
                {
                    try
                    {
                        entry.form.Show();
                        do
                        {
                            GameFiber.Yield();
                        }while (!Globals.CloseRequested && entry.form.IsOpen());

                        Globals.Navigation.RemoveEntry(entry, false);
                    }
                    catch (Exception e)
                    {
                        if (e.GetType() != typeof(ThreadAbortException))
                        {
                            Function.LogCatch(e.ToString());
                        }
                    }
                    //NavOnFormRemoved(sender, entry);
                });
            }
            catch (Exception e)
            {
                Function.LogCatch(e.ToString());
            }
        }
Ejemplo n.º 7
0
 internal void OnFIContinueButtonClick(Gwen.Control.Base sender, Gwen.Control.ClickedEventArgs e)
 {
     GameFiber.StartNew(delegate
     {
         Check();
         Game.LogTrivial("FI personal info saving for: " + SuspectLastBox.Text.ToString() + " " + SuspectFirstBox.Text.ToString());
         Game.DisplayNotification("Page 2 of 3 saved. Continuing Field Interaction form...");
         using (StreamWriter Information = new StreamWriter("Plugins/LSPDFR/ComputerPlus/field interviews/" + SuspectLastBox.Text.ToLower() + SuspectFirstBox.Text.ToLower() + ".txt", true))
         {
             // 13 lines
             Information.WriteLine("---PERSONAL INFORMATION---");
             Information.WriteLine("DOB: " + SuspectDOBBox.Text);
             Information.WriteLine(SuspectSSNBox.Text);
             Information.WriteLine("Occupation: " + SuspectOccupationBox.Text);
             Information.WriteLine("Address: " + SuspectAddressBox.Text + " " + SuspectCityBox.Text);
             Information.WriteLine("Sex: " + SuspectSexBox.Text);
             Information.WriteLine("Race: " + SuspectRaceBox.Text);
             Information.WriteLine("Hair: " + SuspectHairBox.Text);
             Information.WriteLine("Eyes: " + SuspectEyesBox.Text);
             Information.WriteLine("Scars/Tattoos: " + SuspectMarkBox.Text);
             Information.WriteLine("License Status: " + SuspectLicenseBox.Text);
             Information.WriteLine("Vehicle Make, Model, Color: " + SuspectVehicleBox.Text);
             Information.WriteLine("Vehicle Plate: " + SuspectPlateBox.Text);
         }
         Game.LogTrivial("Successfully written to .txt");
     });
     state = SubmitCheck.submitted;
     FIComplete();
     this.Window.Close();
     form_firemarks = new GameFiber(OpenFIRemarksForm);
     form_firemarks.Start();
 }
Ejemplo n.º 8
0
        public static void Process(object sender, GraphicsEventArgs e)
        {
            timerBarPool.Draw();

            if (Game.IsKeyDown(Keys.F5))
            {
                GameFiber.StartNew(delegate
                {
                    for (float i = 0f; i < 1f; i += 0.001f)
                    {
                        barTimerBar.Percentage = i;
                        GameFiber.Sleep(10);
                    }
                });
            }

            if (Game.IsKeyDown(Keys.F6))
            {
                barTimerBar.ForegroundColor = Color.FromArgb(MathHelper.GetRandomInteger(256), MathHelper.GetRandomInteger(256), MathHelper.GetRandomInteger(256));
                barTimerBar.BackgroundColor = ControlPaint.Dark(barTimerBar.ForegroundColor);
            }

            textTimerBar.Text = World.TimeOfDay.ToString("c");

            textTimerBar2.Text = MathHelper.ConvertMetersPerSecondToKilometersPerHourRounded(Game.LocalPlayer.Character.Speed) + " km/h";
        }
Ejemplo n.º 9
0
        public static void Main()
        {
            while (Game.IsLoading)
            {
                GameFiber.Yield();
            }

            //Start with initializing the IoC container before doing anything else
            InitializeIoContainer();

            try
            {
                InitializeDeviceManager();

                var vehicleListener = IoC.Instance.GetInstance <IVehicleListener>();
                var rage            = IoC.Instance.GetInstance <IRage>();
                rage.LogTrivialDebug("Creating a new GameFiber for IVehicleListener");
                GameFiber.StartNew(vehicleListener.Start);
            }
            catch (NoAvailableSdkException)
            {
                var rage = IoC.Instance.GetInstance <IRage>();
                rage.DisplayPluginNotification("no supported SDK available");
                rage.LogTrivial("No supported SDK available");
            }
            catch (Exception ex)
            {
                //an unknown error occurred, catch it and log it or otherwise the game will crash (probably because I was testing something odd)
                var rage = IoC.Instance.GetInstance <IRage>();
                rage.LogTrivial("*** An unknown error occurred and the plugin has stopped working ***");
                rage.LogTrivial(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Ejemplo n.º 10
0
        static APISpotlightMgr()
        {
            bool gameFnInit  = GameFunctions.Init();
            bool gameMemInit = GameMemory.Init();

            if (!gameFnInit || !gameMemInit)
            {
                string str = "";
                if (!gameFnInit)
                {
                    str += nameof(GameFunctions);

                    if (!gameMemInit)
                    {
                        str += " and ";
                        str += nameof(GameMemory);
                    }
                }
                else if (!gameMemInit)
                {
                    str += nameof(GameMemory);
                }

                Game.LogTrivial($"[ERROR] Spotlight: Failed to initialize {str}");
            }

            spotlights = new List <APISpotlight>();
            fiber      = GameFiber.StartNew(UpdateSpotlights, "Spotlight API Manager");

            finalizer = new StaticFinalizer(Dispose);
        }
Ejemplo n.º 11
0
        public void Procedures()
        {
            bool emt = false, emtd = false;

            GameFiber.StartNew(delegate
            {
                GameFiber.Sleep(3000);
                PedWorker.Position = patient.LeftPosition;

                NativeFunction.CallByName <uint>("TASK_TURN_PED_TO_FACE_ENTITY", PedDriver, patient, 1000);
                GameFiber.Sleep(1100);

                PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@enter", "enter",
                                              4, AnimationFlags.StayInEndFrame);
                GameFiber.Sleep(9000);

                PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@idle_a", "idle_b",
                                              4, AnimationFlags.StayInEndFrame);
                GameFiber.Sleep(6000);

                PedDriver.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@exit", "exit",
                                              4, AnimationFlags.StayInEndFrame);
                GameFiber.Sleep(7000);

                emtd = true;
            });
            //====================
            GameFiber.StartNew(delegate
            {
                NativeFunction.CallByName <uint>("TASK_TURN_PED_TO_FACE_ENTITY", PedWorker, patient, 1000);
                GameFiber.Sleep(1100);

                PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@enter", "enter",
                                              4, AnimationFlags.StayInEndFrame);
                GameFiber.Sleep(2000);

                PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@idle_a", "idle_b",
                                              4, AnimationFlags.StayInEndFrame);
                GameFiber.Sleep(4000);

                PedWorker.Tasks.PlayAnimation("amb@medic@standing@tendtodead@exit", "exit",
                                              4, AnimationFlags.StayInEndFrame);
                GameFiber.Sleep(2000);

                PedWorker.Tasks.PlayAnimation("amb@code_human_police_investigate@idle_intro", "idle_intro",
                                              4, AnimationFlags.StayInEndFrame);
                GameFiber.Sleep(1500);

                PedWorker.Tasks.PlayAnimation("amb@code_human_police_investigate@idle_b", "idle_d",
                                              3, AnimationFlags.None);
                GameFiber.Sleep(9000);

                emt = true;
            });

            while (!emt && !emtd)
            {
                GameFiber.Yield();
            }
        }
Ejemplo n.º 12
0
        internal static Blip BlipVehicle(Vehicle vehicle, Color color)
        {
            var blip = vehicle.AddBlipSafe(color);

            if (blip != null && (vehicle != null && vehicle.IsValid()))
            {
                _Blips.Add(blip, vehicle);
            }

            GameFiber.StartNew(() =>
            {
                var stopAt = DateTime.Now.AddMilliseconds(30000);
                while (DateTime.Now < stopAt)
                {
                    GameFiber.Yield();
                }
                try {
                    if (blip != null && blip.IsValid())
                    {
                        blip.Delete();
                    }
                } catch (Exception e)
                {
                    Function.Log(e.Message);
                }
            });
            return(blip);
        }
Ejemplo n.º 13
0
 // Token: 0x06000038 RID: 56 RVA: 0x00006344 File Offset: 0x00004544
 private static void OnListChange(UIMenu sender, UIMenuListItem listItem, int newIndex)
 {
     if (sender != UI.myMenu)
     {
         return;
     }
     if (listItem == UI.limoList)
     {
         GameFiber.StartNew(delegate()
         {
             UI.Limo_E(newIndex);
         });
     }
     if (listItem == UI.fbi1List)
     {
         GameFiber.StartNew(delegate()
         {
             UI.FBI1_E(newIndex);
         });
     }
     if (listItem == UI.fbi2List)
     {
         GameFiber.StartNew(delegate()
         {
             UI.FBI2_E(newIndex);
         });
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Mainlogic to the program (keys and isdead stuff)
        /// </summary>
        private static void OpenCloseMenu()
        {
            GameFiber.StartNew(delegate
            {
                while (true)
                {
                    GameFiber.Yield();

                    //Detecting if the player has pressed openMenu Key
                    if (Game.IsKeyDown(c.GetKeyBinding()))
                    {
                        //Changes menu visability state from opposite of what it was
                        gui.MainMenu.Visible = !gui.MainMenu.Visible;
                    }
                    //Making sure if player is dead than the menu is un-openable
                    if (Game.LocalPlayer.Character.IsDead)
                    {
                        gui.MainMenu.Visible = false;
                    }
                    //Closes the StopWeaponDeliveryMenu when open
                    if (gui.StopWeaponDeliveryMenu.Visible)
                    {
                        gui.StopWeaponDeliveryMenu.Visible = false;
                    }
                    //Closes the StopVehicleDeliveryMenu when open
                    if (gui.StopVehicleDeliveryMenu.Visible)
                    {
                        gui.StopVehicleDeliveryMenu.Visible = false;
                    }
                    gui._MenuPool.ProcessMenus();
                }
            });
        }
Ejemplo n.º 15
0
        private void ScenarioHelper()
        {
            GameFiber.StartNew(delegate
            {
                while (Game.LocalPlayer.Character.Position.DistanceTo(_one) > 5f)
                {
                    string[] scenarios =
                    {
                        "WORLD_HUMAN_PICNIC",
                        "WORLD_HUMAN_PUSH_UPS",
                        "WORLD_HUMAN_SMOKING",
                        "WORLD_HUMAN_YOGA",
                        "WORLD_HUMAN_DRINKING",
                        "WORLD_HUMAN_GARDENER_LEAF_BLOWER",
                        "WORLD_HUMAN_PARTYING",
                        "WORLD_HUMAN_SIT_UPS",
                        "WORLD_HUMAN_STAND_MOBILE"
                    };

                    _one.Task_Scenario(scenarios[MathHelper.GetRandomInteger(scenarios.Length)]);
                    while (NativeFunction.Natives.IS_PED_ACTIVE_IN_SCENARIO <bool>(_one))
                    {
                        GameFiber.Yield();
                    }
                    GameFiber.Yield();
                }

                NativeFunction.Natives.TASK_TURN_PED_TO_FACE_ENTITY(_one, Game.LocalPlayer.Character, -1);
            });
        }
Ejemplo n.º 16
0
 public static void CourtSystemMainLogic()
 {
     if (!LSPDFRPlusHandler.BritishPolicingScriptRunning)
     {
         GameFiber.StartNew(delegate
         {
             Directory.CreateDirectory(Directory.GetParent(CourtCaseFilePath).FullName);
             if (!File.Exists(CourtCaseFilePath))
             {
                 new XDocument(
                     new XElement("LSPDFRPlus")
                     )
                 .Save(CourtCaseFilePath);
             }
             LoadCourtCasesFromXMLFile(CourtCaseFilePath);
             while (true)
             {
                 GameFiber.Yield();
                 foreach (CourtCase ccase in PendingCourtCases.ToArray())
                 {
                     ccase.CheckForCaseUpdatedStatus();
                 }
             }
         });
     }
 }
Ejemplo n.º 17
0
        internal static void SecurityCameraStart(CaseData data)
        {
            IsRunning = true;
            GameFiber.StartNew(delegate
            {
                Game.LogTrivial("Starting security camera playback");

                Game.IsPaused = false;

                _playerPos = Game.LocalPlayer.Character.Position;
                _targetPos = data.SusTarget.Position;

                FadeScreen(true);

                _gameCam        = CreateGameCam();
                _gameCam.Active = false;
                _secCam         = CreateSecurityCamera(data);
                _secCam.Active  = false;

                Game.LocalPlayer.Character.IsInvincible     = true;
                Game.LocalPlayer.Character.Position         = new Vector3(data.SecCamSpawn.Position.X, data.SecCamSpawn.Position.Y, data.SecCamSpawn.Position.Z + 3f);
                Game.LocalPlayer.Character.IsPositionFrozen = true;

                _secTime = new DateTime(6, 5, 11, 23, 15, 50);

                SetUpSecCamFootage(data);
            });
        }
        private static void Main()
        {
            var instructional = new InstructionalButtons();
            var spawnCarGroup = new InstructionalButtonGroup("Spawn Car", ModifierKey.GetInstructionalKey(), InstructionalKey.SymbolPlus, SpawnCarKey.GetInstructionalKey());

            instructional.Buttons.Add(spawnCarGroup);

            while (true)
            {
                GameFiber.Yield();

                if (HasInputJustChanged)
                {
                    var(modifier, key) = IsUsingController ? (ModifierButton.GetInstructionalKey(), SpawnCarButton.GetInstructionalKey()) :
                                         (ModifierKey.GetInstructionalKey(), SpawnCarKey.GetInstructionalKey());
                    spawnCarGroup.Buttons[0] = modifier;
                    spawnCarGroup.Buttons[2] = key;
                    instructional.Update();
                }

                instructional.Draw();

                bool spawn = IsUsingController ? (ModifierButton == ControllerButtons.None || Game.IsControllerButtonDownRightNow(ModifierButton)) && Game.IsControllerButtonDown(SpawnCarButton) :
                             (ModifierKey == Keys.None || Game.IsKeyDownRightNow(ModifierKey)) && Game.IsKeyDown(SpawnCarKey);

                if (spawn)
                {
                    GameFiber.StartNew(() => new Vehicle(m => m.IsCar, Game.LocalPlayer.Character.GetOffsetPositionFront(5.0f)).Dismiss());
                }
            }
        }
Ejemplo n.º 19
0
        public void AskForID(OccupantSelector occupantselect)
        {
            GameFiber.StartNew(delegate
            {
                PlaySpecificSpeech("Kifflom");

                Game.LocalPlayer.Character.Tasks.AchieveHeading(Game.LocalPlayer.Character.CalculateHeadingTowardsEntity(Suspect));
                GameFiber.Wait(1500);

                if (occupantselect == OccupantSelector.Driver)
                {
                    Suspect.ShowDrivingLicence();
                }
                else if (occupantselect == OccupantSelector.Passengers)
                {
                    foreach (Ped occupant in SuspectVehicle.Passengers)
                    {
                        occupant.ShowDrivingLicence();
                    }
                }
                else if (occupantselect == OccupantSelector.AllOccupants)
                {
                    foreach (Ped occupant in SuspectVehicle.Occupants)
                    {
                        occupant.ShowDrivingLicence();
                    }
                }
                Game.LocalPlayer.Character.Tasks.Clear();
            });
        }
        public override void Action()
        {
            GameFiber.StartNew(delegate
            {
                try
                {
                    base.Action();

                    if (this.Animal.Exists())
                    {
                        this.Animal.ReactAndFlee(this.Hunter);
                    }
                    if (this.Animal.Exists())
                    {
                        this.Animal.KeepTasks = true;
                    }
                    if (this.Hunter.Exists())
                    {
                        this.Hunter.AttackPed(this.Animal);
                    }
                    if (this.Hunter.Exists())
                    {
                        this.Hunter.KeepTasks = true;
                    }

                    while (this.Hunter.Exists() && this.Hunter.IsAlive && this.Animal.Exists() && this.Animal.IsAlive)
                    {
                        GameFiber.Yield();
                    }

                    if (this.Hunter.Exists() && this.Animal.Exists())
                    {
                        NativeFunction.CallByName <uint>("TASK_SHOOT_AT_ENTITY", this.Hunter, this.Animal, 6000, (uint)Rage.FiringPattern.BurstFire);
                    }

                    GameFiber.Sleep(5000);

                    if (this.Hunter.Exists() && this.Animal.Exists())
                    {
                        this.Hunter.Tasks.FollowNavigationMeshToPosition(this.Animal.Position.AroundPosition(0.75f), this.Hunter.Heading, 20.0f).WaitForCompletion();
                    }
                    if (this.Hunter.Exists() && this.Animal.Exists())
                    {
                        this.Hunter.Tasks.AchieveHeading(this.Hunter.GetHeadingTowards(this.Animal)).WaitForCompletion(2250);
                    }
                    if (this.Hunter.Exists())
                    {
                        this.Hunter.Tasks.PlayAnimation("amb@medic@standing@tendtodead@idle_a", tendToDeadIdles.GetRandomElement(), 2.0f, AnimationFlags.Loop);
                    }

                    GameFiber.Sleep(60000);

                    this.CleanUp();
                }
                catch (System.Exception e)
                {
                    Logger.LogException(this.GetType().Name, e);
                }
            });
        }
Ejemplo n.º 21
0
 public static void OnItemSelect(UIMenu sender, UIMenuItem selectedItem, int index)
 {
     if (sender != mainMenu)
     {
         return;                     // We only want to detect changes from our menu.
     }
     // You can also detect the button by using index
     else if (selectedItem == toggleEngine)
     {
         GameFiber.StartNew(delegate // Start a new fiber if the code sleeps or waits and we don't want to block the MenusProcessFiber
         {
             try
             {
                 if (Game.LocalPlayer.Character.LastVehicle.IsEngineOn)
                 {
                     Rage.Native.NativeFunction.Natives.SET_VEHICLE_ENGINE_ON(Game.LocalPlayer.Character.LastVehicle, false, true);
                 }
                 if (!Game.LocalPlayer.Character.LastVehicle.IsEngineOn)
                 {
                     Rage.Native.NativeFunction.Natives.SET_VEHICLE_ENGINE_ON(Game.LocalPlayer.Character.LastVehicle, true, true);
                 }
             }
             catch (Rage.Exceptions.InvalidHandleableException)
             {
                 Game.DisplaySubtitle("Closest vehicle has no boot!", 2500);
             }
         });
     }
 }
        internal static void DisplayResponseCode(CalloutResponseType code)
        {
            string codeDisplay;
            string codeSound = "RC_";

            switch (code)
            {
            default:
                codeSound  += "CODE2";
                codeDisplay = "~g~Code 2";
                break;

            case CalloutResponseType.Code3:
                codeSound  += "CODE3";
                codeDisplay = "~r~Code 3";
                break;

            case CalloutResponseType.Code99:
                codeSound  += "CODE99";
                codeDisplay = "~r~Code 99";
                break;
            }

            GameFiber.StartNew(() =>
            {
                GameFiber.Sleep(4500);
                Functions.PlayScannerAudio(codeSound);
                Game.DisplayNotification("Respond " + codeDisplay);
            });
        }
Ejemplo n.º 23
0
        private void SearchForVehicle()
        {
            if (!search_fiber.IsAlive)
            {
                output_info.Text = "Searching. Please wait...";
                search_fiber     = GameFiber.StartNew(delegate
                {
                    GameFiber.Sleep(2500);
                    string lp_input     = input_name.Text.ToLower();
                    List <Vehicle> vehs = World.GetAllVehicles().ToList();
                    vehs.RemoveAll(v => !v);
                    vehs.OrderBy(v => v.DistanceTo(Game.LocalPlayer.Character.Position));
                    Vehicle veh = vehs.Where(v => v && v.LicensePlate.ToLower().Trim() == lp_input).FirstOrDefault();

                    if (veh)
                    {
                        output_info.Text = GetFormattedInfoForVehicle(veh);
                        Function.AddVehicleToRecents(veh);
                    }
                    else
                    {
                        output_info.Text = "No record for the specified license plate was found.";
                    }
                });
            }
        }
Ejemplo n.º 24
0
 internal static void SpawnVehicle(string vehicleModel)
 {
     GameFiber.StartNew(delegate
     {
         new Vehicle(vehicleModel, Game.LocalPlayer.Character.GetOffsetPosition(Vector3.RelativeFront * 10f), Game.LocalPlayer.Character.Heading);
     });
 }
Ejemplo n.º 25
0
        private void SearchForSuspect()
        {
            if (!search_fiber.IsAlive)
            {
                output_info.SetText("Searching. Please wait...");

                search_fiber = GameFiber.StartNew(delegate
                {
                    Thread.Sleep(2500);
                    string name     = input_name.Text.ToLower();
                    List <Ped> peds = World.GetAllPeds().ToList();
                    peds.RemoveAll(p => !p);
                    peds.OrderBy(p => p.DistanceTo(Game.LocalPlayer.Character.Position));
                    Ped ped = peds.Where(p => p && Functions.GetPersonaForPed(p).FullName.ToLower() == name).FirstOrDefault();

                    if (ped)
                    {
                        output_info.Text = GetFormattedInfoForPed(ped);
                        Function.AddPedToRecents(ped);
                    }
                    else
                    {
                        output_info.Text = "No record for the specified name was found.";
                    }
                });
            }
        }
Ejemplo n.º 26
0
        public override void InitializeLayout()
        {
            //You can customize the initial position of your window
            this.Position =
                new System.Drawing.Point(1,
                                         Game.Resolution.Height / 2 - this.Size.Height / 2);

            //In this loop we check if the window was closed, it let you to save
            //the data inside text boxes etc. to prevent it being removed when
            //player click at the red X. You can remove this check.
            GameFiber.StartNew(delegate
            {
                while (true)
                {
                    if (!this.Window.IsVisible)
                    {
                        GwenForm_Example.EntryPoint.sName = tbName.Text;

                        break;
                    }
                    GameFiber.Yield();
                }
            });

            tbName.Text = GwenForm_Example.EntryPoint.sName;

            btnAccept.Clicked += btnAccept_Clicked;

            base.InitializeLayout();
        }
Ejemplo n.º 27
0
 private void KeepStoreClearedFromUnrelatedPeds()
 {
     GameFiber.StartNew(delegate
     {
         while (CalloutRunning)
         {
             GameFiber.Yield();
             Game.SetRelationshipBetweenRelationshipGroups("COP", "ROBBERS", Relationship.Hate);
             Game.SetRelationshipBetweenRelationshipGroups("ROBBERS", "COP", Relationship.Hate);
             Game.SetRelationshipBetweenRelationshipGroups("ROBBERS", "PLAYER", Relationship.Hate);
             Game.SetRelationshipBetweenRelationshipGroups("PLAYER", "ROBBERS", Relationship.Hate);
             Game.SetRelationshipBetweenRelationshipGroups("ROBBERS", "SHOPKEEPERS", Relationship.Hate);
             Game.SetRelationshipBetweenRelationshipGroups("SHOPKEEPERS", "ROBBERS", Relationship.Hate);
             if (DeletingNearbyEntities)
             {
                 foreach (Entity ent in World.GetEntities(SpawnPoint, 10f, GetEntitiesFlags.ConsiderAllPeds | GetEntitiesFlags.ExcludePlayerPed | GetEntitiesFlags.ExcludePoliceOfficers))
                 {
                     if (ent.Exists())
                     {
                         Ped ped = (Ped)ent;
                         if (!RelatedEntities.Contains(ent) && ent.Model != new Model("S_M_M_PARAMEDIC_01") && ped.RelationshipGroup != "COP")
                         {
                             if (NativeFunction.Natives.GET_INTERIOR_FROM_ENTITY <int>(ent) != 0)
                             {
                                 ent.Delete();
                             }
                         }
                     }
                 }
             }
         }
     });
 }
        private void ContinueDrivingTask()
        {
            GameFiber.StartNew(delegate
            {
                var sw = new Stopwatch();
                sw.Start();

                while (_copList.Count > 0 && _copList.Any(c => c.Ped && !c.IsSecondCop && c.Ped.DistanceTo(c.TargetPosition.Spawn) > 7f) || sw.Elapsed.Seconds < 15)
                {
                    foreach (var cop in _copList.Where(c => c.Position.DistanceTo(c.TargetPosition.Spawn) <= 7f && c.Ped.IsInAnyVehicle(false)))
                    {
                        if (!cop.Ped)
                        {
                            return;
                        }
                        if (MathHelper.GetRandomInteger(3) == 1 && !cop.IsSecondCop)
                        {
                            cop.TurnOnSiren();
                        }
                        cop.ExitVehicle();
                        cop.SetNotBusy();
                        if (cop.IsSecondCop)
                        {
                            cop.Ped.Tasks.GoToOffsetFromEntity(Game.LocalPlayer.Character, MathHelper.GetRandomSingle(0, 4f),
                                                               MathHelper.GetRandomSingle(0, 4f), 8f);
                        }
                    }
                    GameFiber.Yield();
                    if (this.HasFinished)
                    {
                        break;
                    }
                }
            });
        }
 public static void HandleAll(List <I_RealPoliceHandler> handlers)
 {
     foreach (I_RealPoliceHandler handler in handlers)
     {
         _Fibers.Add(GameFiber.StartNew(handler.Handle));
     }
 }
        public static void DisplayKeyboard_RunInsuranceCheckOnName()
        {
            if (!IsKeyboardActive)
            {
                GameFiber.StartNew(delegate
                {
                    IsKeyboardActive = true;
                    Traffic_Policer.API.Functions.SetAutomaticVehicleDeatilsChecksEnabled(false);
                    NativeFunction.Natives.DISPLAY_ONSCREEN_KEYBOARD(0, "FMMC_KEY_TIP", "", "", "", "", "", 20);
                    Game.LocalPlayer.Character.Tasks.PlayAnimation("random@arrests", "generic_radio_chatter", 1.5f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop);
                    while (NativeFunction.Natives.UPDATE_ONSCREEN_KEYBOARD <int>() == 0)
                    {
                        GameFiber.Yield();
                        //Game.LogTrivial("UPDATEONSCREENKEYBOARD: " + NativeFunction.Natives.UPDATE_ONSCREEN_KEYBOARD<int>().ToString());
                        Game.DisplaySubtitle("~h~Enter a name", 50);
                    }

                    IsKeyboardActive = false;
                    if (NativeFunction.Natives.UPDATE_ONSCREEN_KEYBOARD <int>() == 1)
                    {
                        string input = NativeFunction.Natives.GET_ONSCREEN_KEYBOARD_RESULT <string>();
                        input        = input.ToLower();
                        //Game.LogTrivial("INPUT: " + input);
                        BritishPersona.RunInsuranceCheckOnName(input);
                    }
                    GameFiber.Wait(1000);
                    Game.LocalPlayer.Character.Tasks.Clear();
                    Traffic_Policer.API.Functions.SetAutomaticVehicleDeatilsChecksEnabled(true);
                });
            }
        }