//public static string DownloadText(string url)
        //{
        //    System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
        //    System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();

        //    string text;

        //    using (StreamReader reader = new StreamReader(response.GetResponseStream()))
        //        text = reader.ReadToEnd();

        //    return text;
        //}

        /// <summary>
        /// Starts a particle effect on entity
        /// </summary>
        /// <param name="ptfxAsset">Particle asset</param>
        /// <param name="effectName">Particle effect name</param>
        /// <param name="entity">Entity to create the particle on</param>
        /// <param name="offset">Entity offset</param>
        /// <param name="rotation">Particle rotation</param>
        /// <param name="scale">Particle scale</param>
        public static void StartParticleFxNonLoopedOnEntity(string ptfxAsset, string effectName, Entity entity, Vector3 offset, Rotator rotation, float scale)
        {
            ulong HasNamedPtfxAssetLoadedHash = 0x8702416e512ec454;
            ulong SetPtfxAssetNextCall        = 0x6c38af3693a69a91;
            ulong RequestNamedPtfxAsset       = 0xb80d8756b4668ab6;

            NativeFunction.CallByHash <uint>(RequestNamedPtfxAsset, ptfxAsset);
            while (!NativeFunction.CallByHash <bool>(HasNamedPtfxAssetLoadedHash, ptfxAsset))
            {
                GameFiber.Sleep(25);
                NativeFunction.CallByHash <uint>(RequestNamedPtfxAsset, ptfxAsset);
                GameFiber.Yield();
            }

            NativeFunction.CallByHash <uint>(SetPtfxAssetNextCall, ptfxAsset);
            NativeFunction.CallByName <uint>("START_PARTICLE_FX_NON_LOOPED_ON_ENTITY", effectName, entity, offset.X, offset.Y, offset.Z, rotation.Pitch, rotation.Roll, rotation.Yaw, scale, false, false, false);
        }
示例#2
0
 private static void MenuMainLogic()
 {
     GameFiber.StartNew(delegate
     {
         GameFiber.Yield();
         Game.LogTrivial("StartedMainMenuLogic");
         while (true)
         {
             GameFiber.Yield();
             if (Game.IsKeyDown(Keys.F12))
             {
                 mainMenu.Visible = !mainMenu.Visible;
             }
             _menuPool.ProcessMenus();
         }
     });
 }
        public override void OnBeforeStartEvent()
        {
            bool isStolenCar = Tools.HavingChance(1, 10);

            this.Vehicle.IsPersistent        = true;
            this.Driver.BlockPermanentEvents = true;
            this.Driver.IsPersistent         = true;

            if (false == isStolenCar && Tools.HavingChance(1, 10))
            {
                AnimationSet drunkAnimation = new AnimationSet("move_m@drunk@verydrunk");
                drunkAnimation.LoadAndWait();
                this.Driver.MovementAnimationSet = drunkAnimation;
                Rage.Native.NativeFunction.Natives.SET_PED_IS_DRUNK(this.Driver, true);
                this.OldSpeed = this.Vehicle.Speed;
                float newSpeed = this.OldSpeed - 4;
                if (this.OldSpeed <= 20F)
                {
                    newSpeed = 70F;
                }
                else
                {
                    if (this.OldSpeed <= 60)
                    {
                        newSpeed = 5F;
                    }
                }
                this.Driver.Tasks.CruiseWithVehicle(this.Vehicle, newSpeed, (VehicleDrivingFlags.FollowTraffic | VehicleDrivingFlags.YieldToCrossingPedestrians | VehicleDrivingFlags.AllowWrongWay));
                GameFiber.StartNew(delegate //Add fiber and clean after !
                {
                    while (this.IsEventRunning)
                    {
                        Rage.Native.NativeFunction.Natives.SET_DRIVE_TASK_DRIVING_STYLE(this.Driver, 786603); //Drunk driving style
                        GameFiber.Yield();
                    }
                });
            }
            else
            {
                if (isStolenCar)
                {
                    this.Vehicle.IsStolen = true;
                }
            }
        }
