Functions/Player/Shared/getEyeSightHitEntity

From DarkRP
Function
Function name Player:getEyeSightHitEntity(number searchDistance, number hitDistance, function filter)
Description:
Get the entity that is closest to a player's line of sight and its distance.
Returns: Entity closestEnt, number distance
Part of Library: Player
Realm:
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=Functions/Player/Shared/getEyeSightHitEntity]Player:getEyeSightHitEntity[/url][/b]

Function parameters[edit]

  1. searchDistance (number) (optional)
  2. How far to look. You usually don't want this function to return an entity millions of units away. The default is 100 units.

  3. hitDistance (number) (optional)
  4. The maximum distance between the player's line of sight and the object. Basically how far the player can be 'looking away' from the object. The default is 15 units.

  5. filter (function) (optional)
  6. The filter for which entities to look for. By default it only looks for players.


Function return values[edit]

  1. closestEnt (Entity)
  2. The entity that is closest to the player's line of sight. Returns nil when not found.

  3. distance (number)
  4. The (minimum) distance between the player's line of sight and the object.