Repository: YimMenu/HorseMenu (language: cpp)

Issue:
[Request] Auto Teleport On Waypoint
One feature very pratical 


Discussion / hints:
I will make this feature today, will have a pr open by tonight EST time.
> I will make this feature today, will have a pr open by tonight EST time.

While youre on the teleport subject, i was trying to work out a way to make a teleport to objective option.

There is a native MAP::TRACK_BLIP_GPS(Blip, hash) ON RDR2MODS native db that i didnt see in horsemenus natives, apparently, you put the blip id/hash and it automatically sets a waypoint to the blip?

![Screenshot_20240321-194759](https://github.com/YimMenu/HorseMenu/assets/24372625/a1fcafd6-ea95-4c53-94d7-9a8a8fbd7b2a)

> I will make this feature today, will have a pr open by tonight EST time.

This should do the trick for auto teleporting to waypoint though, may need some tweaks

```
#include "core/commands/Command.hpp"
#include "game/features/Features.hpp"
#include "game/rdr/Natives.hpp"
#include "game/backend/ScriptMgr.hpp"
#include "util/teleport.hpp"
#include "core/frontend/Notifications.hpp"
#include <thread> // for std::this_thread
#include <chrono> // for std::chrono

namespace YimMenu::Features
{
    class AutoTpToWaypoint : public Command
    {
    private:
        bool isActive;

    public:
        AutoTpToWaypoint() : Command("autotptowaypoint", "Auto Teleport To Waypoint", "Toggle auto teleport to waypoint"), isActive(false) {}

        virtual void OnCall() override
        {
            isActive = !isActive;
            if (isActive) {
                Notifications::Show("Auto Waypoint Teleport", "Auto teleport to waypoint is now active", NotificationType::Info);
                // Start the loop in a separate thread
                std::thread loopThread(&AutoTpToWaypoint::Loop, this);
                loopThread.detach(); // Detach the thread to run in the background
            } else {
                Notifications::Show("Auto Waypoint Teleport", "Auto teleport to waypoint is now inactive", NotificationType::Info);
            }
        }

        void Loop() {
            while (isActive) {
                std::this_thread::sleep_for(std::chrono::seconds(1)); // Adjust the loop delay as needed
                if (MAP::IS_WAYPOINT_ACTIVE()) {
                    auto waypointCoords = YimMenu::Teleport::GetWaypointCoords();
                    YimMenu::Teleport::TeleportEntity(Self::PlayerPed, {waypointCoords.x, waypointCoords.y, 0.0f}, true);
                }
            }
        }
    };

    static AutoTpToWaypoint _AutoTpToWaypoint;
}
```
> > I will make this feature today, will have a pr open by tonight EST time.
> 
> 
> 
> This should do the trick for auto teleporting to waypoint though, may need some tweaks
> 
> 
> 
> ```
> 
> #include "core/commands/Command.hpp"
> 
> #include "game/features/Features.hpp"
> 
> #include "game/rdr/Natives.hpp"
> 
> #include "game/backend/ScriptMgr.hpp"
> 
> #include "util/teleport.hpp"
> 
> #include "core/frontend/Notifications.hpp"
> 
> #include <thread> // for std::this_thread
> 
> #include <chrono> // for std::chrono
> 
> 
> 
> namespace YimMenu::Features
> 
> {
> 
>     class AutoTpToWaypoint : public Command
> 
>     {
> 
>     private:
> 
>         bool isActive;
> 
> 
> 
>     public:
> 
>         AutoTpToWaypoint() : Command("autotptowaypoint", "Auto Teleport To Waypoint", "Toggle auto teleport to waypoint"), isActive(false) {}
> 
> 
> 
>         virtual void OnCall() override
> 
>         {
> 
>             isActive = !isActive;
> 
>             if (isActive) {
> 
>                 Notifications::Show("Auto Waypoint Teleport", "Auto teleport to waypoint is now active", NotificationType::Info);
> 
>                 // Start the loop in a separate thread
> 
>                 std::thread loopThread(&AutoTpToWaypoint::Loop, this);
> 
>                 loopThread.detach(); // Detach the thread to run in the background
> 
>             } else {
> 
>                 Notifications::Show("Auto Waypoint Teleport", "Auto teleport to waypoint is now inactive", NotificationType::Info);
> 
>             }
> 
>         }
> 
> 
> 
>         void Loop() {
> 
>             while (isActive) {
> 
>                 std::this_thread::sleep_for(std::chrono::seconds(1)); // Adjust the loop delay as needed
> 
>                 if (MAP::IS_WAYPOINT_ACTIVE()) {
> 
>                     auto waypointCoords = YimMenu::Teleport::GetWaypointCoords();
> 
>                     YimMenu::Teleport::TeleportEntity(Self::PlayerPed, {waypointCoords.x, waypointCoords.y, 0.0f}, true);
> 
>                 }
> 
>             }
> 
>         }
> 
>     };
> 
> 
> 
>     static AutoTpToWaypoint _AutoTpToWaypoint;
> 
> }
> 
> ```

I have this feature in a looped command actually and it just checks it there is a waypoint and then runs a function to teleport. I will def submit my pr today though

Fix patch:
diff --git a/src/core/byte_patch_manager/byte_patch_manager.cpp b/src/core/byte_patch_manager/byte_patch_manager.cpp
index 80a258eb..646ede6a 100644
--- a/src/core/byte_patch_manager/byte_patch_manager.cpp
+++ b/src/core/byte_patch_manager/byte_patch_manager.cpp
@@ -7,7 +7,7 @@ namespace YimMenu
 		// put patches here
 		// example usage:
 		//
-		//BytePatch::Make(Pointers.GetLocalPed,0).get()
+		//BytePatch::Make(Pointers.GetLocalPed,0)->apply();
 
 		LOG(INFO) << "Byte patch manager initialized";
 	}
