GetElementRadius: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Added OOP syntax introduced in r6987 and improved the page)
 
(18 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__  
{{Client function}}
This fake function is for use with blah & blah and does blahblahblabhalbhl
__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 theElement )
float getElementRadius ( element theElement )
</syntaxhighlight>  
</syntaxhighlight>
{{New feature/item|3.0141|1.4.0|6987|{{OOP||[[element]]:getRadius|radius}}}}


===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''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 ''true'' if blah, ''false'' otherwise.
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'').
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
local function outputLocalPlayerRadius()
blabhalbalhb --abababa
    outputChatBox("Your radius is " .. getElementRadius(localPlayer))
--This line does this...
end
mooo
addCommandHandler("getmyradius", outputLocalPlayerRadius)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Client element functions}}
{{Client element functions}}
[[Category:Incomplete]]

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

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