Ejemplo n.º 1
0
        void SwitchActivation()
        {
            GTA.UI.ShowSubtitle(string.Format("No Clip {0}!", ((Activated = !Activated) ? "~g~Activated" : "~r~Deactivated")));
            Function.Call(Hash.SET_PED_STEALTH_MOVEMENT, MyPed.Handle, 0, 0);
            Entity EntityToMod = MyPed.IsInVehicle() ? (Entity)MyPed.CurrentVehicle : (Entity)MyPed;

            if (!Activated)
            {
                EntityToMod.FreezePosition = false;
                if (MyPed.IsInVehicle())
                {
                    EntityToMod.ApplyForce(Vector3.Zero);
                }
            }
            else
            {
                EntityToMod.Position = EntityToMod.Position;
            }
        }
Ejemplo n.º 2
0
        void UpdateNoClip()
        {
            //Low level function by ap ii intense

            Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, 26, true);
            Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, 79, true);
            Function.Call(Hash.DISABLE_CONTROL_ACTION, 2, 37, true);

            if (Function.Call <bool>(Hash.IS_DISABLED_CONTROL_JUST_PRESSED, 2, 227))
            {
                SwitchSpeed(true);
            }
            else if (Function.Call <bool>(Hash.IS_DISABLED_CONTROL_JUST_PRESSED, 2, 226))
            {
                SwitchSpeed(false);
            }


            bool UsingVehicle = false;
            int  IDToFly      = 0;

            if (UsingVehicle = MyPed.IsInVehicle())
            {
                IDToFly = MyVehicle.Handle;
            }
            else
            {
                IDToFly = MyPed.Handle;
            }


            if (!UsingVehicle)
            {
                if (Function.Call <bool>(Hash.GET_PED_STEALTH_MOVEMENT, IDToFly))
                {
                    Function.Call(Hash.SET_PED_STEALTH_MOVEMENT, IDToFly, 0, 0);
                }
                if (Function.Call <bool>(Hash.GET_PED_COMBAT_MOVEMENT, IDToFly))
                {
                    Function.Call(Hash.SET_PED_COMBAT_MOVEMENT, IDToFly, 0);
                }
            }

            Function.Call(Hash.SET_ENTITY_HEADING, IDToFly, GameplayCamera.Rotation.Z);
            GameplayCamera.RelativeHeading = 0f;
            Function.Call(Hash.SET_GAMEPLAY_CAM_RELATIVE_PITCH, GameplayCamera.RelativePitch, 0f);
            Function.Call(Hash.FREEZE_ENTITY_POSITION, IDToFly, true);

            float LeftAxisX = Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 218);
            float LeftAxisY = Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 219);
            float lt        = Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 207);
            float rt        = Function.Call <float>(Hash.GET_CONTROL_NORMAL, 2, 208);

            float newLeftAxisY = LeftAxisY * -1.0f * RangeANDSpeed;
            float newLt        = lt * -1.0f * RangeANDSpeed;
            float newRt        = rt * RangeANDSpeed + newLt;

            if (!Keyboard.IsKeyDown(Globals.MoveUpKey) && !Keyboard.IsKeyDown(Globals.MoveDownKey))
            {
                if (LeftAxisX == 0 && LeftAxisY == 0 && lt == 0 && rt == 0)
                {
                    return;
                }
            }
            else
            {
                if (Keyboard.IsKeyDown(Globals.MoveUpKey))
                {
                    newRt = 1.0f * RangeANDSpeed;
                }
                if (Keyboard.IsKeyDown(Globals.MoveDownKey))
                {
                    newRt = -1.0f * RangeANDSpeed;
                }
            }

            Vector3 unitCircle = Function.Call <Vector3>(Hash.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS, IDToFly, LeftAxisX * RangeANDSpeed, newLeftAxisY, newRt);

            Function.Call(Hash.SET_ENTITY_COORDS_NO_OFFSET, IDToFly, unitCircle.X, unitCircle.Y, unitCircle.Z, 0, 0, 0);
        }