示例#4
0
        protected override void Main()
        {
            Game.DisplaySubtitle("Loaded Player Fly Component");

            while (true)
            {
                Game.LocalPlayer.WantedLevel         = 0;
                Game.LocalPlayer.IsIgnoredByEveryone = true;
                Game.LocalPlayer.IsIgnoredByPolice   = true;

                HandleKeyboardState();

                var velocity = Game.LocalPlayer.Character.Velocity;
                //Game.DisplaySubtitle($"({velocity.X:F2}, {velocity.Y:F2}, {velocity.Z:F2}); in air: {(Game.LocalPlayer.Character.IsInAir ? "yes" : "no")}");

                GameFiber.Yield();
            }
        }
示例#5
0
        private void OnFIButtonClick(Gwen.Control.Base sender, Gwen.Control.ClickedEventArgs e)
        {
            GameFiber.StartNew(delegate
            {
                GameFiber.Sleep(0500);
                Game.LogTrivial("Loading FIs -- Based on CitationForm");
                GwenForm FIForm = new FIEnvironmentCode2();
                Game.IsPaused   = true;
                FIForm.Show();
                FIForm.Position = new System.Drawing.Point(500, 250);
                while (FIForm.Window.IsVisible)
                {
                    GameFiber.Yield();
                }

                Game.IsPaused = true;
            });
        }
示例#6
0
 private void OnPoliceNotebookClick(Gwen.Control.Base sender, Gwen.Control.ClickedEventArgs e)
 {
     Game.LogTrivial("Loading Police Notebook via MDT");
     GameFiber.StartNew(delegate
     {
         GameFiber.Sleep(0500);
         Rage.Forms.GwenForm PNotebook = new NotebookCode2();
         Game.IsPaused = true;
         PNotebook.Show();
         PNotebook.Position = new System.Drawing.Point(900, 100);
         while (PNotebook.Window.IsVisible)
         {
             Game.IsPaused = true;
             GameFiber.Yield();
         }
         Game.IsPaused = false;
     });
 }
示例#7
0
        private static void CameraMove()
        {
            Game.DisplayHelp("Move your mouse to pan the camera\nUse the mouse wheel to zoom the camera\nTo exit this mode, press any key \n after you've found something useful");

            while (true)
            {
                float moveSpeed = (_secCam.FOV / 100) * (Game.IsControllerConnected ? 3.5f : 5.25f);

                float yRotMagnitude = NativeFunction.CallByName <float>("GET_DISABLED_CONTROL_NORMAL", 0, (int)GameControl.LookUpDown) * moveSpeed;
                float xRotMagnitude = NativeFunction.CallByName <float>("GET_DISABLED_CONTROL_NORMAL", 0, (int)GameControl.LookLeftRight) * moveSpeed;

                float newPitch = _secCam.Rotation.Pitch - yRotMagnitude;
                float newYaw   = _secCam.Rotation.Yaw - xRotMagnitude;
                _secCam.Rotation = new Rotator((newPitch >= 25f || newPitch <= -70f) ? _secCam.Rotation.Pitch : newPitch, 0f, newYaw);

                GameFiber.Yield();
            }
        }
示例#8
0
        // Main
        public static void Main()
        {
            _TerritoryManager = new Territories.TerritoriesManager();
            _MenuManager      = new Menus.MenuManager();

            while (true)
            {
                GameFiber.Yield();
                if (MenuManager != null)
                {
                    MenuManager.Tick();
                }
                if (TerritoryManager != null)
                {
                    TerritoryManager.Tick();
                }
            }
        }
 private void StartTimer()
 {
     GameFiber.StartNew(delegate
     {
         var sw = new Stopwatch();
         sw.Start();
         while (Game.LocalPlayer.Character.Position.DistanceTo(_one) < 20f)
         {
             if (sw.Elapsed.Seconds > 30)
             {
                 CaseLost();
                 sw.Stop();
             }
             GameFiber.Yield();
         }
         sw.Stop();
     });
 }
