Skip to main content

MovePlayerObject

Description

Move a player object with a set speed. Also supports rotation. Players/vehicles will surf moving objects.

NameDescription
playeridThe ID of the player whose player-object to move.
objectidThe ID of the object to move.
Float:targetXThe X coordinate to move the object to.
Float:targetYThe Y coordinate to move the object to.
Float:targetZThe Z coordinate to move the object to.
Float:speedThe speed at which to move the object.
Float:rotationXThe final X rotation (optional).
Float:rotationYThe final Y rotation (optional).
Float:rotationZThe final Z rotation (optional).

Returns

The time it will take for the object to move in milliseconds.

Examples

new gPlayerObject[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
gPlayerObject[playerid] = CreatePlayerObject(playerid, 2587, 2001.195679, 1547.113892, 14.283400, 0.0, 0.0, 96.0);

MovePlayerObject(playerid, gPlayerObject[playerid], 2001.195679, 1547.113892, 10.000000, 2.0);
return 1;
}

Notes

tip

If using the rotation parameters, the object must be moved (X/Y/Z). The object will interpolate the rotation from when the objects starts moving and when it stops.