Ejemplo n.º 1
0
 /// <summary>
 /// Creates a teleport target instance
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="x">X coordinate</param>
 /// <param name="y">Y coordinate</param>
 /// <param name="z">Z coordinate</param>
 /// <param name="requiredIPLs">Required IPLs to load</param>
 /// <param name="removeIPLs">Required IPLs to remove</param>
 /// <param name="isLoaded">Is loaded</param>
 public TeleportTarget(MLString name, float x, float y, float z, string[] requiredIPLs = null, string[] removeIPLs = null)
 {
     Name          = name;
     _coords       = new RDR2.Math.Vector3(x, y, z);
     _requiredIPLs = requiredIPLs;
     _removeIPLs   = removeIPLs;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Teleports player to map marker
 /// </summary>
 /// <param name="sender">Source menu item</param>
 public static void MapMarker(MenuItem sender)
 {
     if (Game.IsWaypointActive)
     {
         RDR2.Math.Vector3 coord = Function.Call <RDR2.Math.Vector3>(Hash._GET_WAYPOINT_COORDS);
         Utils.TeleportWithGroundCheck(coord);
         Utils.ShowNotification(GlobalConst.Message.TP_MAP_MARKER);
     }
     else
     {
         Utils.ShowNotification(GlobalConst.Message.TP_NO_MAP_MARKER_FOUND);
     }
 }
Ejemplo n.º 3
0
                    /// <summary>
                    /// Teleports by offsets
                    /// </summary>
                    /// <param name="sender"></param>
                    public static void Teleport(MenuItem sender)
                    {
                        int handle = Game.Player.Character.Handle;

                        if (Game.Player.Character.IsInVehicle())
                        {
                            handle = Game.Player.Character.CurrentVehicle.Handle;
                        }

                        RDR2.Math.Vector3 c = Game.Player.Character.Position;
                        Function.Call(Hash.SET_ENTITY_COORDS_NO_OFFSET, handle, c.X + _x, c.Y + _y, c.Z + _z, 0, 0, 1);
                        Utils.ShowNotification(GlobalConst.Message.XYZ_TELEPORTED);
                    }
Ejemplo n.º 4
0
                /// <summary>
                /// Saves the current location as a custom location
                /// </summary>
                /// <param name="sender">Source menu item</param>
                public static void SaveCurrentLocation(MenuItem sender)
                {
                    RDR2.Math.Vector3 coords = Game.Player.Character.Position;
                    string            name   = Utils.ShowInGameKeyboard(null, Utils.FormatML(FORMAT_DEFAULT_NAME, coords.X, coords.Y, coords.Z), MAX_INPUT_LENGTH);

                    if (string.IsNullOrEmpty(name))
                    {
                        return;
                    }

                    SimpleTeleportTarget target = new SimpleTeleportTarget(name, coords.X, coords.Y, coords.Z);

                    Configuration.Location.Targets.Add(target);
                    Configuration.Location.Targets.Sort();
                    Configuration.Location.SaveCustomLocations();
                    GenerateTargetList(null);
                    Utils.ShowNotification(GlobalConst.Message.CL_SAVED);
                }
Ejemplo n.º 5
0
        /// <summary>
        /// Teleports player to target position with ground check.
        /// </summary>
        /// <param name="pos">Target position.</param>
        public static void TeleportWithGroundCheck(RDR2.Math.Vector3 pos)
        {
            int handle = Utils.GetPlayerContainerHandle();

            unsafe
            {
                if (!Function.Call <bool>(Hash.GET_GROUND_Z_FOR_3D_COORD, pos.X, pos.Y, GROUND_CHECK_HEIGHTS[0], &pos.Z, false))
                {
                    foreach (float z in GROUND_CHECK_HEIGHTS)
                    {
                        Function.Call(Hash.SET_ENTITY_COORDS_NO_OFFSET, handle, pos.X, pos.Y, z, 0, 0, 1);
                        Script.Wait(GROUND_CHECK_WAIT);
                        if (Function.Call <bool>(Hash.GET_GROUND_Z_FOR_3D_COORD, pos.X, pos.Y, z, &pos.Z, false))
                        {
                            pos.Z += GROUND_CHECK_Z_OFFSET;
                            break;
                        }
                    }
                }
            }
            Function.Call(Hash.SET_ENTITY_COORDS, handle, pos.X, pos.Y, pos.Z, 0, 0, 1, false);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a simple teleport target
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="x">X coordinate</param>
 /// <param name="y">Y coordinate</param>
 /// <param name="z">Z coordinate</param>
 public SimpleTeleportTarget(MLString name, float x, float y, float z)
 {
     Name   = name;
     Coords = new RDR2.Math.Vector3(x, y, z);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Teleports player to target position without ground check.
        /// </summary>
        /// <param name="pos">Target position.</param>
        public static void TeleportWithoutGroundCheck(RDR2.Math.Vector3 pos)
        {
            int handle = Utils.GetPlayerContainerHandle();

            Function.Call(Hash.SET_ENTITY_COORDS, handle, pos.X, pos.Y, pos.Z, 0, 0, 1, false);
        }