getRoadDensity
Client
Measures how much road there is around a point: the lanes times the length of the car links starting within 80 m of it, scaled down.
float getRoadDensity(float x, y)
Parameters
| Name | Type | Description |
|---|---|---|
| x, y | float | The point on the map. |
Returns
The density, 0 when there are no loaded roads nearby.
Example
local position = getElementPosition(localPlayer)
if getRoadDensity(position.x, position.y) < 0.1 then
outputDebugString("you are far from any road")
endNoteOnly nodes in loaded path areas count: those near the player, or requested with
requestPathNodesInArea.