GetElementRadius: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Added OOP syntax introduced in r6987 and improved the page) |
||
(19 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | {{Client function}} | ||
__NOTOC__ | |||
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 | 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 to get the radius of. It can be any entity type, such as: | |||
*''' | ** '''[[player|Players]]'''. | ||
** '''[[ped|Peds]]'''. | |||
** '''[[vehicle|Vehicles]]'''. | |||
** '''[[object|Objects]]'''. | |||
*''' | |||
*''' | |||
===Returns=== | ===Returns=== | ||
Returns a ''float'' containing the radius if the element is valid, ''false'' otherwise. | |||
==Example== | ==Example== | ||
This example shows how to get and output the radius of every player who types the ''/getmyradius'' command (which will always be ''1''). | |||
This example | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local function outputLocalPlayerRadius() | |||
outputChatBox("Your radius is " .. getElementRadius(localPlayer)) | |||
end | |||
addCommandHandler("getmyradius", outputLocalPlayerRadius) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{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