[HELP] Continuos move object.
#1

How could I make it?
To keep a object moving?

Thanks ~
Reply
#2

pawn Код:
// top of script
new MyObject;
new MoveObject = 0;

// OnGameModeInit()
MyObject = CreateObject(...);

// in timer function
if(MoveObject == 0)
{
 MoveObject(MyObject, ...);
}
and just use a timer to move the object
Reply
#3

I think i didn't unterstand :/ can you explain it better?
Reply
#4

What do you mean continuously move? Just set the co-ordinates far away and make it go slowly?
Reply
#5

I mean , it execute always the same move, like go forward and than backward, forward, backward, like it be in "loop"

and sorry about my bad english.
Reply
#6

you can change any of coordinates, time delays, ids and speeds

Код:
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 );
	}
}
Reply
#7

YEah....so you dont need a timer if you use OnObjectMoved

Assign ID to your object, set it to move once in OnGameModeInit, then use OnObjectMoved to loop it.
Reply
#8

could do this too,

pawn Код:
new Float:x, Float:y, Float:z;
GetObjectPos(objectid, x, y, z);
MoveObject(objectid, x+5, y+5, z, 2.5);
Reply
#9

I can't get this to work myself.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)