How do I calculate the distance in a native?

I have been using GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), x, y, z) < a certain value but what I can’t figure out is that how do I calculate the distance on the map or in game terms so that suppose I want to get the distance between Fudge Lane and Forum Drive for example, like what is the distance measurement criteria?

So, you want the “driving distance” between coords? maybe this? CalculateTravelDistanceBetweenPoints - FiveM Natives @ Cfx.re Docs

Not sure if this answers your question but just like the function GetDistanceBetweenCoords() you could use 2 coords that are in both of these streets.

FudgeCoords = vector3(132, 123, 132)
ForumCoords = vector3(654, 654, 654)

DistanceStreets = GetDistanceBetweenCoords(FudgeCoords, ForumCoords)

For future reference you could also use
DistanceStreets = #(FudgeCoords - ForumCoords)
Since that needs less calculation but does the same thing :smiley:

Thanks both of you, this was what I was looking for @ChatDisabled @CritteR

1 Like