GetElementRadius: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 20: Line 20:
This example shows how to get the radius of a player
This example shows how to get the radius of a player
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function myCommandHandler(source, command)
function myCommandHandler(command)
local myradius = getElementRadius ( source )
local myradius = getElementRadius ( getLocalPlayer() )
if (myradius) then
if (myradius) then
outputChatBox("Radius of my player is: " .. myradius)
outputChatBox("Radius of my player is: " .. myradius)

Revision as of 12:47, 25 May 2010

This function gets the radius from a element.

Syntax

float getElementRadius ( element theElement )

Required Arguments

  • theElement: The element.

Returns

Returns float as radius, false otherwise.

Example

This example shows how to get the radius of a player

function myCommandHandler(command)
	local myradius = getElementRadius ( getLocalPlayer() )
	if (myradius) then
		outputChatBox("Radius of my player is: " .. myradius)
	else
		outputChatBox("Error")
	end	
end

addCommandHandler("getmyradius", myCommandHandler)

See Also