示例#10
0
        public override void InitializeLayout()
        {
            base.InitializeLayout();
            this.Window.Skin.SetDefaultFont(Configs.FontName, Configs.FontSize);
            this.cb_toggle_background.IsChecked = Globals.ShowBackgroundWhenOpen;
            this.cb_toggle_pause.IsChecked      = Globals.PauseGameWhenOpen;
            this.btn_logout.Clicked            += this.LogoutButtonClickedHandler;
            this.btn_ped_db.Clicked            += this.PedDBButtonClickedHandler;
            this.btn_veh_db.Clicked            += this.VehDBButtonClickedHandler;
            this.btn_request.Clicked           += this.RequestBackupButtonClickedHandler;
            this.btn_notepad.Clicked           += OpenNotepadHandler;
            this.btn_citation_history.Clicked  += this.ReportsClickedHandler;
            this.btn_arrest_history.Clicked    += this.ReportsClickedHandler;

            EntryPoint.OnRecentTextAdded += RecentTextChangedHandler;

            this.cb_toggle_background.CheckChanged += checkbox_change;
            this.cb_toggle_pause.CheckChanged      += checkbox_change;
            this.Window.KeyboardInputEnabled        = true;

            GameFiber.StartNew(() =>
            {
                while (true)
                {
                    if (this.cb_toggle_pause.IsChecked != Globals.PauseGameWhenOpen)
                    {
                        this.cb_toggle_pause.IsChecked = Globals.PauseGameWhenOpen;
                    }
                    GameFiber.Yield();
                }
            });
            this.btn_activecalls.Clicked += this.ActiveCallsClickedHandler;
            this.Window.DisableResizing();
            RecentTextChangedHandler();
            this.Position = new Point(Game.Resolution.Width / 2 - this.Window.Width / 2, Game.Resolution.Height / 2 - this.Window.Height / 2);

            if (ShouldShowExtraUIControls)
            {
                ControlExternalUISelectVisibility(ShouldShowExtraUIControls);
                external_ui_default = list_external_ui.AddItem("Select One", "placeholder");
                Globals.SortedExternalUI.ToList().ForEach(x => list_external_ui.AddItem(x.DisplayName, x.Identifier.ToString()));
                list_external_ui.ItemSelected += ExternalUISelected;
            }
        }
示例#11
0
        private void ExternalUISelected(Base sender, ItemSelectedEventArgs arguments)
        {
            if (String.IsNullOrWhiteSpace(arguments.SelectedItem.Name) || arguments.SelectedItem.Name.Equals("placeholder"))
            {
                return;
            }
            Function.LogDebug(String.Format("External UI Selected {0}", arguments.SelectedItem.Name));
            System.Guid guid  = System.Guid.Parse(arguments.SelectedItem.Name);
            var         match = Globals.ExternalUI.DefaultIfEmpty(null).FirstOrDefault(x => x.Identifier == guid);

            if (match == null)
            {
                return;
            }
            list_external_ui.SelectedItem = external_ui_default;
            try
            {
                var fiber = GameFiber.StartNew(delegate
                {
                    var form = match.Creator();
                    if (form == null)
                    {
                        Game.DisplayNotification(String.Format("Empty form provided for {0}", match.DisplayName));
                        return;
                    }
                    form.Show();
                    if (match.OnOpen != null)
                    {
                        match.OnOpen();
                    }
                    Globals.ActiveExternalUI_ID = match.Identifier;
                });
                while (fiber.IsAlive && !fiber.IsHibernating)
                {
                    GameFiber.Yield();
                }
                match.OnClose();
            }
            catch (Exception e)
            {
                Function.Log(String.Format("Error while initializing extra form {0}", match.DisplayName));
                Function.Log(e.Message);
            }
        }
