M MY Multiplayer: Wiki
Side
Kind

isLineOfSightClear

Client

Tells whether nothing blocks the segment between two points. Only buildings and objects block it, not vehicles or peds.

bool isLineOfSightClear(float startX, startY, startZ, float endX, endY, endZ)

Parameters

NameTypeDescription
startX, startY, startZfloatWhere the segment starts. A vec3 also works.
endX, endY, endZfloatWhere the segment ends. A vec3 also works.

Returns

true if the way is clear.

Example

local function canSee(ped)
    return isLineOfSightClear(getElementPosition(localPlayer), getElementPosition(ped))
end

See also