IsObjectMoving: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Remove obsolete Requirements section)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Shared function}}
{{Added feature/item|1.5.9|1.5.8|20811|This function checks if an [[object]] is moving.}}
{{Added feature/item|1.5.9|1.5.8|20811|This function checks if an [[object]] is moving.}} {{New feature/item|3.0161|1.6.0|22430|This function is now also available on the server side.}}


==Syntax==  
==Syntax==  
Line 29: Line 29:
)
)
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|n/a|1.5.8-9.20811|}}


==See Also==
==See Also==
{{Client_object_functions}}
{{Client_object_functions}}

Latest revision as of 17:08, 7 November 2024

This function checks if an object is moving.

ADDED/UPDATED IN VERSION 1.6.0 r22430:
This function is now also available on the server side.

Syntax

bool isObjectMoving ( object theObject )

OOP Syntax Help! I don't understand this!

Method: object:isMoving(...)
Variable: .moving


Required Arguments

Returns

  • Returns true if the object is moving, false otherwise.

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 (commandName)
        outputChatBox ("Is object "..(isObjectMoving(object) and "moving" or "not moving"))
    end
)

See Also