GetElementRadius: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Added OOP syntax introduced in r6987 and improved the page) |
||
Line 1: | Line 1: | ||
{{Client function}} | {{Client function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function gets the radius | This function gets the radius of an [[element]]. Normally, sphere or circle-shaped elements tend to return a more accurate and expected radius than others with another shapes. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float getElementRadius ( element theElement ) | float getElementRadius ( element theElement ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{New feature/item|3.0141|1.4.0|6987|{{OOP||[[element]]:getRadius|radius}}}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theElement:''' The element. | *'''theElement:''' The element to get the radius of. It can be any entity type, such as: | ||
** ''' | ** '''[[player|Players]]'''. | ||
** ''' | ** '''[[ped|Peds]]'''. | ||
** ''' | ** '''[[vehicle|Vehicles]]'''. | ||
** '''[[object|Objects]]'''. | |||
===Returns=== | ===Returns=== | ||
Returns ''float'' | Returns a ''float'' containing the radius if the element is valid, ''false'' otherwise. | ||
==Example== | ==Example== | ||
This example shows how to get the radius of | This example shows how to get and output the radius of every player who types the ''/getmyradius'' command (which will always be ''1''). | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | local function outputLocalPlayerRadius() | ||
outputChatBox("Your radius is " .. getElementRadius(localPlayer)) | |||
end | end | ||
addCommandHandler("getmyradius", outputLocalPlayerRadius) | |||
addCommandHandler("getmyradius", | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client element functions}} | {{Client element functions}} |
Latest revision as of 13:53, 31 December 2014
This function gets the radius of an element. Normally, sphere or circle-shaped elements tend to return a more accurate and expected radius than others with another shapes.
Syntax
float getElementRadius ( element theElement )
OOP Syntax Help! I don't understand this!
- Method: element:getRadius(...)
- Variable: .radius
Required Arguments
- theElement: The element to get the radius of. It can be any entity type, such as:
Returns
Returns a float containing the radius if the element is valid, false otherwise.
Example
This example shows how to get and output the radius of every player who types the /getmyradius command (which will always be 1).
local function outputLocalPlayerRadius() outputChatBox("Your radius is " .. getElementRadius(localPlayer)) end addCommandHandler("getmyradius", outputLocalPlayerRadius)
See Also
- getElementBoneMatrix
- getElementBonePosition
- getElementBoneRotation
- getElementBoundingBox
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementLighting
- getElementRadius
- isElementCollidableWith
- isElementLocal
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementWaitingForGroundToLoad
- setElementBoneMatrix
- setElementBonePosition
- setElementBoneRotation
- setElementCollidableWith
- setElementStreamable
- updateElementRpHAnim
- Shared
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement