SA-MP Forums Archive
Spining object like a pickup - 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: Spining object like a pickup (/showthread.php?tid=580543)



Spining object like a pickup - Conradus - 06.07.2015

Hello everyone,

I've tried adding weapon pickups to an island pretty far from the main map.
At a certain point the pickups stop working, so I figured to use objects instead and rotate them using MoveObject.
Does anyone know how to rotate an object infinitely like a pickup? Like what parameters I need to use in MoveObject?

Thanks in advance.


Re: Spining object like a pickup - JaydenJason - 06.07.2015

Код:
// Create the object at the center of San Andreas [just used for example]
new eg_obj = CreateObject(1234, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0);

// Rotate the object by 180 degrees on the z axis
MoveObject(eg_obj, 0, 0, 3+0.0001, 0.0001, 0.0, 0.0, 180.0);
now I think you could move the object its Z rotation to "cellmax", I never used it so I don't know if it works, you could try it out?

Код:
new eg_obj = CreateObject(1234, x, y, z, 0.0, 0.0, 0.0);
MoveObject(eg_obj, x, y, z+0.0001, 0.0001, 0.0, 0.0, cellmax);
Orr you could make a looping timer that keeps adding +360 degrees to the Z axis?

taken from:
https://sampforum.blast.hk/showthread.php?tid=295590


Re: Spining object like a pickup - Conradus - 06.07.2015

Quote:
Originally Posted by JaydenJason
Посмотреть сообщение
Код:
// Create the object at the center of San Andreas [just used for example]
new eg_obj = CreateObject(1234, 0.0, 0.0, 3.0, 0.0, 0.0, 0.0);

// Rotate the object by 180 degrees on the z axis
MoveObject(eg_obj, 0, 0, 3+0.0001, 0.0001, 0.0, 0.0, 180.0);
now I think you could move the object its Z rotation to "cellmax", I never used it so I don't know if it works, you could try it out?

Код:
new eg_obj = CreateObject(1234, x, y, z, 0.0, 0.0, 0.0);
MoveObject(eg_obj, x, y, z+0.0001, 0.0001, 0.0, 0.0, cellmax);
Orr you could make a looping timer that keeps adding +360 degrees to the Z axis?

taken from:
https://sampforum.blast.hk/showthread.php?tid=295590
I tried the first method of cellmax, but that resulted in the objects just rotating a tiny bit and then stopping.
The timer did the job though, I've let it rotate 90 degrees every half of a second, and it rotates just fine.
Thanks for the help!


Re: Spining object like a pickup - !damo!spiderman - 06.07.2015

I wouldn't use a Timer when you can use this callback https://sampwiki.blast.hk/wiki/OnObjectMoved