SA-MP Forums Archive
[HELP] Continuos move object. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Continuos move object. (/showthread.php?tid=77609)



[HELP] Continuos move object. - Hot - 12.05.2009

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

Thanks ~


Re: [HELP] Continuos move object. - JaYmE - 12.05.2009

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


Re: [HELP] Continuos move object. - Hot - 13.05.2009

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


Re: [HELP] Continuos move object. - Weirdosport - 13.05.2009

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


Re: [HELP] Continuos move object. - Hot - 13.05.2009

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.


Re: [HELP] Continuos move object. - MX_Master - 13.05.2009

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 );
	}
}



Re: [HELP] Continuos move object. - kaisersouse - 13.05.2009

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.


Re: [HELP] Continuos move object. - Think - 13.05.2009

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);



Re: [HELP] Continuos move object. - Kenny990 - 17.05.2009

I can't get this to work myself.