SA-MP Forums Archive
Is it possible? - 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)
+--- Thread: Is it possible? (/showthread.php?tid=310051)



Is it possible? - Outcast - 10.01.2012

Is it possible to move an object on a set path, without the use of timers? I mean, like going in circle etc. Is there a code snippet somewhere around here? Thanks.


Re: Is it possible? - mitosking - 10.01.2012

Use the function MoveObject.


Re: Is it possible? - Outcast - 10.01.2012

I know that, but it moves the object in a straight line. I would like it to move the object in a set path, like forward, right, forward, left, back etc...


Re: Is it possible? - mitosking - 10.01.2012

Use callback OnObjectMoved and use var. Example:

pawn Код:
new object, move;

object = CreateObject(...);
move = 0;

// Into script

MoveObject(object, ...);
move = 1;

// Into callback OnObjectMoved

if(objectid == object)
{
switch(move)
{
case 1:
{
MoveObject(...) // Insert new coordinates
move = 2;
}
case 2:
{
MoveObject(...) // Other coordinates
move = 3;
}
case 3:
{
MoveObject(...) // Other coordinates
move = 4;
}
case 4:
{
MoveObject(...) // Other coordinates
move = 0;
}
}



Re: Is it possible? - Outcast - 10.01.2012

Okay, I'll use timers then. I got it working and all.