shared Player FindNearestPlayer(Vector origin, number radius, Player attacker, number fov)
Description
Looks for the nearest survivor within a radius. If you specify fov, the survivor is searched for in a cone in front of the player, still taking the radius into account.
All animatronics with a jumpscare use this exact function for it.
Arguments
1Vector origin
- The position the search starts from.
2number radius
- The search radius.
3Player attacker
- The "attacking" player. They are excluded from the search candidates.
4number fov
- The field of view in which the search is performed. If both
attackerandfovare specified, the calculations are made from theattacker's eyes.
Returns
1Player ply
- Returns the player if one is found. Otherwise returns nil.