示例#12
0
        public static SpawnPoint GetVehicleSpawnPointTowardsPositionWithChecks(this Vector3 StartPoint, float SpawnDistance)
        {
            SpawnPoint sp           = new SpawnPoint();
            bool       UseSpecialID = true;
            float      travelDistance;
            int        waitCount = 0;

            while (true)
            {
                GetVehicleSpawnPointTowardsStartPoint(StartPoint, SpawnDistance, UseSpecialID, out sp);
                travelDistance = Rage.Native.NativeFunction.Natives.CALCULATE_TRAVEL_DISTANCE_BETWEEN_POINTS <float>(sp.Position.X, sp.Position.Y, sp.Position.Z, StartPoint.X, StartPoint.Y, StartPoint.Z);
                waitCount++;
                if (Vector3.Distance(StartPoint, sp) > SpawnDistance - 15f)
                {
                    if (travelDistance < (SpawnDistance * 4.5f))
                    {
                        Vector3 directionFromVehicleToPed1 = (StartPoint - sp.Position);
                        directionFromVehicleToPed1.Normalize();

                        float HeadingToPlayer = MathHelper.ConvertDirectionToHeading(directionFromVehicleToPed1);

                        if (Math.Abs(MathHelper.NormalizeHeading(sp.Heading) - MathHelper.NormalizeHeading(HeadingToPlayer)) < 150f)
                        {
                            break;
                        }
                    }
                }
                if (waitCount >= 400)
                {
                    UseSpecialID = false;
                }
                if (waitCount == 600)
                {
                    Game.DisplayNotification("Press ~b~Y ~s~to force a spawn in the ~g~wilderness.");
                }
                if ((waitCount >= 600) && Albo1125.Common.CommonLibrary.ExtensionMethods.IsKeyDownComputerCheck(Keys.Y))
                {
                    return(new SpawnPoint(Game.LocalPlayer.Character.Position.Around2D(20f), 0));
                }

                GameFiber.Yield();
            }
            return(sp);
        }
示例#13
0
        private UpdateChecker(string ModificationName, Version curVersion, string FileID, string DownloadLink)
        {
            try
            {
                Game.LogTrivial("Albo1125.Common " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + ", developed by Albo1125. Checking for " + ModificationName + " updates.");

                Thread FetchVersionThread = new Thread(() =>
                {
                    using (WebClient client = new WebClient())
                    {
                        try
                        {
                            string s = client.DownloadString("http://www.lcpdfr.com/applications/downloadsng/interface/api.php?do=checkForUpdates&fileId=" + FileID + "&textOnly=1");

                            NewVersion = new Version(s);
                        }
                        catch (Exception e) { LSPDFRUpdateAPIRunning = false; Game.LogTrivial("LSPDFR Update API down. Aborting checks."); }
                    }
                });
                FetchVersionThread.Start();
                while (FetchVersionThread.ThreadState != System.Threading.ThreadState.Stopped)
                {
                    GameFiber.Yield();
                }

                // compare the versions
                if (curVersion.CompareTo(NewVersion) < 0)
                {
                    // ask the user if he would like
                    // to download the new version
                    PluginsDownloadLink.Add(ModificationName, DownloadLink);
                    Game.LogTrivial("Update available for " + ModificationName);
                }
            }
            catch (ThreadAbortException)
            {
                Game.LogTrivial("Aborting thread");
            }
            catch (Exception e)
            {
                Game.LogTrivial("Error while checking " + ModificationName + " for updates.");
                Game.LogTrivial(e.ToString());
            }
        }
