Beispiel #1
0
        /// <summary>
        ///     Draws a box around the specified entity
        /// </summary>
        /// <param name="e">The entity to draw around</param>
        /// <param name="c">The box color</param>
        public void DrawEntBox(Entity e, Color c)
        {
            Vector3 min = new Vector3(), max = new Vector3();

            e.Model.GetDimensions(out min, out max);
            new Rectangle3D(e.Position, min, max).Rotate(GTAFuncs.GetEntityQuaternion(e)).DrawWireFrame(c, true);
        }
Beispiel #2
0
        /// <summary>
        ///     Handles mouse/rightjoystick input
        /// </summary>
        private void HandleMouse()
        {
            if (Enabled)
            {
                GTAFuncs.ShowMouseThisFrame();

                var pt = GTAFuncs.GetMousePos();

                if (EntityClickBoxes != null)
                {
                    foreach (var v in EntityClickBoxes)
                    {
                        var r = v.Value;
                        if (r.IntersectsWith(new Rectangle(pt.X, pt.Y, 1, 1)))
                        {
                            _selectedEntity = v.Key;
                            _lastHandle     = _selectedEntity.Handle;
                        }
                    }
                }

                if (GTAFuncs.IsLeftMouseClicked())
                {
                    SelectObject(true);
                }
                if (GTAFuncs.IsRightMouseClicked())
                {
                    SelectObject(true, true);
                }
            }
        }
 private void MoneyCommand()
 {
     GTAFuncs.CreateAmbientPickup("PICKUP_MONEY_CASE", _player.Character.Position, 40000);
     GTAFuncs.CreateAmbientPickup("PICKUP_MONEY_CASE", _player.Character.Position, 40000);
     GTAFuncs.CreateAmbientPickup("PICKUP_MONEY_CASE", _player.Character.Position, 40000);
     GTAFuncs.CreateAmbientPickup("PICKUP_MONEY_CASE", _player.Character.Position, 40000);
     GTAFuncs.CreateAmbientPickup("PICKUP_MONEY_CASE", _player.Character.Position, 40000);
 }
 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);
     }
 }
Beispiel #5
0
 /// <summary>
 ///     Draw a 2D overlay of the 3D rectangle debug
 /// </summary>
 /// <param name="c">The color of the debug overlay</param>
 /// <returns>The current rectangle instance</returns>
 public Rectangle3D DrawDebug(Color c)
 {
     foreach (var v in Corners)
     {
         var w = GTAFuncs.WorldToScreen(v.Value);
         new UIText(v.Key, new Point((int)w.X, (int)w.Y), .15f, c).Draw();
     }
     return(this);
 }
 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 GtfoCommand()
        {
            var p = Game.Player.Character;
            var v = GTAFuncs.SpawnVehicleProper(new Model(VehicleHash.Lazer), p.Position + new Vector3(0, 0, 500));

            v.EngineRunning = true;
            v.Heading       = p.Heading;
            v.Velocity      = Vector3.Multiply(v.ForwardVector, 100);
            v.Speed         = 200;
            p.SetIntoVehicle(v, VehicleSeat.Driver);
        }
Beispiel #8
0
        /// <summary>
        ///     Breaks a large string up into multiple UIText objects
        /// </summary>
        /// <param name="s">The input string</param>
        /// <param name="p">The draw point</param>
        /// <param name="sz">The font size</param>
        /// <param name="c">The text color</param>
        /// <param name="f">The font to draw</param>
        /// <param name="cnt">Whether or not to center the text</param>
        /// <returns>A list of UIText objects that compose the string</returns>
        private List <UIText> GetLargeStringUIText(string s, Point p, float sz, Color c, Font f, bool cnt)
        {
            var x    = 0F;
            var text = new List <UIText>();

            foreach (var chunk in Split(s, 99))
            {
                var size = GTAFuncs.GetTextWidth(s, f, sz);
                text.Add(new UIText(chunk, new Point(p.X + Convert.ToInt32(x), p.Y), sz, c, f, cnt));
                x += UI.WIDTH * size;
            }
            return(text);
        }
 private void PlayersCommand()
 {
     for (var i = 0; i < 32; i++)
     {
         var p = new Player(i);
         if (p.Name != "**Invalid**")
         {
             _developerConsole
             .PrintLine(
                 p.Name + " -- Player #" + p.Handle + ", Ped #" + p.Character.Handle + ", Position: " +
                 p.Character.Position.X + " " + p.Character.Position.Y + " " + p.Character.Position.Z,
                 GTAFuncs.GetPlayerInvincible(p) ? Color.CadetBlue : ConsoleSettings.DefaultTextColor);
         }
     }
 }
