Example #1
0
        private void TickEvent(List <Events.TickNametagData> nametags)
        {
            // Check if the player is connected
            if (!playerLogged)
            {
                return;
            }

            DateTime dateTime = DateTime.UtcNow;

            if (Vehicles.lastPosition != null)
            {
                // Update the speedometer
                Vehicles.UpdateSpeedometer();
            }

            // Update the player's money each 450ms
            if (dateTime.Ticks - lastTimeChecked.Ticks >= 4500000)
            {
                // Check if the player is loaded
                object money = Player.LocalPlayer.GetSharedData("PLAYER_MONEY");

                if (money != null)
                {
                    playerMoney     = Convert.ToInt32(money) + "$";
                    lastTimeChecked = dateTime;
                }
            }

            if (Fishing.fishingState > 0)
            {
                // Start the fishing minigame
                Fishing.DrawFishingMinigame();
            }

            // Draw the money
            RAGE.NUI.UIResText.Draw(playerMoney, 1900, 60, RAGE.Game.Font.Pricedown, 0.5f, Color.DarkOliveGreen, RAGE.NUI.UIResText.Alignment.Right, true, true, 0);

            // Check if the player
            if (RAGE.Game.Pad.IsControlJustPressed(0, (int)RAGE.Game.Control.VehicleSubPitchDownOnly) && Player.LocalPlayer.Vehicle != null)
            {
                // Check if the player is on a forklift
                Trucker.CheckPlayerStoredCrate();
            }

            // Detect if a key has been pressed
            int key = Keys.DetectPressedKey(dateTime.Ticks);

            if (key >= 0)
            {
                // Fire the event for the pressed key
                Keys.FireKeyPressed(key);
            }
        }
Example #2
0
        private void TickEvent(List <Events.TickNametagData> nametags)
        {
            // Get the current time
            DateTime dateTime = DateTime.UtcNow;

            // Check if the player is connected
            if (playerLogged)
            {
                // Disable hitting with the weapon
                RAGE.Game.Pad.DisableControlAction(0, 140, true);
                RAGE.Game.Pad.DisableControlAction(0, 141, true);

                if (Vehicles.lastPosition != null)
                {
                    if (Player.LocalPlayer.Vehicle == null)
                    {
                        // He fell from the vehicle, save the data
                        Vehicles.RemoveSpeedometerEvent(null);
                    }
                    else
                    {
                        // Update the speedometer
                        Vehicles.UpdateSpeedometer();
                    }
                }

                // Update the player's money each 450ms
                if (dateTime.Ticks - lastTimeChecked.Ticks >= 4500000)
                {
                    // Check if the player is loaded
                    object money = Player.LocalPlayer.GetSharedData(Constants.HAND_MONEY);

                    if (money != null)
                    {
                        playerMoney     = Convert.ToInt32(money) + "$";
                        lastTimeChecked = dateTime;
                    }
                }

                if (Fishing.fishingState > 0)
                {
                    // Start the fishing minigame
                    Fishing.DrawFishingMinigame();
                }

                // Draw the money
                RAGE.NUI.UIResText.Draw(playerMoney, 1900, 60, RAGE.Game.Font.Pricedown, 0.5f, Color.DarkOliveGreen, RAGE.NUI.UIResText.Alignment.Right, true, true, 0);

                // Check if the player
                if (RAGE.Game.Pad.IsControlJustPressed(0, (int)RAGE.Game.Control.VehicleSubPitchDownOnly) && Player.LocalPlayer.Vehicle != null)
                {
                    // Check if the player is on a forklift
                    Trucker.CheckPlayerStoredCrate();
                }

                // Check if the player is handcuffed
                if (Police.handcuffed)
                {
                    RAGE.Game.Pad.DisableControlAction(0, 12, true);
                    RAGE.Game.Pad.DisableControlAction(0, 13, true);
                    RAGE.Game.Pad.DisableControlAction(0, 14, true);
                    RAGE.Game.Pad.DisableControlAction(0, 15, true);
                    RAGE.Game.Pad.DisableControlAction(0, 16, true);
                    RAGE.Game.Pad.DisableControlAction(0, 17, true);
                    RAGE.Game.Pad.DisableControlAction(0, 22, true);
                    RAGE.Game.Pad.DisableControlAction(0, 24, true);
                    RAGE.Game.Pad.DisableControlAction(0, 25, true);
                }
            }

            // Detect if a key has been pressed
            int key = Keys.DetectPressedKey(dateTime.Ticks);

            if (key >= 0)
            {
                // Fire the event for the pressed key
                Keys.FireKeyPressed(key);
            }
        }
Example #3
0
        private void TickEvent(List <Events.TickNametagData> nametags)
        {
            // Get the current time
            var dateTime = DateTime.UtcNow;

            // Check if the player is connected
            if (playerLogged)
            {
                // Disable reloading
                Pad.DisableControlAction(0, 140, true);

                if (Vehicles.lastPosition != null)
                {
                    if (Player.LocalPlayer.Vehicle == null)
                    {
                        Vehicles.RemoveSpeedometerEvent(null);
                    }
                    else
                    {
                        Vehicles.UpdateSpeedometer();
                    }
                }

                // Update the player's money each 450ms
                if (dateTime.Ticks - lastTimeChecked.Ticks >= 4500000)
                {
                    // Check if the player is loaded
                    var money = Player.LocalPlayer.GetSharedData(Constants.HAND_MONEY);

                    if (money != null)
                    {
                        playerMoney     = Convert.ToInt32(money) + "$";
                        lastTimeChecked = dateTime;
                    }
                }

                if (Fishing.fishingState > 0)
                {
                    Fishing.DrawFishingMinigame();
                }

                // Draw the money
                UIResText.Draw(playerMoney, 1900, 60, Font.Pricedown, 0.5f, Color.DarkOliveGreen,
                               UIResText.Alignment.Right, true, true, 0);

                // Check if the player
                if (Pad.IsControlJustPressed(0, (int)Control.VehicleSubPitchDownOnly) &&
                    Player.LocalPlayer.Vehicle != null)
                {
                    Trucker.CheckPlayerStoredCrate();
                }

                // Check if the player is handcuffed
                if (Police.handcuffed)
                {
                    Pad.DisableControlAction(0, 12, true);
                    Pad.DisableControlAction(0, 13, true);
                    Pad.DisableControlAction(0, 14, true);
                    Pad.DisableControlAction(0, 15, true);
                    Pad.DisableControlAction(0, 16, true);
                    Pad.DisableControlAction(0, 17, true);
                    Pad.DisableControlAction(0, 22, true);
                    Pad.DisableControlAction(0, 24, true);
                    Pad.DisableControlAction(0, 25, true);
                }
            }

            // Detect if a key has been pressed
            var key = Keys.DetectPressedKey(dateTime.Ticks);

            if (key >= 0)
            {
                Keys.FireKeyPressed(key);
            }
        }