Exemple #1
0
        private void OnPlayerWeaponShotEvent(Vector3 targetPos, Player target, Events.CancelEventArgs cancel)
        {
            // Calculate the weapon the player is holding
            var weaponHash = Weapon.GetSelectedPedWeapon(Player.LocalPlayer.Handle);

            // Get the bullets remaining
            var bullets = Player.LocalPlayer.GetAmmoInWeapon(weaponHash);

            // Update the weapon's bullet amount
            Events.CallRemote("updateWeaponBullets", bullets);
        }
Exemple #2
0
        private void ActivateVendingMachine()
        {
            if (IsUsingVendingMachine)
            {
                return;
            }

            int?handle = GetNearestVendingHandle();

            if (!handle.HasValue)
            {
                return;
            }

            Vector3 offsetFromWordCoords = GetVendingOffsetFromWordCoords(handle.Value);

            if (offsetFromWordCoords == null)
            {
                return;
            }

            Player.LocalPlayer.SetData("IsUsingVendingMachine", new Dictionary <int, bool> {
                { handle.Value, true }
            });

            Player.SetCurrentWeaponVisible(false, true, true, false);
            Player.SetStealthMovement(false, "DEFAULT_ACTION");
            Player.TaskLookAtEntity(handle.Value, 2000, 2048, 2);
            Player.SetResetFlag(322, true);
            Player.TaskGoStraightToCoord(offsetFromWordCoords.X, offsetFromWordCoords.Y, offsetFromWordCoords.Z, 1f, 20000, Entity.GetEntityHeading(handle.Value), 0.1f);

            while (Ai.GetScriptTaskStatus(Player.Handle, 2106541073) != 7 && !Player.IsAtCoord(offsetFromWordCoords.X, offsetFromWordCoords.Y, offsetFromWordCoords.Z, 0.1f, 0.0f, 0.0f, false, true, 0))
            {
                Invoker.Wait(0);
            }

            VendingAnimation.Start();
        }
Exemple #3
0
 /// <summary>
 /// Unregisters the <see cref="Events.Tick"/> to show money
 /// </summary>
 /// <param name="player"></param>
 /// <param name="reason"></param>
 /// <param name="killer"></param>
 /// <param name="cancel"></param>
 protected virtual void PlayerDeath(RAGE.Elements.Player player, uint reason, RAGE.Elements.Player killer, Events.CancelEventArgs cancel)
 {
     Events.Tick -= Render;
 }
Exemple #4
0
 /// <summary>
 /// Registers the <see cref="Events.Tick"/> to show money on the screen
 /// </summary>
 /// <param name="player"></param>
 protected void OnPlayerJoin(RAGE.Elements.Player player)
 {
     Chat.Output("Player joined");
     SetTickRender();
 }