diff --git a/src/core/byte_patch_manager/byte_patch_manager.hpp b/src/core/byte_patch_manager/byte_patch_manager.hpp
index 488f6167..94635736 100644
--- a/src/core/byte_patch_manager/byte_patch_manager.hpp
+++ b/src/core/byte_patch_manager/byte_patch_manager.hpp
@@ -10,6 +10,11 @@ namespace YimMenu
 
 		static void Init();
 
+		//store created patches here for dynamic enabling/disabling
+		struct Patches
+		{
+		};
+
 	private:
 		static Byte_Patch_Manager& GetInstance()
 		{
diff --git a/src/game/features/self/AutoTP.cpp b/src/game/features/self/AutoTP.cpp
new file mode 100644
index 00000000..53228c36
--- /dev/null
+++ b/src/game/features/self/AutoTP.cpp
@@ -0,0 +1,25 @@
+#include "core/commands/LoopedCommand.hpp"
+#include "game/features/Features.hpp"
+#include "util/teleport.hpp"
+
+namespace YimMenu::Features
+{
+	class AutoTP : public LoopedCommand
+	{
+		using LoopedCommand::LoopedCommand;
+
+		virtual void OnTick() override
+		{
+			if (MAP::IS_WAYPOINT_ACTIVE())
+			{
+				Vector3 coords = Teleport::GetWaypointCoords();
+				if (coords != Vector3{0, 0, 0})
+				{
+					Teleport::TeleportEntity(YimMenu::Self::PlayerPed, rage::fvector3{coords.x, coords.y, coords.z}, true);
+				}
+			}
+		}
+	};
+
+	static AutoTP _AutoTP{"autotp", "Auto TP to Waypoint", "Automatically teleports you when you place a waypoint"};
+}
\ No newline at end of file
diff --git a/src/game/features/self/Superjump.cpp b/src/game/features/self/Superjump.cpp
new file mode 100644
index 00000000..96e88131
--- /dev/null
+++ b/src/game/features/self/Superjump.cpp
@@ -0,0 +1,18 @@
+#include "core/commands/LoopedCommand.hpp"
+#include "game/features/Features.hpp"
+#include "game/rdr/Natives.hpp"
+
+namespace YimMenu::Features
+{
+	class Superjump : public LoopedCommand
+	{
+		using LoopedCommand::LoopedCommand;
+
+		virtual void OnTick() override
+		{
+			MISC::SET_SUPER_JUMP_THIS_FRAME(Self::Id);
+		}
+	};
+
+	static Superjump _Superjump{"superjump", "Superjump", "Jump higher than normal"};
+}
\ No newline at end of file
diff --git a/src/game/frontend/submenus/Network.cpp b/src/game/frontend/submenus/Network.cpp
index fb812e11..ba2d3192 100644
--- a/src/game/frontend/submenus/Network.cpp
+++ b/src/game/frontend/submenus/Network.cpp
@@ -1,21 +1,27 @@
 #include "Network.hpp"
+
 #include "core/commands/Commands.hpp"
 #include "core/commands/HotkeySystem.hpp"
 #include "core/commands/LoopedCommand.hpp"
+#include "core/frontend/Notifications.hpp"
+#include "game/backend/FiberPool.hpp"
 #include "game/features/Features.hpp"
 #include "game/frontend/items/Items.hpp"
+#include "game/pointers/Pointers.hpp"
+
 
 namespace YimMenu::Submenus
 {
 	Network::Network() :
 	    Submenu::Submenu("Network")
 	{
-		auto session = std::make_shared<Category>("Session");
-		auto spoofing     = std::make_shared<Category>("Spoofing");
+		auto session  = std::make_shared<Category>("Session");
+		auto spoofing = std::make_shared<Category>("Spoofing");
 		session->AddItem(std::make_shared<CommandItem>("explodeall"_J));
 		session->AddItem(std::make_shared<CommandItem>("maxhonorall"_J));
 		session->AddItem(std::make_shared<CommandItem>("minhonorall"_J));
 		spoofing->AddItem(std::make_shared<BoolCommandItem>("hidegod"_J));
+		spoofing->AddItem(std::make_shared<BoolCommandItem>("voicechatoverride"_J));
 		AddCategory(std::move(session));
 		AddCategory(std::move(spoofing));
 	}
diff --git a/src/game/frontend/submenus/Self.cpp b/src/game/frontend/submenus/Self.cpp
index b756c7fb..6cbd2ca5 100644
--- a/src/game/frontend/submenus/Self.cpp
+++ b/src/game/frontend/submenus/Self.cpp
@@ -63,7 +63,8 @@ namespace YimMenu::Submenus
 		globalsGroup->AddItem(std::make_shared<BoolCommandItem>("keepclean"_J));
 		globalsGroup->AddItem(std::make_shared<BoolCommandItem>("antilasso"_J));
 		globalsGroup->AddItem(std::make_shared<BoolCommandItem>("antihogtie"_J));
-		globalsGroup->AddItem(std::make_shared<BoolCommandItem>("voicechatoverride"_J)); // TODO: move this to spoofing or network
+		globalsGroup->AddItem(std::make_shared<BoolCommandItem>("autotp"_J));
+		globalsGroup->AddItem(std::make_shared<BoolCommandItem>("superjump"_J));
 
 		toolsGroup->AddItem(std::make_shared<CommandItem>("suicide"_J));
 		toolsGroup->AddItem(std::make_shared<CommandItem>("clearcrimes"_J));
diff --git a/src/util/teleport.hpp b/src/util/teleport.hpp
index 1e7b6f42..b454292c 100644
--- a/src/util/teleport.hpp
+++ b/src/util/teleport.hpp
@@ -2,8 +2,9 @@
 #include "common.hpp"
 #include "core/frontend/Notifications.hpp"
 #include "game/backend/ScriptMgr.hpp"
-#include "game/rdr/Natives.hpp"
 #include "game/rdr/Entity.hpp"
+#include "game/rdr/Natives.hpp"
+
 
 // TODO: remove this file
 
@@ -88,8 +89,6 @@ namespace YimMenu::Teleport
 		if (MAP::IS_WAYPOINT_ACTIVE())
 			return MAP::_GET_WAYPOINT_COORDS();
 
-		Notifications::Show("Waypoint", "You don't have a waypoint set", NotificationType::Error);
-
 		return Vector3{0, 0, 0};
 	}
 


Test patch: