21.02.2010, 15:08
pawn Код:
new ufo;
pawn Код:
public OnFilterScriptInit()
{
ufo = CreateObject(13607, -2058.7773, -198.6086, 98.033844, 0.0000, 0.0000, 0.0000);
MoveObject(ufo, -2058.7773, 1320.0000, 98.033844, 2.5000);
}
pawn Код:
public OnObjectMoved(objectid)
{
if(objectid == ufo)
{
MoveObject(ufo, -2058.7773, -198.6086, 98.033844, 2.5000);
ufo += MAX_OBJECTS;
}
else if(objectid == (ufo - MAX_OBJECTS))
{
ufo -= MAX_OBJECTS;
MoveObject(ufo, -2058.7773, 1320.0000, 98.033844, 2.5000);
}
}
pawn Код:
forward Move();
public Move()
{
MoveObject(ufo, -2058.7773, 1320.0000, 98.033844, 2.5000);
}
pawn Код:
public OnObjectMoved(objectid)
{
if(objectid == ufo)
{
SetTimer("Move", (MoveObject(ufo, -2058.7773, -198.6086, 98.033844, 2.5000) - 10), false);
//MoveObject returns the time it will take for the object to move in milliseconds
//And the - 10 because if it completely moved it will call OnObjectMoved to move again to the same cords
//So we call the object 10 ms before back (we could do + 10 but then the OnObjectMoved code gets unused executed)
}
}

