OsFlash Posted April 25, 2018 Share 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 Link to comment Share on other sites More sharing options...
konnex Posted April 27, 2019 Share Posted April 27, 2019 @OsFlash any idea how to get this to work in the current version? invalid invokes... Link to comment Share on other sites More sharing options...
konnex Posted May 3, 2019 Share Posted May 3, 2019 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 Link to comment Share on other sites More sharing options...
Static Posted July 21, 2019 Share Posted July 21, 2019 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. 2 Link to comment Share on other sites More sharing options...
Kopra Posted October 20, 2022 Share Posted October 20, 2022 None of above examples worked so I share my: const REQUEST_ADDITIONAL_COLLISION_AT_COORD = "0xC9156DC11411A9EA"; const getGroundCoords = (vector, tries) => { let groundZ; for (let i = 0; i < tries; ++i) { groundZ = mp.game.gameplay.getGroundZFor3DCoord(vector.x, vector.y, 1000, false, false); if (groundZ) { return new mp.Vector3(vector.x, vector.y, groundZ + 1); } else { for (let z = 1500; z >= 0; z -= 100) { mp.game.streaming.setFocusArea(vector.x, vector.y, z, 0, 0, 0); mp.game.streaming.requestCollisionAtCoord(vector.x, vector.y, z); mp.game.invoke(REQUEST_ADDITIONAL_COLLISION_AT_COORD, vector.x, vector.y, z); mp.game.wait(0); } groundZ = mp.game.gameplay.getGroundZFor3DCoord(vector.x, vector.y, 1000, false, false); if (groundZ) { return new mp.Vector3(vector.x, vector.y, groundZ + 1); } else { mp.game.streaming.setFocusArea(mp.players.local.position.x, mp.players.local.position.y, mp.players.local.position.z, 0, 0, 0); } } } return null; } const teleportToWp = () => { const waypoint = mp.game.ui.getFirstBlipInfoId(8); if (!mp.game.ui.doesBlipExist(waypoint)) return; const waypointPos = mp.game.ui.getBlipInfoIdCoord(waypoint); if (!waypointPos) return; const groundPos = getGroundCoords(waypointPos, 10); if (groundPos) { mp.players.local.position = groundPos; return; } mp.gui.chat.push("Ground Z could not be found, try another position."); }; Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now