MoveObject

From Multi Theft Auto: Wiki
Revision as of 14:15, 30 March 2006 by ChrML (talk | contribs) (→‎Example)
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
  • targetrx: The X value of the target rotation
  • targetry: The Y value of the target rotation
  • targetrz: The Z value of the target rotation

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 )
  serverChat ( "Moving a bed towards someguy" )
else
  serverChat ( "Player someguy doesn't exist" )
end