29.10.2008, 13:19
Quote:
Originally Posted by yugokoral
And how can i stop the timer, when the object is in right position?
|
pawn Код:
forward rotation(); // The call back Timer.
new rottimer; //Timer
public OnGameModeInit()
{
rottimer = SetTimer("rotation", 100, 1); // The timer which will go off every millisecond.
object = CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ); // The object (Fill in the spaces)
return 1;
}
public rotation() // The callback
{
new Float:rotx, Float:roty, Float:rotz; //Floats
SetObjectRot(object, 0, 0, +0.1); // Will set the Z rot +0.1 every millisecond
GetObjectRot(object, rotx, roty, rotz)// Checks the pos
if(rotz == 100.0) KillTimer(rottimer); //Checks if the z rot is 100.0 and kills the timer if it is.
return 1;
}