Пример #1
0
        /// <summary>
        /// Request transport for the nearest suspect that has transport on standby. If multiple suspects are available, requests multi transport automatically. Returns a bool indicating whether requesting transport was successful.
        /// </summary>
        /// <returns>Returns a bool indicating whether requesting transport was successful.</returns>
        public static bool RequestTransport()
        {
            if (EntryPoint.canChoose && EntryPoint.suspectAPI != null && EntryPoint.suspectsArrestedByPlayer.Contains(EntryPoint.suspectAPI) && !EntryPoint.suspectsPendingTransport.Contains(EntryPoint.suspectAPI))
            {
                if (EntryPoint.twoSuspectsApi.Count == 2 && !ExtensionMethods.IsPointOnWater(Game.LocalPlayer.Character.Position))
                {
                    if (EntryPoint.twoSuspectsApi[0].Exists() && EntryPoint.twoSuspectsApi[1].Exists() && EntryPoint.suspectsArrestedByPlayer.Contains(EntryPoint.twoSuspectsApi[0]) &&
                        EntryPoint.suspectsArrestedByPlayer.Contains(EntryPoint.twoSuspectsApi[1]) && !EntryPoint.suspectsPendingTransport.Contains(EntryPoint.twoSuspectsApi[0]) &&
                        !EntryPoint.suspectsPendingTransport.Contains(EntryPoint.twoSuspectsApi[1]))
                    {
                        if (Vector3.Distance(EntryPoint.twoSuspectsApi[0].Position, EntryPoint.twoSuspectsApi[1].Position) < 25f)
                        {
                            Game.LogTrivial("API detected multi transport - calling");
                            EntryPoint.TransportMenu.Visible          = true;
                            EntryPoint.TransportMenu.CurrentSelection = 2;
                            return(true);
                        }
                    }
                }

                EntryPoint.canChoose = false;
                Game.LogTrivial("API detected single transport - calling");
                Game.RemoveNotification(EntryPoint.multiVanOnStandbyMsg);
                Game.RemoveNotification(EntryPoint.vanOnStandbyMsg);
                Ped     officer;
                Vehicle van;
                if (EntryPoint.RecruitNearbyOfficer(out officer, out van))
                {
                    Game.LogTrivial("Recruited Officer");
                    EntryPoint.SuspectTransporterRecruitedOfficer(officer, van);
                }
                else if (ExtensionMethods.IsPointOnWater(Game.LocalPlayer.Character.Position))
                {
                    Game.LogTrivial("API detected boat transport.");
                    EntryPoint.BoatTransport();
                }
                else
                {
                    EntryPoint.SuspectTransporterNewOfficer();
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }