Skip to content

Tp to waypoint #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: enhanced
Choose a base branch
from
Open

Tp to waypoint #291

wants to merge 4 commits into from

Conversation

ImNotKonnor
Copy link

@ImNotKonnor ImNotKonnor commented May 8, 2025

This code attempts to improve the tracking of the different heights of the game map, thus avoiding ending up underneath it

@rayty24
Copy link

rayty24 commented May 8, 2025

I'm kinda confused about this cause is this improved tp to waypoint or its just normal ?? Cause we already have one from the yimmenuv2 tho

@SourceModzZ

This comment was marked as spam.

@xZueS19
Copy link

xZueS19 commented May 10, 2025

yea it will be nice to have this since the existing one sometimes tp under the ground and the car gets destroyed and some missions fail.
it would be nice also to have tp to objective

ImNotKonnor

This comment was marked as duplicate.

@maybegreat48
Copy link
Collaborator

Some places might have a ground Z value below 1. Are you sure this doesn't cause you to get teleported in the air?

@CSY0N
Copy link
Contributor

CSY0N commented May 20, 2025

make tp to object would be usefull fr

@ImNotKonnor
Copy link
Author

make tp to object would be usefull fr

I'm working on a teleportation system for objects, collectibles, and objectives

@CSY0N
Copy link
Contributor

CSY0N commented May 21, 2025

make tp to object would be usefull fr

I'm working on a teleportation system for objects, collectibles, and objectives

allright

@DayibBaba
Copy link

Whats with the foreign comments in the code

@maybegreat48
Copy link
Collaborator

Whats with the foreign comments in the code

  1. They're using a translator to convert all code comments into English and back, or
  2. They asked a Spanish-speaking AI to make this code change for them

@ImNotKonnor
Copy link
Author

Whats with the foreign comments in the code

  1. They're using a translator to convert all code comments into English and back, or
  2. They asked a Spanish-speaking AI to make this code change for them

Neither of those options, my native language is Spanish. I simply left line 17 commented out as a reminder.

@maybegreat48
Copy link
Collaborator

Neither of those options, my native language is Spanish. I simply left line 17 commented out as a reminder.

Ah ok, it's just that a lot of people working on this project probably don't understand Spanish and won't be able to read your comments

Some places might have a ground Z value below 1. Are you sure this doesn't cause you to get teleported in the air?

Also, have you tested this yet?

@alzhetv
Copy link

alzhetv commented Jun 11, 2025

Hello there,

I finally managed to build the DLL including this PR and the latest actual repo.
Better than actual TP but still not perfect since it keep continuing teleporting some times under the ground at sea level and tries to go higher when there is actually nothing else.

Sometimes it happens sometime not. Build here and video if you wanna check up what I means when sea level TP and higher than ground

@alzhetv
Copy link

alzhetv commented Jun 12, 2025

I dont know how you can achieve this but I believe in many FiveM servers or admins menus there was a TP to Waypoint that teleports you to the lowest Z coordinate then keep raising your ped to highers Zs until you can finally stand on it.

This is what I have in mind, but this is in lua which I can more understand than c++

@lonelybud
Copy link
Contributor

try this code, its one from old legacy menu -

	void ResolveZCoordinate(Vector3& vec)
	{
		constexpr float max_ground_check = 1000.f;
		constexpr int max_attempts = 20;
		float ground_z = vec.z;
		int current_attempts = 0;
+		bool found_ground = false;

		do
		{
			STREAMING::REQUEST_COLLISION_AT_COORD(vec.x, vec.y, vec.z);

-			float water_height;
-			if (WATER::GET_WATER_HEIGHT(vec.x, vec.y, vec.z, &water_height))
-			{
-				vec.z = water_height;
-				return;
-			}
-
			if (MISC::GET_GROUND_Z_FOR_3D_COORD(vec.x, vec.y, max_ground_check, &ground_z, false, false))
			{
				vec.z = ground_z + 1.0f;
+				found_ground = true;
+				break;
			}

			if (current_attempts % 3 == 0)
			{
				ground_z += 25.f;
			}

			++current_attempts;
			ScriptMgr::Yield();
		} while (current_attempts < max_attempts);

+		float water_height;
+		if (WATER::GET_WATER_HEIGHT(vec.x, vec.y, vec.z, &water_height))
+		{
+			vec.z = water_height;
+			return;
+		}
		
+		if (!found_ground)
		vec.z = PATHFIND::GET_APPROX_HEIGHT_FOR_POINT(vec.x, vec.y); // fallback value
	}

@eXhumer
Copy link
Contributor

eXhumer commented Jun 24, 2025

try this code, its one from old legacy menu -

	void ResolveZCoordinate(Vector3& vec)
	{
		constexpr float max_ground_check = 1000.f;
		constexpr int max_attempts = 20;
		float ground_z = vec.z;
		int current_attempts = 0;
+		bool found_ground = false;

		do
		{
			STREAMING::REQUEST_COLLISION_AT_COORD(vec.x, vec.y, vec.z);

-			float water_height;
-			if (WATER::GET_WATER_HEIGHT(vec.x, vec.y, vec.z, &water_height))
-			{
-				vec.z = water_height;
-				return;
-			}
-
			if (MISC::GET_GROUND_Z_FOR_3D_COORD(vec.x, vec.y, max_ground_check, &ground_z, false, false))
			{
				vec.z = ground_z + 1.0f;
+				found_ground = true;
+				break;
			}

			if (current_attempts % 3 == 0)
			{
				ground_z += 25.f;
			}

			++current_attempts;
			ScriptMgr::Yield();
		} while (current_attempts < max_attempts);

+		float water_height;
+		if (WATER::GET_WATER_HEIGHT(vec.x, vec.y, vec.z, &water_height))
+		{
+			vec.z = water_height;
+			return;
+		}
		
+		if (!found_ground)
		vec.z = PATHFIND::GET_APPROX_HEIGHT_FOR_POINT(vec.x, vec.y); // fallback value
	}

This seems to fix TPing into ground / under ground. Will needs to test more to see I encounter any issue with it.

@@ -72,7 +75,7 @@ namespace YimMenu::Features
{
auto coords = HUD::GET_BLIP_COORDS(HUD::GET_CLOSEST_BLIP_INFO_ID(HUD::GET_WAYPOINT_BLIP_ENUM_ID()));
FiberPool::Push([coords] {
auto new_coords{coords};
auto new_coords = coords;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you should change this back to new_coords{coords}, does not do anything much but it keeps the languge style for C++ 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.