Get/Set GPS(map) Waypoint

Can anyone point me in the right direction as to which Native can get/set the GPS(map) waypoint? I’m attempting to sync 2 players waypoints so that if 1 places a waypoint, the other will also receive the update. I know how to code the player syncing but I don’t see any native functions that stand out to get/set the actual waypoint coordinates. Thanks!

SetNewWaypoint(x, y)

As for getting it, I’m not sure. You might be able to get the blip and find the coordinates of the blip, but I’m not even sure if thats possible with waypoints.

1 Like

Yeah I just found SetNewWaypoint which is cool, but getting it was what I was really after. I’ve seen other mods do it but I’m wondering if they maybe coded a custom waypoint system with pathfinding and blips or something to that nature. I’ll keep looking thanks Briglair.

So I managed to find the Waypoint blip and make it flash. So if I can get the blip handle I’m sure I can make this work. I’ll keep you posted if you are interested.

local blipid = 8
local blip = GetFirstBlipInfoId(blipid)
  
if blip ~= nil then
    SetBlipFlashTimer(blip, 5000)
    SetBlipFlashes(blip, true)
end

DiD you get this to work?

if you want to add custom waypoint to any blip

--[[ random coords ]]
x = 159.0
y = 1643.0
z = 30.0

BLIP_1 = AddBlipForCoord(x,  y,  z)
SetBlipSprite(BLIP_1, 50)
SetBlipRoute(BLIP_1,  true) -- waypoint to blip
--SetBlipRouteColour( blip,  colour )
2 Likes

Could you send me the code possibly once it’s complete? Thanks

1 Like

Is it possible to type road name in to chat for waypoint ?

is anyone able to contact me on discord with further development of this script M.Asquith
#6157

Hello ! i’m using this to create my waypoint for my farm job on fivem, but i don’t know how to delete it when the player is on the point … I try 10 way to do that but I don’t find how. Thanks for answer and a big sorry for my english (i’m french) … i hope you understand :slight_smile:

Hey,

You should call SetBlipRoute with false as second parameter:

-- assuming your blip it's called "BLIP_1" like in the example provided above
SetBlipRoute(BLIP_1, false)

If you want to remove the blip you must use RemoveBlip

-- assuming your blip it's called "BLIP_1" like in the example provided above
RemoveBlip(BLIP_1)

If you don’t know how to check players distance to a point here’s a little snippet, I didn’t test it in-game but it should work

local ped, pos, dist_between
local random_location = vector3(100.3, 200.3, 76.0)

Citizen.CreateThread(function()
    while true do
        Wait(500)
        
        ped = PlayerPedId()
        pos = GetEntityCoords(ped)
        dist_between = #(pos - random_location)

        if dist_between < 10 then
            print("at location")
            -- your code here
        end
    end
end)