示例#14
0
        private void OnOffsetsComboBoxItemSelected(object sender, ItemSelectedEventArgs e)
        {
            ComboBox c            = ((ComboBox)Window.FindChildByName("OffsetsComboBox", true));
            MenuItem selectedItem = ((MenuItem)e.SelectedItem);

            if (selectedItem.Name == c.Name + "ItemNew")
            {
                GameFiber.StartNew(() =>
                {
                    InputTextForm f = new InputTextForm("Enter model name...");
                    f.Show();
                    f.Window.MakeModal();
                    while (f.Window.IsVisible)
                    {
                        GameFiber.Yield();
                    }
                    if (!f.Cancelled)
                    {
                        string n       = f.Input;
                        c.SelectedItem = c.AddItem(n);
                    }
                    else
                    {
                        c.SelectByName(c.Name + "Item1");
                    }
                });
            }
            else
            {
                string  selectedModel = selectedItem.Text;
                Vector3 v             = Vector3.Zero;
                bool    b             = false;
                if (Plugin.Settings.Vehicles.Data.ContainsKey(selectedModel))
                {
                    v = Plugin.Settings.Vehicles.Data[selectedModel].Offset;
                    b = Plugin.Settings.Vehicles.Data[selectedModel].DisableTurret;
                }

                ((NumericUpDownEx)Window.FindChildByName("OffsetsXNumUpDown", true)).Value         = v.X;
                ((NumericUpDownEx)Window.FindChildByName("OffsetsYNumUpDown", true)).Value         = v.Y;
                ((NumericUpDownEx)Window.FindChildByName("OffsetsZNumUpDown", true)).Value         = v.Z;
                ((CheckBox)Window.FindChildByName("OffsetsDisableTurretCheckBox", true)).IsChecked = b;
            }
        }
示例#15
0
        private static void Main()
        {
            while (true)
            {
                Vehicle vehicle = Game.LocalPlayer.Character.CurrentVehicle;

                if (vehicle.Exists())
                {
                    if (vehicle.Speed <= StoppedSpeed)
                    {
                        bool engineOn          = vehicle.IsEngineOn || vehicle.IsEngineStarting;
                        bool vehicleStationary = vehicle.AccelerationScale == 0f;
                        NativeFunction.CallByName <uint>("SET_VEHICLE_BRAKE_LIGHTS", vehicle, engineOn && vehicleStationary);
                    }
                }

                GameFiber.Yield();
            }
        }
示例#16
0
        public Elements() : base(Plugin.MenuTitle, "ELEMENTS")
        {
            Plugin.Pool.Add(this);

            CreateMenuItems();

            GameFiber.StartNew(() =>
            {
                while (true)
                {
                    GameFiber.Yield();

                    foreach (var e in elements)
                    {
                        e.Draw();
                    }
                }
            });
        }
示例#17
0
 private void WaitForParkAndGetNearby()
 {
     while (CalloutRunning)
     {
         GameFiber.Yield();
         PoliceCar.ShouldVehiclesYieldToThisVehicle = false;
         if (!Game.LocalPlayer.Character.IsInAnyVehicle(false))
         {
             if (Vector3.Distance(Game.LocalPlayer.Character.Position, PoliceOfficer.Position) < 6f)
             {
                 if (PoliceOfficer.IsInVehicle(PoliceCar, false))
                 {
                     PoliceOfficer.Tasks.LeaveVehicle(LeaveVehicleFlags.LeaveDoorOpen);
                     break;
                 }
             }
         }
     }
 }
示例#18
0
        public static void InsertVehicle(DBVehicle dbVehicle)
        {
            SQLiteConnection connection = new SQLiteConnection();

            connection.ConnectionString = "Data Source=" + DatabaseManager.dataSource;
            connection.Open();

            SQLiteCommand command = new SQLiteCommand(connection);

            command.CommandText = "INSERT INTO DBVehicle VALUES(@vehiclePlate, @tankful)";
            command.Parameters.Add(new SQLiteParameter("vehiclePlate", dbVehicle.vehiclePlate));
            command.Parameters.Add(new SQLiteParameter("tankful", dbVehicle.tankful.ToString("G")));
            command.ExecuteNonQuery();

            command.Dispose();
            connection.Close();
            connection.Dispose();
            GameFiber.Yield();
        }
