IsObjectMoving: Difference between revisions
Jump to navigation
Jump to search
(moved IsObjectMoving to IsElementMoving: This "useful" function is not only useful for objects but also for elements like players/vehicles (Also fixed a bug check out talk page)) |
Cleopatradev (talk | contribs) (Removed redirect to IsElementMoving) Tag: Removed redirect |
||
Line 1: | Line 1: | ||
__NOTOC__ | |||
{{Client function}} | |||
This function checks if the object is movings. | |||
==Syntax== | |||
<syntaxhighlight lang="lua">bool isObjectMoving ( object theObject )</syntaxhighlight> | |||
===Required Arguments=== | |||
*'''theObject:''' The [[object]] | |||
===Returns=== | |||
* ''true'' if the object is moving. | |||
* ''false'' if the object is not moving. | |||
==Example== | |||
This example creates an object when the resource starts and checks if the object is moving. | |||
<syntaxhighlight lang="lua"> | |||
addEventHandler("onClientResourceStart", resourceRoot, | |||
function() | |||
local x, y, z = getElementPosition(localPlayer) | |||
object = createObject(1239, x, y, z) | |||
moveObject(object, 5000, x, y, z + 5) | |||
end | |||
) | |||
addCommandHandler("getmoving", | |||
function(cmd) | |||
outputChatBox("Is object "..(isObjectMoving(object) and "moving" or "not moving")) | |||
end | |||
) | |||
</syntaxhighlight> | |||
==Requirements== | |||
{{Requirements|n/a|1.5.8-9.20811|}} | |||
==See Also== | |||
{{Client_object_functions}} |
Revision as of 22:33, 21 January 2021
This function checks if the object is movings.
Syntax
bool isObjectMoving ( object theObject )
Required Arguments
- theObject: The object
Returns
- true if the object is moving.
- false if the object is not moving.
Example
This example creates an object when the resource starts and checks if the object is moving.
addEventHandler("onClientResourceStart", resourceRoot, function() local x, y, z = getElementPosition(localPlayer) object = createObject(1239, x, y, z) moveObject(object, 5000, x, y, z + 5) end ) addCommandHandler("getmoving", function(cmd) outputChatBox("Is object "..(isObjectMoving(object) and "moving" or "not moving")) end )
Requirements
This template will be deleted.
See Also
- createObject
- getObjectScale
- moveObject
- setObjectScale
- stopObject
- getObjectMass
- getObjectProperty
- setObjectMass
- setObjectProperty