GetObjectScale: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (Function actually returns 3 floats for x, y, z)
Line 5: Line 5:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float getObjectScale ( object theObject )
float, float, float getObjectScale ( object theObject )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[object]]:getScale|scale|setObjectScale}}
{{OOP||[[object]]:getScale|scale|setObjectScale}}
Line 12: Line 12:


===Returns===
===Returns===
* A [[float]] indicating the scale of the object, if successful.
* Three [[float]] values indicating the scale of the object on the x, y, and z axis, if successful.
* ''false'' otherwise.
* ''false'' otherwise.



Revision as of 14:16, 26 February 2018

This function returns the visible size of an object.

Syntax

float, float, float getObjectScale ( object theObject )

OOP Syntax Help! I don't understand this!

Method: object:getScale(...)
Variable: .scale
Counterpart: setObjectScale


Required Arguments

  • theObject: the object you wish to return the scale of.

Returns

  • Three float values indicating the scale of the object on the x, y, and z axis, if successful.
  • false otherwise.

Example

Click to collapse [-]
Client

This example adds a command get_scale which create object and prints out a scale of the object.

addCommandHandler( 'get_scale',
	function( )
		local uObject = createObject( 1337, getElementPosition( localPlayer ) )
		outputChatBox( string.format( 'Object scale is %s !', getObjectScale( uObject ) ) )
	end
)

See Also