update
Updates an existing waypoint's properties. Only the properties you specify will be changed.
Parameters
id(number): The waypoint ID returned fromcreatedata(WaypointData): A table containing the properties to updatecoords?(vector3): New position for the waypointcolor?(string): New hex colorlabel?(string): New label texticon?(string): New iconsize?(number): New size multiplierdrawDistance?(number): New maximum render distancefadeDistance?(number): New fade distanceminHeight?(number): New minimum heightmaxHeight?(number): New maximum heightgroundZ?(number): New ground Z coordinate
Examples
Update Position
local id = exports.sleepless_waypoints:create({
coords = vec3(100.0, 200.0, 30.0),
type = 'checkpoint',
label = 'TARGET',
})
-- Move the waypoint to a new position
exports.sleepless_waypoints:update(id, {
coords = vec3(150.0, 250.0, 35.0),
})Update Appearance
-- Change the color and label
exports.sleepless_waypoints:update(id, {
color = '#e74c3c',
label = 'DANGER ZONE',
})Dynamic Waypoint
-- Create a waypoint that follows an entity
local targetEntity = GetClosestPed(GetEntityCoords(cache.ped), 50.0, true, true, true, true)
local id = exports.sleepless_waypoints:create({
coords = GetEntityCoords(targetEntity),
type = 'small',
color = '#3498db',
icon = 'user',
size = 0.2,
})
-- Update the waypoint position periodically
CreateThread(function()
while DoesEntityExist(targetEntity) do
exports.sleepless_waypoints:update(id, {
coords = GetEntityCoords(targetEntity),
})
Wait(100)
end
exports.sleepless_waypoints:remove(id)
end)⚠️
If you need to update multiple properties at once, pass them all in a single update call for better performance.