Ejemplo n.º 1
0
        private async Task Process()
        {
            Vehicle v = Game.PlayerPed?.CurrentVehicle;

            if (v != null)
            {
                Game.DisableControlThisFrame(0, _cruiseKey);

                if ((Game.IsDisabledControlJustReleased(0, _cruiseKey) || Game.IsControlJustReleased(0, _cruiseKey)) &&
                    v.CurrentGear != 0 && !_vehClassesWithoutCruiseControl.Contains(v.ClassType)) // current gear of 0 is reverse.
                {
                    _cruising = !_cruising;

                    if (_cruising)
                    {
                        CruiseAtSpeed(v.Speed);
                        _rpm = v.CurrentRPM;
                    }
                }
            }
            else if (_cruising)
            {
                _cruising = false;
            }
            else
            { // Not in a veh, check periodically.
                await Delay(100);
            }
        }
Ejemplo n.º 2
0
        /* Every Tick this one is called */
        public async Task OnTick()
        {
            await Task.FromResult(0);

            this.menus.ProcessMenus();

            // Since FiveM does not use an interaction menu we can just
            // override it here.
            if (Game.IsControlJustReleased(0, Control.InteractionMenu))
            {
                this.menus.ToggleInteractionMenu();
            }
        }
Ejemplo n.º 3
0
        public async Task OnTick()
        {
            //Disabling police
            if (Game.Player.WantedLevel > 0)
            {
                Game.Player.WantedLevel = 0;
            }

            //Showing help notifications after pressing "M"
            if (Game.IsControlJustReleased(0, Control.InteractionMenu))
            {
                //Draw notification with instructions
                Screen.ShowNotification(instructions);
            }

            //Display the target information after pressing "TAB"
            if (Game.IsControlJustReleased(0, Control.SelectWeapon))
            {
                //Get target and disable the ability to get target again for 5.1 seconds
                if (canGetTarget)
                {
                    DrawMugShot();
                    canGetTarget = false;
                    DisableGetTarget();
                }
                else
                {
                    Screen.ShowNotification("Wait for notifications to disappear before displaying the target again.");
                }
            }

            //If target has died - change the target to null
            if (assasinationTarget != null)
            {
                if (assasinationTarget.IsDead)
                {
                    assasinationTarget     = null;
                    assasinationTargetName = " ";
                    //Notify the player about target change
                    DeathNotif();
                }
            }

            //Draw walls marking the game area
            //They are drawn around a small plaza in town
            //You need to create proper spawnpoints in map.lua on server's map
            DrawLine(new Vector3(75.3503f, -1010.71f, 31f), new Vector3(152.691f, -776.014f, 31f), new Vector4(255, 0, 0, 255));
            DrawLine(new Vector3(320.22f, -827.823f, 31f), new Vector3(152.691f, -776.014f, 31f), new Vector4(255, 0, 0, 255));
            DrawLine(new Vector3(320.22f, -827.823f, 31f), new Vector3(232.6191f, -1080.6f, 31f), new Vector4(255, 0, 0, 255));
            DrawLine(new Vector3(75.3503f, -1010.71f, 31f), new Vector3(232.6191f, -1080.6f, 31f), new Vector4(255, 0, 0, 255));
        }
Ejemplo n.º 4
0
        /*
         *
         * List<VehicleClass> vehClassesWithoutCruiseControl = new List<VehicleClass>
         * {
         *  VehicleClass.Cycles,
         *  VehicleClass.Motorcycles,
         *  VehicleClass.Planes,
         *  VehicleClass.Helicopters,
         *  VehicleClass.Boats,
         *  VehicleClass.Trains
         * };
         *
         */

        private async Task Process()
        {
            if (Game.PlayerPed.CurrentVehicle != null)
            { // In a veh.
                Vehicle v = Game.PlayerPed.CurrentVehicle;

                Game.DisableControlThisFrame(0, _cruiseKey);

                if ((Game.IsDisabledControlJustReleased(0, _cruiseKey) || Game.IsControlJustReleased(0, _cruiseKey)) &&
                    Game.CurrentInputMode == InputMode.MouseAndKeyboard && v.CurrentGear != 0) //vehClassesWithoutCruiseControl.IndexOf(_vehClass) != -1
                {                                                                              // Cruise key just released using mouse&keyboard, NOT gamepad.
                    _cruising = !_cruising;                                                    // toggle cruising mode.

                    if (_cruising)
                    {
                        CruiseAtSpeed(v.Speed);
                    }
                }
            }
            else
            { // Not in a veh, check periodically.
                await Delay(1000);
            }
        }