How to get GPS distance shown in the hud?

Hi,

I am working on my custom hud project and I would like to remove this distance value from the minimap overlay and get the distance reaming to a waypoint so i can use it in my html made hud.

From what I have found this is the scale form that is responsible for showing this value on the map “HIDE_SATNAV”.

Just to make everything clear I have used natives such as Vdist, CalculateTravelDistanceBetweenPoints etc. and none of them work. Please help me out with my issue

Zrzut ekranu 2024-07-27 004441

The scaleform that handles the sat nav is minimap, the scaleform method is HIDE_SATNAV/SHOW_SATNAV and SET_SATNAV_DIRECTION.

Here is an example of how you could remove both the arrow (direction) and the distance:

local minimapScaleform = nil

CreateThread(function()
    minimapScaleform = RequestScaleformMovie('minimap')

    -- Refreshes the minimap
    SetRadarBigmapEnabled(true, false)
    Wait(0)
    SetRadarBigmapEnabled(false, false)

    -- Removes the sat nav (direction and distance)
    while true do
        -- Direction (arrows)
        BeginScaleformMovieMethod(minimapScaleform, 'SET_SATNAV_DIRECTION')
        ScaleformMovieMethodAddParamInt(0)
        EndScaleformMovieMethod()

        -- Distance
        BeginScaleformMovieMethod(minimapScaleform, 'HIDE_SATNAV')
        EndScaleformMovieMethod()

        Wait(0)
    end
end)

Now, you don’t have to loop these, but they tend to be changed by the game whenever the player has a waypoint on their map etc.

You can find more of these minimap scaleform methods here: SimpleMinimap/minimap.lua at main · 8JP8/SimpleMinimap · GitHub

I hope this helps!

Hi,

I don’t exactly want to hide minimal or the distance, but get the value that is shown. In this example it is 3.47 km

Okay… well then I was mistaken. I believe that CalculateTravelDistanceBetweenPoints would be the best native for what I think you want to do. For long distances, you might need to force-load the path nodes to make the native work.

I don’t think it’s possible to get the variable from the hud as I think you want to do.