EnableControlAction() public static méthode

public static EnableControlAction ( Control c, bool b ) : void
c Control
b bool
Résultat void
Exemple #1
0
 /// <summary>
 /// Disables all controls not enabled while using the console
 /// </summary>
 private void SetConsoleControls()
 {
     GTAFuncs.SetControlActions(false);
     GTAFuncs.EnableControlAction(Control.MoveLeftRight, true);
     GTAFuncs.EnableControlAction(Control.MoveUpDown, true);
     GTAFuncs.EnableControlAction(Control.VehicleAccelerate, true);
     GTAFuncs.EnableControlAction(Control.VehicleBrake, true);
     GTAFuncs.EnableControlAction(Control.VehicleDriveLook, true);
     GTAFuncs.EnableControlAction(Control.VehicleDriveLook2, true);
     GTAFuncs.EnableControlAction(Control.VehicleMoveLeftRight, true);
     GTAFuncs.EnableControlAction(Control.VehicleMoveUpDown, true);
     GTAFuncs.EnableControlAction(Control.LookLeftRight, true);
     GTAFuncs.EnableControlAction(Control.LookUpDown, true);
     GTAFuncs.EnableControlAction(Control.FlyUpDown, true);
     GTAFuncs.EnableControlAction(Control.FlyLeftRight, true);
     GTAFuncs.EnableControlAction(Control.VehicleFlyRollLeftRight, true);
     GTAFuncs.EnableControlAction(Control.VehicleFlyPitchUpDown, true);
     GTAFuncs.EnableControlAction(Control.VehicleFlyYawLeft, true);
     GTAFuncs.EnableControlAction(Control.VehicleFlyYawRight, true);
     GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleDown, true);
     GTAFuncs.EnableControlAction(Control.VehicleFlyThrottleUp, true);
 }
        private void OnTick(object sender, EventArgs e)
        {
            if (Game.Player.Character.IsInVehicle() || Game.Player.Character.IsSittingInVehicle())
            {
                var v = Game.Player.Character.CurrentVehicle;
                if (_godEnabled)
                {
                    v = new Vehicle(GTAFuncs.RequestEntityControl(v).Handle);
                    if (v != null)
                    {
                        v.BodyHealth          = v.MaxHealth;
                        v.EngineHealth        = v.MaxHealth;
                        v.PetrolTankHealth    = v.MaxHealth;
                        v.Health              = v.MaxHealth;
                        v.CanBeVisiblyDamaged = false;
                    }
                    GTAFuncs.SetEntityInvinc(v, true);
                }
                else
                {
                    GTAFuncs.SetEntityInvinc(v, false);
                }
            }

            if (_godEnabled)
            {
                Game.Player.Character.Health = Game.Player.Character.MaxHealth;
            }

            GTAFuncs.SetInvincTime(_godEnabled ? 30000 : 0);
            GTAFuncs.SetSPInvinc(_player, _godEnabled);

            if (GTAFuncs.IsWaypointActive())
            {
                _lastWaypoint = new Blip(GTAFuncs.GetFirstBlipInfoID((int)BlipSprite.Waypoint));
            }

            if (_noClipEnabled)
            {
                Game.Player.Character.Rotation = GameplayCamera.Rotation;

                GTAFuncs.SetEntityGravity(Game.Player.Character, false);
                GTAFuncs.SetEntityLoadColissionFlag(Game.Player.Character, false);
                GTAFuncs.SetEntityRecordsCollisions(Game.Player.Character, false);
                GTAFuncs.SetEntityCollision(Game.Player.Character, false, false);
                GTAFuncs.DisableControlAction(Control.MoveUp, true);
                GTAFuncs.DisableControlAction(Control.MoveDown, true);
                GTAFuncs.DisableControlAction(Control.MoveLeft, true);
                GTAFuncs.DisableControlAction(Control.MoveRight, true);
                GTAFuncs.DisableControlAction(Control.Attack, true);
                GTAFuncs.DisableControlAction(Control.Aim, true);

                var v = new Vector3(0, 0, 0);

                if (Game.Player.Character.IsInVehicle() || Game.Player.Character.IsSittingInVehicle())
                {
                    Game.Player.Character.Position = Game.Player.Character.Position;
                }

                if (GTAFuncs.GetControlNormal(Control.MoveUp) != 0)
                {
                    v += Vector3.Multiply(Game.Player.Character.ForwardVector,
                                          -25 * GTAFuncs.GetControlNormal(Control.MoveUp));
                }
                if (GTAFuncs.GetControlNormal(Control.MoveRight) != 0)
                {
                    v += Vector3.Multiply(Game.Player.Character.RightVector,
                                          25 * GTAFuncs.GetControlNormal(Control.MoveRight));
                }
                if (GTAFuncs.IsControlPressed(Control.Attack))
                {
                    v += Vector3.Multiply(Game.Player.Character.UpVector, 15);
                }
                if (GTAFuncs.IsControlPressed(Control.Aim))
                {
                    v += Vector3.Multiply(Game.Player.Character.UpVector, -15);
                }

                Game.Player.Character.Velocity = v;
            }
            else
            {
                GTAFuncs.EnableControlAction(Control.MoveUp, true);
                GTAFuncs.EnableControlAction(Control.MoveDown, true);
                GTAFuncs.EnableControlAction(Control.MoveLeft, true);
                GTAFuncs.EnableControlAction(Control.MoveRight, true);
                GTAFuncs.EnableControlAction(Control.Attack, true);
                GTAFuncs.EnableControlAction(Control.Aim, true);
                GTAFuncs.SetEntityGravity(Game.Player.Character, true);
                GTAFuncs.SetEntityLoadColissionFlag(Game.Player.Character, true);
                GTAFuncs.SetEntityRecordsCollisions(Game.Player.Character, true);
                GTAFuncs.SetEntityCollision(Game.Player.Character, true, true);
            }

            if (_forceFieldEnabled)
            {
                GTAFuncs.ClearAreaOfObjects(Game.Player.Character.Position, 100);
                GTAFuncs.ClearAreaOfProjectiles(Game.Player.Character.Position, 100);

                foreach (var _ent in World.GetAllEntities())
                {
                    var ent = _ent;
                    if (ent.Handle == Game.Player.Character.Handle || GTAFuncs.GetPlayerEntity(Game.Player).Handle == ent.Handle)
                    {
                        continue;
                    }

                    if (ent.Position.DistanceTo(Game.Player.Character.Position) <= 100)
                    {
                        if (GTAFuncs.GetEntityType(ent) == GTAFuncs.EntityType.Ped && new Ped(ent.Handle).IsPlayer)
                        {
                            Player player = GTAFuncs.GetPedPlayer(new Ped(ent.Handle));
                            ent = GTAFuncs.RequestEntityControl(player, 1);
                            GTAFuncs.ActivateDamageTrackerOnNetworkId(GTAFuncs.GetNetworkID(player), true);
                        }
                        else
                        {
                            GTAFuncs.RequestEntityControl(ent, 1);
                        }

                        if (ent.IsAttached())
                        {
                            ent.Detach();
                            ent.Delete();
                        }
                        else
                        {
                            GTAFuncs.SetEntityInvinc(ent, false);
                            Vector3 vel = (Game.Player.Character.Position - ent.Position);
                            vel.Normalize();
                            vel         *= -1000;
                            ent.Velocity = vel + new Vector3(0, 0, 100);
                        }
                    }
                }
            }

            if (_developerConsole.Debug && ConsoleSettings.IsDevBuild)
            {
                GTAFuncs.AntiBan();
            }
        }