IsEntityWithinDistance
Checks if a target entity is within a specified distance.
Parameters
targetEntity
: The entity to check against (number).maxDistance
: Maximum distance in game units (number).fromEntity
: Entity to measure from; defaults to the player's ped (number, optional).
Returns
boolean
: Whether the distance is within the limit.number
: The actual distance between entities.
Usage
- Lua
- Javascript
local withinRange, distance = exports['FS-Lib']:IsEntityWithinDistance(targetEntity, 5.0)
const [withinRange, distance] = exports['FS-Lib'].IsEntityWithinDistance(targetEntity, 5.0);