OsFlash 2 Posted April 25, 2018 (edited) Make a mark on the map and press ARROWUP or DPAD - UP in PS4/XBOX. you will be teleported to your marking. Spoiler Client-Side mp.events.add('render', () => { if(mp.game.controls.isControlJustReleased(0, 172)){//ARROWUP teleport(); } }); function teleport() { let blipFound = false; let blipIterator = mp.game.invoke('0x526A9A6B1B39C5F0'); let FirstInfoId = mp.game.invoke('0x8B85A9204085F2E4', blipIterator); let NextInfoId = mp.game.invoke('0xAE4957CFA732BC41', blipIterator); for (let i = FirstInfoId; mp.game.invoke('0xA6DECE14FC9A8C51', i) != 0; i = NextInfoId) { if (mp.game.invoke('0x5B4379CB58F97327', i) == 4 ){ var coord = mp.game.ui.getBlipInfoIdCoord(i); blipFound = true; } } if (blipFound) { mp.game.cam.doScreenFadeOut(250); let groundFound = false; let groundCheckHeight = 1000; if (mp.players.local.vehicle){ for (let i = 0; i < parseFloat(groundCheckHeight); i++){ mp.players.local.vehicle.position = new mp.Vector3(coord.x, coord.y, coord.z); if (mp.game.gameplay.getGroundZFor3dCoord(coord.x, coord.y, parseFloat(i), coord.z, false)){ groundFound = true; coord.z += -300.0; mp.game.cam.doScreenFadeIn(250); } } if (!groundFound){ mp.players.local.vehicle.position = new mp.Vector3(coord.x, coord.y, coord.z); coord.z = 1000.0; mp.game.cam.doScreenFadeIn(250); //mp.game.weapon.giveWeaponObjectToPed(0xFBAB5776, mp.players.local); } }else{ for (let i = 0; i < parseFloat(groundCheckHeight); i++){ mp.players.local.position = new mp.Vector3(coord.x, coord.y, coord.z); if (mp.game.gameplay.getGroundZFor3dCoord(coord.x, coord.y, parseFloat(i), coord.z, false)){ groundFound = true; coord.z += -300.0; mp.game.cam.doScreenFadeIn(250); } } if (!groundFound){ mp.players.local.position = new mp.Vector3(coord.x, coord.y, coord.z); coord.z = 1000.0; mp.game.cam.doScreenFadeIn(250); //mp.game.weapon.giveWeaponObjectToPed(0xFBAB5776, mp.players.local); } } } } Edited April 26, 2018 by OsFlash 1 Share this post Link to post Share on other sites
konnex 2 Posted April 27 @OsFlash any idea how to get this to work in the current version? invalid invokes... Share this post Link to post Share on other sites
konnex 2 Posted May 3 Managed to get it to work in the current version. The script is not always finding the elevation at the waypoint position though (getGroundZFor3dCoord returning 0), if that happens it will not teleport you and output a chat message. Also I am using a command (/tp) instead of a keybind. Code (a bit messy, since for development purposes): Spoiler mp.events.add("playerCommand", (command) => { const args = command.split(/[ ]+/) const commandName = args[0] args.shift() if(commandName === "tp"){ if (mp.game.invoke('0x1DD1F58F493F1DA5')) { let blipIterator = mp.game.invoke('0x186E5D252FA50E7D') let FirstInfoId = mp.game.invoke('0x1BEDE233E6CD2A1F', blipIterator) let NextInfoId = mp.game.invoke('0x14F96AA50D6FBEA7', blipIterator) for (let i = FirstInfoId; mp.game.invoke('0xA6DB27D19ECBB7DA', i) != 0; i = NextInfoId) { if (mp.game.invoke('0xBE9B0959FFD0779B', i) == 4 ) { let coord = mp.game.ui.getBlipInfoIdCoord(i) coord.z = mp.game.gameplay.getGroundZFor3dCoord(coord.x, coord.y, 800, 0, false) if(coord.z != 0 && !mp.players.local.isInAnyVehicle(true)){ mp.players.local.position = coord } else{ mp.gui.chat.push("Could not find elevation at waypoint position!") } } } } } }) 2 Share this post Link to post Share on other sites
Static 2 Posted July 21 Thanks for snippets. I modified this a little bit to work distant locations where the map isn't properly loaded. Here is the code. if (mp.game.invoke('0x1DD1F58F493F1DA5')) { let blipIterator = mp.game.invoke('0x186E5D252FA50E7D'); let FirstInfoId = mp.game.invoke('0x1BEDE233E6CD2A1F', blipIterator); let NextInfoId = mp.game.invoke('0x14F96AA50D6FBEA7', blipIterator); for (let i = FirstInfoId; mp.game.invoke('0xA6DB27D19ECBB7DA', i) != 0; i = NextInfoId) { if (mp.game.invoke('0xBE9B0959FFD0779B', i) == 4) { let oldpos = mp.players.local.position; let coord = mp.game.ui.getBlipInfoIdCoord(i); coord.z = mp.game.gameplay.getGroundZFor3dCoord(coord.x, coord.y, i * 50, 0, false); // try calcualte Z mp.players.local.position = coord; mp.players.local.freezePosition(true); setTimeout(function () { // let the game load the map let j = 0; while (j <= 60 && coord.z == 0) { // try to find it by trying different heights coord.z = mp.game.gameplay.getGroundZFor3dCoord(coord.x, coord.y, i * 25, 0, false); j++; } if (coord.z != 0) { // if found groundZ mp.players.local.position = coord; } else { mp.players.local.position = oldpos; mp.gui.chat.push("Could not find elevation at waypoint position!"); } mp.players.local.freezePosition(false); }, 1500); } } } Works by teleporting you there, freezing you then calculating the GroundZ. If it finds it, it places you there else it teleports you back to your original position. 1 Share this post Link to post Share on other sites