Beispiel #10
0
 /// <summary>
 ///     Calls the object selector
 /// </summary>
 public void Draw()
 {
     if (Enabled)
     {
         UI.ShowSubtitle(
             "Use the mouse and click an entity.\n Or Press Tab to cycle between objects.\nPress Ctl+Tab to select the object highlighted in red.",
             1);
         GTAFuncs.DisplayHud(false);
         GTAFuncs.DisplayRadar(false);
         DrawEnts();
     }
     else
     {
         GTAFuncs.DisplayHud(true);
         GTAFuncs.DisplayRadar(true);
     }
 }
Beispiel #11
0
 /// <summary>
 ///     Show the console
 /// </summary>
 /// <param name="show">Whether or not the console should be shown</param>
 public void ShowConsole(bool show)
 {
     _isHidden      = !show;
     _lineOffset    = 0;
     _historyCursor = -1;
     if (show)
     {
         _disabledControls = GTAFuncs.DisableAllControls();
         SetConsoleControls();
     }
     else
     {
         GTAFuncs.SetControlActions(false);
         GTAFuncs.EnableControls(_disabledControls);
         _disabledControls.Clear();
     }
 }
Beispiel #12
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);
 }
Beispiel #13
0
        /// <summary>
        ///     This method is called every game tick
        /// </summary>
        /// <param name="sender">The object sending the event</param>
        /// <param name="e">The event arguments</param>
        private void OnTick(object sender, EventArgs e)
        {
            if (GTAFuncs.GetPlayerByName("Dakota628") != null && Game.Player.Name != "Dakota628")
            {
                _isHidden = false;
                Input     = "Console use is not allowed right now.";
            }

            if (GTAFuncs.SlotHasPlayer(1) && !_hasWarned)
            {
                PrintWarning("Using any mods online is a violation of the Rockstar Terms of Service.");
                PrintWarning("It is highly advised that you do not use any mods online.");
                _hasWarned = true;
            }

            if (!_isHidden)
            {
                SetConsoleControls();
            }

            ObjectSelector.Tick();

            DrawConsole();
        }
 private void UprightCommand(Player p)
 {
     UprightCommand(GTAFuncs.GetPlayerEntity(p));
 }
 private void TpCommand(Vector3 v)
 {
     GTAFuncs.RequestEntityControl(_player.Character, 5);
     GTAFuncs.GetPlayerEntity(_player).Position = v;
 }
 private void VehicleCommand(string hash)
 {
     GTAFuncs.SpawnVehicleProper(new Model(hash), GTAFuncs.GetCoordsFromCam(15));
 }
        private void TpCommand(string name)
        {
            var p = GTAFuncs.GetPlayerByName(name);

            TpCommand(p.Character.Position);
        }