示例#19
0
        public static void UpdateVehicle(DBVehicle dbVehicle, float tankful)
        {
            SQLiteConnection connection = new SQLiteConnection();

            connection.ConnectionString = "Data Source=" + DatabaseManager.dataSource;
            connection.Open();
            SQLiteCommand command = new SQLiteCommand(connection);

            command.CommandText = "UPDATE DBVehicle SET tankful = @tankful " +
                                  "WHERE vehiclePlate = @vehiclePlate";
            command.Parameters.Add(new SQLiteParameter("vehiclePlate", dbVehicle.vehiclePlate));
            command.Parameters.Add(new SQLiteParameter("tankful", dbVehicle.tankful.ToString("G")));
            command.ExecuteNonQuery();

            command.Dispose();
            connection.Close();
            connection.Dispose();
            GameFiber.Yield();
        }
示例#20
0
 void CheckForBinderEvents()
 {
     while (FiberCanRun)
     {
         if (EventTriggeredCallback != null && BoundKeys.Any(x => x.IsPressed))
         {
             if (MaxEvents.HasValue)
             {
                 EventsTriggered += 1;
             }
             EventTriggeredCallback();
         }
         GameFiber.Yield();
         if (MaxEvents.HasValue && MaxEvents.Value <= EventsTriggered)
         {
             GameFiber.Hibernate();
         }
     }
 }
 public override void OnProcessEvent()
 {
     this.HandleRecklessDrinving();
     if (this.IsPulledOverDriver())
     {
         Logger.Log("Police tips: ~b~Reckless driving", true);
         this.IsPerformedPullOver = true;
         this.IsEventRunning      = false;
         return;
     }
     GameFiber.Yield();
     if (PedsManager.IsAwayFromLocalPlayer(this.Driver.Position))
     {
         this.IsEventRunning = false;
         return;
     }
     this.HandleSafeEventRunning();
     GameFiber.Sleep(300);
 }
        private void DetectiveFiber()
        {
            var sw = new Stopwatch();

            sw.Start();

            Game.DisplayHelp("To request ~b~detectives~w~, press ~y~Y~w~ in the next five seconds\nOtherwise, ignore this message", 5100);
            while (sw.Elapsed.Seconds < 5)
            {
                GameFiber.Yield();

                if (!Game.IsKeyDown(Keys.Y))
                {
                    continue;
                }
                RequestDetectives();
                break;
            }
        }
示例#23
0
文件: Core.cs 项目: Aebian/SomeDebug
        public static void RunPlugin()

        {
            Logger.DebugLog("Core Plugin Function Started");

            //Game loop
            while (true)
            {
                GameFiber.Yield();

                if (Game.IsKeyDownRightNow(Global.Controls.CallDebugModifier) && Game.IsKeyDown(Global.Controls.CallDebug) || Global.Controls.CallDebugModifier == Keys.None && Game.IsKeyDown(Global.Controls.CallDebug))
                {
                    Global.Dynamics.CurrentPlayerPos     = Game.LocalPlayer.Character.Position;
                    Global.Dynamics.CurrentPlayerHeading = Game.LocalPlayer.Character.Heading;

                    DebugExecution();
                }
            }
        }
        public static void Main()
        {
            Game.FrameRender += Process;

            timerBarPool = new TimerBarPool();

            barTimerBar   = new BarTimerBar("BAR");
            textTimerBar  = new TextTimerBar("TIME", "00:00");
            textTimerBar2 = new TextTimerBar("SPEED", "0 km/h");

            timerBarPool.Add(barTimerBar);
            timerBarPool.Add(textTimerBar);
            timerBarPool.Add(textTimerBar2);

            while (true)
            {
                GameFiber.Yield();
            }
        }
 public void Show()
 {
     GameFiber.StartNew(delegate
     {
         var m = new MediaPlayer();
         m.Open(new Uri(Path.GetFullPath(@"Plugins/LSPDFR/LSNoir/Audio/Complete.wav")));
         m.HasAudio.ToString().AddLog();
         while (!m.HasAudio || m.IsBuffering)
         {
             GameFiber.Yield();
         }
         m.Volume = m.Volume / 2;
         "Playing audio".AddLog();
         m.Position = TimeSpan.Zero;
         m.NaturalDuration.ToString().AddLog();
         m.Play();
     });
     Visible = true;
 }
        private void CameraSwap()
        {
            if (_cam1 == false)
            {
                "Starting to swap cameras".AddLog();
                _cam1             = true;
                _swapCam          = new Camera(false);
                _swapCam.Position = new Vector3(_meCar.AbovePosition.X, _meCar.AbovePosition.Y, _meCar.AbovePosition.Z + 7);
                _swapCam.PointAtEntity(_meCar, Vector3.Zero, false);

                _gameCam          = new Camera(false);
                _gameCam.FOV      = NativeFunction.Natives.GET_GAMEPLAY_CAM_FOV <float>();
                _gameCam.Position = NativeFunction.Natives.GET_GAMEPLAY_CAM_COORD <Vector3>();
                Vector3 rot  = NativeFunction.Natives.GET_GAMEPLAY_CAM_ROT <Vector3>(0);
                var     rot1 = new Rotator(rot.X, rot.Y, rot.Z);
                _gameCam.Rotation = rot1;

                "Swapping camera".AddLog();
                _swapCam.Active = true;
                NativeFunction.Natives.DO_SCREEN_FADE_OUT(7500);
                Stopwatch sw = new Stopwatch();
                sw.Start();
                while (true)
                {
                    _swapCam.PointAtEntity(_meCar, Vector3.Zero, false);
                    if (NativeFunction.Natives.IS_SCREEN_FADED_OUT <bool>() == true)
                    {
                        "Screen faded, swapping stages".AddLog();
                        _swapCam.Active = false;
                        break;
                    }
                    GameFiber.Yield();
                }
                if (_transport)
                {
                    SwapStages(CameraSwap, Ending);
                }
                else
                {
                    SwapStages(CameraSwap, Transport);
                }
            }
        }
