26.01.2014, 15:09
Here's a function that moves an object in the specified time (in milliseconds):
General example:
pawn Code:
stock MoveObjectEx(objectid, time, Float:x, Float:y, Float:z, Float:rx = -1000.0, Float:ry = -1000.0, Float:rz = -1000.0)
{
if (!IsValidObject(objectid))
return 0;
static
Float:fX,
Float:fY,
Float:fZ,
Float:fDist;
GetObjectPos(objectid, fX, fY, fZ);
fDist = floatsqroot(((fX - x) * (fX - x)) + ((fY - y) * (fY - y)) + ((fZ - z) * (fZ - z)));
MoveObject(objectid, x, y, z, floatdiv(floatsqroot(x + y + z), time / floatmul(fDist, 15)), rx, ry, rz);
return 1;
}
pawn Code:
MoveObjectEx(gGateID, 1000, gMoveX, gMoveY, gMoveZ);