IsElementInRange
Jump to navigation
Jump to search
This function allows you to find out is the element in range of the main point.
Syntax
bool isElementInRange( element theElement, float x, float y, float z, fload range )
Required Arguments
- theElement: the element whose range we want to check.
- x: the x coordinate of the main point.
- y: the y coordinate of the main point.
- z: the z coordinate of the main point.
- range: the range of the main point to the element.
Returns
- Returns true if the element is in range of the main point, false otherwise.
Code
Click to collapse [-]
Function sourcefunction isElementInRange(element, x, y, z, range) if element and x and y and z and range then local px,py,pz = getElementPosition (player) return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5 <= range -- returns true if it the range of the element to the main point is smaller than (or as big as) the maximum range. else return false end end end