getElementRadius | Multi Theft Auto: Wiki Skip to content

getElementRadius

Client-side
Server-side
Shared

This function gets the radius of an element. This can be a player, ped, vehicle, object or weapon. Normally, sphere or circle-shaped elements tend to return a more accurate and expected radius than others with another shapes.

OOP Syntax Help! I don't understand this!

  • Method:element:getRadius(...)
  • Variable: .radius

Syntax

float|false getElementRadius ( ​element theElement )
Required Arguments
  • theElement: The element to get the radius of.

Returns

  • float|false: radius

Returns a float containing the radius if the element is valid, false otherwise.

Code Examples

client

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

Element Functions