GetClosestEntity(position)

Finds the nearest entity to a given position.

Parameters:

  • position (vector3): World coordinates to check from.

Returns:

  • table: The nearest entityData or nil if none found.

Example:

local nearest = exports['mrctv']:GetClosestEntity(GetEntityCoords(PlayerPedId()))