Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

LUA Teleporting to Waypoint disables ability to set waypoint


Jsk2003
 Share

Recommended Posts

Well restarting the game just fixed this. This can be locked or deleted then.

 

Hello, I've been creating a LUA based trainer, but for some strange reason after teleporting to the marker, I am unable to set any more markers until I have teleported using one of the preset locations.

 

Here is the code.

local teleportOptions = {		{"Marker", {}},		{"Michael's House", {-852.4, 160.0, 65.6}},		{"Franklin's House", {7.9, 548.1, 175.5}},		{"Trevor's Trailer", {1985.7, 3812.2, 32.2}},		{"Airport Entrance", {-1034.6, -2733.6, 13.8}},		{"Airport Field", {-1336.0, -3044.0, 13.9}},		{"Elysian Island", {338.2, -2715.9, 38.5}},		{"Jetsam", {760.4, -2943.2, 5.8}},		{"Stripclub", {127.4, -1307.7, 29.2}},		{"Elburro Heights", {1384.0, -2057.1, 52.0}},		{"Ferris Wheel", {-1670.7, -1125.0, 13.0}},		{"Chumash", {-3192.6, 1100.0, 20.2}},		{"Windfarm", {2354.0, 1830.3, 101.1}},		{"Military base", {-2047.4, 3132.1, 32.8}},		{"McKenzie Airfield", {2121.7, 4796.3, 41.1}},		{"Desert Airfield", {1747.0, 3273.7, 41.1}},		{"Chilliad", {425.4, 5614.3, 766.5}}	}function JskMenu.teleport(option)	local e = PLAYER.PLAYER_PED_ID()	if(PED.IS_PED_IN_ANY_VEHICLE(e, false)) then		e = PED.GET_VEHICLE_PED_IS_USING(e)	end	local coords = {}		local success = false	if(option == 1) then --Waypoint		local blipFound = false		local blipIterator = UI._GET_BLIP_INFO_ID_ITERATOR()		local i = UI.GET_FIRST_BLIP_INFO_ID(blipIterator)		while(UI.DOES_BLIP_EXIST(i) ~= false) do			i = UI.GET_FIRST_BLIP_INFO_ID(blipIterator)			if(UI.GET_BLIP_INFO_ID_TYPE(i) == 4) then				coords = UI.GET_BLIP_INFO_ID_COORD(i)				blipFound = true			end			i = UI.GET_NEXT_BLIP_INFO_ID(blipIterator)		end		if(blipFound) then			local groundFound = false			local groundCheckHeight = {0,800,50,500}			local k = 1			while(k <= 4) do				coords.z = groundCheckHeight[k]				ENTITY.SET_ENTITY_COORDS_NO_OFFSET(e, coords.x, coords.y, coords.z, false, false, true)				wait(100)				print("player elevation is", coords.z, groundCheckHeight[k])				if(GAMEPLAY.GET_GROUND_Z_FOR_3D_COORD(coords.x, coords.y, groundCheckHeight[k], coords.z)) then					coords.z = coords.z - ENTITY.GET_ENTITY_HEIGHT_ABOVE_GROUND(e)					print("did it change?", coords.z, groundCheckHeight[k])					groundFound = true					break				end				k = k + 1			end			print("it breakeeed? I think so", coords.z)			if(not groundFound) then				coords.z = 1000				WEAPON.GIVE_DELAYED_WEAPON_TO_PED(playerPed, GAMEPLAY.GET_HASH_KEY("WEAPON_PARACHUTE"),1,0)			end			success = true		else			print("No waypoint set!")		end	else		coords.x = teleportOptions[option][2][1]		coords.y = teleportOptions[option][2][2]		coords.z = teleportOptions[option][2][3]		success = true	end		if(success) then		ENTITY.SET_ENTITY_COORDS_NO_OFFSET(e, coords.x, coords.y, coords.z, false, false, true)		print("teleporting at zlevel", coords.z)		wait(100)		success = false	endend

Basically this is what happens. Set waypoint using map, map marker shows, can use any teleport option. When I teleport to the map marker, I arrive, marker disappears. If I try to set another marker, nothing shows up, I am unable to teleport to the non-existent marker. But I can teleport to the other places, like Michael's house. When I teleport to a preset location, the marker I was trying to place appears!

 

If I had tried to place more than one marker after they stopped appearing for me, when the marker finally works after teleporting elsewhere, when I goto the map to erase the marker, it shows each marker I tried one by one.

 

 

 

 

EDIT: Strangely enough, when I came back to get cracking at that problem, the problem evaporated. It's working just fine now. I guess I only had to restart the game to fix it, strange how in some cases changing your code can be refreshed by just LoadAddins() and other cases require a restart of the game.

Edited by Jsk2003
Link to comment
Share on other sites

  • 3 weeks later...
JackStarGamer

Im looking for a code like this im willing to give a shoutout if i can use it.

Link to comment
Share on other sites

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
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.