getPathNodeNeighbours
Shared
Lists the nodes linked to a path node and what each link is like.
table|false getPathNodeNeighbours(int node)
Parameters
| Name | Type | Description |
|---|---|---|
| node | int | A node id, as the other path functions return it. |
Returns
A list with one table per link, or false if the node's area is not loaded.
Each table has node (the neighbour's id) and length (the link's length in metres). On a car node, when the link has lanes, also lanesTo (lanes from this node to the neighbour), lanesFrom (lanes from the neighbour to this node) and trafficLight. On a ped node, crossesRoad (the link crosses a road) and pedTrafficLight.
Example
local position = getElementPosition(localPlayer)
local node = getClosestPathNode(position.x, position.y, position.z)
for _, link in ipairs(node and getPathNodeNeighbours(node) or {}) do
if link.lanesTo and link.lanesTo > 0 then
outputDebugString(("can drive to %d (%d m)"):format(link.node, link.length))
end
end