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

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
Jsk2003

LUA Teleporting to Waypoint disables ability to set waypoint

Recommended Posts

Jsk2003

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

Share this post


Link to post
Share on other sites
JackStarGamer

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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