GetObjectMass: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Needs_Example}}
__NOTOC__
__NOTOC__
{{client_function}}
{{client_function}}
Line 18: Line 17:


==Example==
==Example==
 
This script basically creates an object then get's the mass and set's its mass 300 more than it's original mass, then tell the client the old and new mass of the object.
<syntaxhighlight lang="lua">local object = createObject(1337,0,0,3)
local oldMass = getObjectMass(object)
local newMass = oldMass+300.0
setObjectMass(object,newMass)
outputChatBox("Object Old Mass: "..oldMass..", New Mass: "..newMass)</syntaxhighlight>
==See Also==
==See Also==
{{Client_object_functions}}
{{Client_object_functions}}

Revision as of 19:09, 6 May 2013

This function returns the mass of a specified object.

Syntax

float getObjectMass ( object theObject )

Required Arguments

  • theObject: The object whose mass you want to get.

Returns

Returns a float representing the mass of the object, false if invalid arguments were passed.

Example

This script basically creates an object then get's the mass and set's its mass 300 more than it's original mass, then tell the client the old and new mass of the object.

local object = createObject(1337,0,0,3)
local oldMass = getObjectMass(object)
local newMass = oldMass+300.0
setObjectMass(object,newMass)
outputChatBox("Object Old Mass: "..oldMass..", New Mass: "..newMass)

See Also