MoveObject

From Multi Theft Auto: Wiki
Revision as of 17:05, 18 May 2006 by Black Dragon (talk | contribs)
Jump to navigation Jump to search

Description

This function will smoothly move an object from its current position/rotation to the given target position/rotation in the given time. If the function fails for some reason, it will return false.

Syntax

 bool moveObject ( object, time, targetx, targety, targetz, targetrx, targetry, targetrz )

Required Arguments

  • object: The object that will be moved.
  • time: The time in milliseconds the object will arrive at the destination.
  • targetx: The X value of the target position
  • targety: The Y value of the target position
  • targetz: The Z value of the target position

Optional Arguments

  • targetrx: The X value of the target rotation
  • targetry: The Y value of the target rotation
  • targetrz: The Z value of the target rotation

Returns

Returns true if the function moved the object succesfully, and returns false otherwise.

Example

someGuy = getPlayerFromNick ( "someGuy" )
 if ( someGuy ) then
   x, y, z = getPlayerPosition ( someGuy )
   bed = createObject ( 1700, x + 5, y, z )
   moveObject ( bed, 3000, x, y, z )
   outputChatBox ( "Moving a bed towards someguy", player )
 else
   outputChatBox ( "Player someguy doesn't exist", player )
 end