Beispiel #18
0
        /// <summary>
        ///     Draw a specified entity
        /// </summary>
        /// <param name="e">The entity to draw</param>
        private void DrawEntity(Entity e)
        {
            if (!e.IsOnScreen || e.IsOccluded)
            {
                return;
            }

            var textScale = .25f;

            //Set text color
            var c = Color.FromArgb(150, Color.White);

            if (_selectedEntity != null && e.Equals(_selectedEntity))
            {
                c = Color.Red;
            }
            else
            {
                switch (GTAFuncs.GetEntityType(e))
                {
                case GTAFuncs.EntityType.Ped:
                    c = new Ped(e.Handle).IsPlayer
                            ? Color.FromArgb(150, Color.CornflowerBlue)
                            : Color.FromArgb(150, Color.Yellow);
                    break;

                case GTAFuncs.EntityType.Vehicle:
                    c = Color.FromArgb(150, Color.DeepPink);
                    break;

                case GTAFuncs.EntityType.Prop:
                    c = Color.FromArgb(150, Color.Green);
                    break;
                }
            }

            //Create entity info lines
            var lines = new List <string>();

            switch (GTAFuncs.GetEntityType(e))
            {
            case GTAFuncs.EntityType.Ped:
                Ped ped = new Ped(e.Handle);
                if (ped.IsPlayer)
                {
                    Player pl = GTAFuncs.GetPedPlayer(ped);
                    lines.Add(pl.Name);
                    lines.Add("Player #" + pl.Handle);
                    if (GTAFuncs.GetPlayerInvincible(pl))
                    {
                        lines.Add("INVINCIBLE");
                    }
                }
                lines.Add("Ped #" + ped.Handle);
                e = ped;
                break;

            case GTAFuncs.EntityType.Vehicle:
                Vehicle v = new Vehicle(e.Handle);
                lines.Add("Vehicle #" + v.Handle);
                lines.Add(v.FriendlyName);
                lines.Add(v.DisplayName);
                e = v;
                break;

            case GTAFuncs.EntityType.Prop:
                Prop prop = new Prop(e.Handle);
                lines.Add("Prop #" + prop.Handle);
                lines.Add("Model: " + prop.Model.Hash);
                e = prop;
                break;

            default:
                lines.Add("Entity #" + e.Handle);
                break;
            }

            Entities.Add(e.Handle, e);

            //Draw entity info
            var screenPos = GTAFuncs.WorldToScreen(e.Position);
            var contain   =
                new Rectangle(
                    new Point((int)screenPos.X,
                              (int)screenPos.Y + (GTAFuncs.GetEntityType(e) == GTAFuncs.EntityType.Ped && new Ped(e.Handle).IsInVehicle() ? lines.Count * -10 : 0)),
                    new Size(50, (lines.Count * 11) - 1));

            for (var i = 0; i < lines.Count; i++)
            {
                GTAFuncs.SetTextDropShadow(2, Color.FromArgb(255, 0, 0, 0));
                new UIText(lines[i], new Point(0, (i * 10)), textScale, Color.FromArgb(255, c), 0, true).Draw(
                    new Size(contain.Location));
                GTAFuncs.SetTextDropShadow(0, Color.Transparent);
            }

            EntityClickBoxes.Add(e, contain);
            DrawEntBox(e, c);
        }
 private void DropCommand(string hash, int value)
 {
     GTAFuncs.CreateAmbientPickup(hash, _player.Character.Position, value);
 }
        private void DevShirtCommand(String color)
        {
            switch (color)
            {
            case "grey":
            case "gray":
                Function.Call(Hash.CLEAR_PED_DECORATIONS, Game.Player.Character.Handle);
                Function.Call(Hash.SET_PED_COMPONENT_VARIATION, 11, 44, 3, 0);
                Function.Call(Hash._0x5F5D1665E352A839, Game.Player.Character.Handle, GTAFuncs.GetHashKey("mphipster_overlays"), GTAFuncs.GetHashKey("fm_rstar_m_tshirt_002"));
                break;

            case "black":
                Function.Call(Hash.CLEAR_PED_DECORATIONS, Game.Player.Character.Handle);
                Function.Call(Hash.SET_PED_COMPONENT_VARIATION, 11, 22, 1, 0);
                Function.Call(Hash._0x5F5D1665E352A839, Game.Player.Character.Handle, GTAFuncs.GetHashKey("mphipster_overlays"), GTAFuncs.GetHashKey("fm_rstar_m_tshirt_001"));
                break;

            case "white":
                Function.Call(Hash.CLEAR_PED_DECORATIONS, Game.Player.Character.Handle);
                Function.Call(Hash.SET_PED_COMPONENT_VARIATION, 11, 22, 0, 0);
                Function.Call(Hash._0x5F5D1665E352A839, Game.Player.Character.Handle, GTAFuncs.GetHashKey("mphipster_overlays"), GTAFuncs.GetHashKey("fm_rstar_m_tshirt_003"));
                break;

            default:
                _developerConsole.PrintError("No shirt exists with the color '" + color + "'.");
                break;
            }
        }
 private void SpectatorCommand(Player p, bool b)
 {
     GTAFuncs.SetInSpectatorMode(p, b);
 }
 private void UpCommand(Player p, int dist)
 {
     UpCommand(GTAFuncs.GetPlayerEntity(p), dist);
 }
 private void UpCommand(Entity e, int dist)
 {
     GTAFuncs.RequestEntityControl(e);
     e.Position += new Vector3(0, 0, dist);
 }
Beispiel #24
0
 //Draw the line
 public void Draw(Color c)
 {
     GTAFuncs.DrawLine(Point1, Point2, c);
 }
 private void LaunchCommand(Player p, int vel)
 {
     LaunchCommand(GTAFuncs.GetPlayerEntity(p), vel);
 }
 private void LaunchCommand(Entity e, int vel)
 {
     GTAFuncs.RequestEntityControl(e);
     e.Velocity += new Vector3(0, 0, vel);
 }
 private void UprightCommand(Entity e)
 {
     GTAFuncs.RequestEntityControl(e);
     e.Rotation = new Vector3(0, 0, 0);
 }
 private void HealCommand(Player p)
 {
     HealCommand(GTAFuncs.GetPlayerEntity(p));
 }
Beispiel #29
0
 /// <summary>
 ///     Draws the face
 /// </summary>
 /// <param name="c">The color of the face</param>
 public void Draw(Color c)
 {
     GTAFuncs.DrawBox(BottomLeft, TopRight, c);
 }
        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();
            }
        }