Rotating object.
#3

I edited your code a bit, because you used X, Y, Z coordinates in the timer but they aren't global. This is my new code:
pawn Код:
CMD:object(playerid, params[])
{
    new Float:XYZ[3], coffintxt[64], time;
    GetPlayerPos(playerid, XYZ[0], XYZ[1], XYZ[2]);
    Coffin[playerid] = CreateObject(2896, XYZ[0], XYZ[1], XYZ[2], 0, 0, 0, 100.0);
    time = MoveObject(Coffin[playerid], XYZ[0], XYZ[1], XYZ[2]+0.0001, 0.0001, 0.0, 0.0, 180.0);
    CoffinRotateTimer[playerid] = SetTimerEx("RotateCoffin", time, true, "ifff", playerid, XYZ[0], XYZ[1], XYZ[2]);
    return 1;
}
And the timer:
pawn Код:
new CoffinRotateTime;
public RotateCoffin(playerid, x, y, z)
{
    CoffinRotateTime ++;
    MoveObject(Coffin[playerid], x, y, z+0.0001, 0.0001, 0.0, 0.0, 180.0);
    if(CoffinRotateTime == 7)
    {
        KillTimer(CoffinRotateTimer[playerid]);
        CoffinRotateTime = 0;
    }
    return 1;
}
But the coffin will rotate only once.. I think the problem is, when setting the timer, the time is "MoveObject" line what you gave me, how to fix this? The timer should execute when the MoveObject line finishes moving.
Reply


Messages In This Thread
Rotating object. - by Dan. - 24.07.2012, 11:48
Re: Rotating object. - by [MM]RoXoR[FS] - 24.07.2012, 12:01
Re: Rotating object. - by Dan. - 24.07.2012, 12:37

Forum Jump:


Users browsing this thread: 2 Guest(s)