示例#27
0
        public void Load(bool waitToLoad)
        {
            if (_sc != null)
            {
                return;
            }
            _sc = new Scaleform(0);
            _sc.Load("MP_BIG_MESSAGE_FREEMODE");

            if (waitToLoad)
            {
                var timeout = 1000;
                var start   = System.DateTime.Now;
                while (!NativeFunction.Natives.HasScaleformMovieLoaded <bool>(_sc.Handle) && System.DateTime.Now.Subtract(start).TotalMilliseconds < timeout)
                {
                    GameFiber.Yield();
                }
            }
        }
示例#28
0
 private void CheckOpenCPlusOnFoot()
 {
     while (Globals.IsPlayerOnDuty)
     {
         try
         {
             GameFiber.Yield();
             if (!IsMainComputerOpen && Configs.OpenComputerPlusOnFoot.Any(x => x.IsPressed))
             {
                 startStandingWithTabletAnim();
                 ShowPoliceComputer();
             }
         }
         catch (Exception e)
         {
             //Function.Log(e.ToString());
         }
     }
 }
示例#29
0
        private static void Main()
        {
            while (Game.IsLoading)
            {
                GameFiber.Yield();
            }
            Game.LogTrivial("Enabling Player Loop...");
            var PlayerProcessFiber = new GameFiber(BackWeapon.PlayerLoop);

            PlayerProcessFiber.Start();
            if (enableAI)
            {
                Game.LogTrivial("Enabling AI Loop...");
                var AIProcessFiber = new GameFiber(BackWeapon.AIPedsLoop);
                AIProcessFiber.Start();
            }
            Game.LogTrivial("Stow That Weapon (BackWeapon.dll) by willpv23 has been loaded!");
            GameFiber.Hibernate();
        }
示例#30
0
        public void Load(bool waitToLoad)
        {
            if (_sc != null)
            {
                return;
            }
            _sc = new Scaleform(0);
            _sc.Load("MP_BIG_MESSAGE_FREEMODE");

            if (waitToLoad)
            {
                var timeout = 1000;
                var start   = System.DateTime.Now;
                while (!NativeFunction.CallByName <bool>("HAS_SCALEFORM_MOVIE_LOADED", _sc.Handle) && System.DateTime.Now.Subtract(start).TotalMilliseconds < timeout)
                {
                    GameFiber.Yield();
                }
            }
        }