RequestEntityControl() public static method

public static RequestEntityControl ( System.Entity e, int time = 10000 ) : System.Entity
e System.Entity
time int
return System.Entity
 private void HealCommand(Entity e)
 {
     GTAFuncs.RequestEntityControl(e);
     e.Health = e.MaxHealth;
     while (e.Health != e.MaxHealth)
     {
         GTAFuncs.CreateAmbientPickup("PICKUP_HEALTH_STANDARD", e.Position, 50000);
     }
 }
 private void TpCommand()
 {
     GTAFuncs.RequestEntityControl(_player.Character, 5);
     if (_lastWaypoint == null)
     {
         _developerConsole.PrintError("Cannot teleport to waypoint. No waypoint exists.");
         return;
     }
     GTAFuncs.GetPlayerEntity(_player).Position =
         GTAFuncs.GetGroundPos(new Vector2(_lastWaypoint.Position.X, _lastWaypoint.Position.Y));
 }
 private void UprightCommand(Entity e)
 {
     GTAFuncs.RequestEntityControl(e);
     e.Rotation = new Vector3(0, 0, 0);
 }
 private void LaunchCommand(Entity e, int vel)
 {
     GTAFuncs.RequestEntityControl(e);
     e.Velocity += new Vector3(0, 0, vel);
 }
 private void UpCommand(Entity e, int dist)
 {
     GTAFuncs.RequestEntityControl(e);
     e.Position += new Vector3(0, 0, dist);
 }
 private void TpCommand(Vector3 v)
 {
     GTAFuncs.RequestEntityControl(_player.Character, 5);
     GTAFuncs.GetPlayerEntity(_player).Position = v;
 }
        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();
            }
        }