12.05.2009, 21:13
How could I make it?
To keep a object moving?
Thanks ~
To keep a object moving?
Thanks ~
// top of script
new MyObject;
new MoveObject = 0;
// OnGameModeInit()
MyObject = CreateObject(...);
// in timer function
if(MoveObject == 0)
{
MoveObject(MyObject, ...);
}
stock movingObject, movingObjectState;
public OnGameModeInit()
{
movingObject = CreateObject( 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 );
SetTimerEx( "moveObject", 1000, 1, "d", movingObject );
}
forward moveObject ( objectid );
public moveObject ( objectid )
{
if ( movingObjectState )
{
movingObjectState = 0;
MoveObject( objectid, 5.0, 5.0, 0.0, 1.0 );
}
else
{
movingObjectState = 1;
MoveObject( objectid, 0.0, 0.0, 0.0, 1.0 );
}
}
new Float:x, Float:y, Float:z;
GetObjectPos(objectid, x, y, z);
MoveObject(objectid, x+5, y+5, z, 2.5);