24.07.2012, 12:37
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:
And the timer:
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.
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;
}
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;
}