Last active
February 25, 2024 19:42
-
-
Save xXTurnerLP/d78592d0fe15bd25d4dd1fba931154ba to your computer and use it in GitHub Desktop.
FiveM Precise waypoint teleport script. Always teleports at the top most level, so if you mark a building it will teleport to the top of that building (No permissions, client side)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RegisterCommand("tp", function(source, args, rawCommand) | |
local waypointBlip = GetFirstBlipInfoId(GetWaypointBlipEnumId()) | |
local blipPos = GetBlipInfoIdCoord(waypointBlip) -- GetGpsWaypointRouteEnd(false, 0, 0) | |
local z = GetHeightmapTopZForPosition(blipPos.x, blipPos.y) | |
local _, gz = GetGroundZFor_3dCoord(blipPos.x, blipPos.y, z, true) | |
SetEntityCoords(PlayerPedId(), blipPos.x, blipPos.y, z, true, false, false, false) | |
FreezeEntityPosition(PlayerPedId(), true) | |
repeat | |
Citizen.Wait(50) | |
_, gz = GetGroundZFor_3dCoord(blipPos.x, blipPos.y, z, true) | |
until gz ~= 0 | |
SetEntityCoords(PlayerPedId(), blipPos.x, blipPos.y, gz, true, false, false, false) | |
FreezeEntityPosition(PlayerPedId(), false) | |
end, false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment