GetClosestRoad
Docslocal retval, srcNode, targetNode, laneCountForward, laneCountBackward, width = GetClosestRoad(x, y, z, minimumEdgeLength, minimumLaneCount, onlyMajorRoads)Description
Finds an edge (node connection to another node) that satisfies the specified criteria.
Parameters
| Name | Type | Description |
|---|---|---|
x | float | x position |
y | float | y position |
z | float | z position |
minimumEdgeLength | float | Minimum distance the srcNode must be from the targetNode. |
minimumLaneCount | int | Minimum number of lanes the connection must have. |
srcNode | Vector3* | Position of the edge source |
targetNode | Vector3* | Position of the edge target |
laneCountForward | int* | Lane count forward |
laneCountBackward | int* | Lane count backwards |
width | float* | Width of gap in middle of road between forward and backward lanes. |
onlyMajorRoads | BOOL | Return major roads only. |
Quick Snippet: Get CoordinatesxyzsrcNode
xyzsrcNodeAdd this command to your client script to retrieve precise locations in-game.
-- Add this to your client.lua. Type /pos in-game to copy coords.
RegisterCommand('pos', function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local output = string.format("vector4(%.2f, %.2f, %.2f, %.2f)", coords.x, coords.y, coords.z, heading)
print(output)
TriggerEvent('chat:addMessage', { args = { '^4[COORD]^0', output } })
end)Returns
boolReturns true or false.