Set waypoint bind?

Does anyone know how to edit coding so a waypoints can be set if a bind is pressed. For example, for the police job in my server, if a shots fired notification was to come through how can I make it so it says “shots fired at Alta street. PRESS E TO SET WAYPOINT”. Any help would be great thanks

1 Like

You can do this by listening for a keypress and triggering an event / calling a function which sets a waypoint at the given coords which it should carry through the notification.

Example:

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(1)
        if AlertIsShowing then
            ESX.ShowNotification('Someone is stealing a cookie at...')
            if IsControlJustReleased(0, 38) then
                setWaypoint(pos) 
            end
        end
    end
end)

setWaypoint = function()
    SetNewWaypoint(pos.x, pos.y)
    ESX.ShowNotification('Location pushed to your GPS')
end

Built it in a thread for the example, which you shouldn’t be doing if you’re planning to implement this in an existing resource. This is purely to give you the logical feeling of what I’m thinking.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.