Functions/Player/Shared/getEyeSightHitEntity

From Official DarkRP Wiki
Revision as of 14:39, 31 October 2015 by DarkRPBot (talk | contribs) (Wikibot updated DarkRP documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
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: NewerShared.png
BBCode Link: [b][url=http://wiki.darkrp.com/index.php?title=Functions/Player/Shared/getEyeSightHitEntity]Player:getEyeSightHitEntity[/url][/b]

Function parameters

  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

  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.