setObjectProperty | Multi Theft Auto: Wiki Skip to content

setObjectProperty

Client-side
Server-side
Shared

Pair: getProperty

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function sets a property of the specified object.

OOP Syntax Help! I don't understand this!

  • Method:object:setProperty(...)

Syntax

bool setObjectProperty ( object theObject, string property, var value )
Required Arguments
  • theObject: the object you wish to change a property of.
  • property: the property you want to set the value of:
  • value: MISSING_PARAM_DESC

Returns

  • bool: value

Returns true if the property was set successfully, false otherwise.

Code Examples

shared
addEventHandler("onClientResourceStart", resourceRoot, function()
local theObject = createObject(980, 0, 0, 0) -- create an object
if theObject then
setObjectProperty(theObject, "center_of_mass", 0, -1, 0) -- set its center of mass
end
end)