Jump to content

Working teleport to waypoint / marker any location of the map.


Recommended Posts

Posted

Found the way to get Z pos in this uc post https://www.unknowncheats.me/forum/2089764-post3.html

If you want to teleport your current vehicle too set his position serverside otherwise wont work if you teleport out of your current stream range.

const teleportWaypoint = () => {
	const waypoint = mp.game.ui.getFirstBlipInfoId(8);
	if (!mp.game.ui.doesBlipExist(waypoint)) return;

	const waypointPos = mp.game.ui.getBlipInfoIdCoord(waypoint);
	if (!waypointPos) return;

	let zCoord = mp.game.gameplay.getGroundZFor3DCoord(waypointPos.x, waypointPos.y, waypointPos.z, false, false);
	if (!zCoord) {
		for (let i = 1000; i >= 0; i -= 25) {
			mp.game.streaming.requestCollisionAtCoord(waypointPos.x, waypointPos.y, i);
			mp.game.wait(0);
		}
		zCoord = mp.game.gameplay.getGroundZFor3DCoord(waypointPos.x, waypointPos.y, 1000, false, false);
		if (!zCoord) return;
	}
	mp.players.local.position = new mp.Vector3(waypointPos.x, waypointPos.y, zCoord + 0.5);
};

mp.events.add('playerCommand', (cmd) => {
	if (cmd == 'tpm') {
		teleportWaypoint();
		return true;
	}
});

 

  • Like 1
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...