Ejemplo n.º 1
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();
        }