09.08.2012, 17:32
Hey guys,
I got some problems with KillTimer. It doesnt kill my timer when i want it to. Its just a normal countdown, and when the variable goes down to 0, it should kill the timer, but it doesnt; it just keeps going, going and going
Anyone knows a solution?
~Wesley
I got some problems with KillTimer. It doesnt kill my timer when i want it to. Its just a normal countdown, and when the variable goes down to 0, it should kill the timer, but it doesnt; it just keeps going, going and going
pawn Код:
// timer getting started:
CameraBack[playerid] = SetTimerEx( "Cameraback", 1000, true, "i", playerid );
forward Cameraback(playerid);
public Cameraback(playerid)
{
print( "Cameraback: call" );
new string[20];
format( string, sizeof string, "%i", CameraBackTicks[playerid] );
GameTextForPlayer( playerid, string, 999, 3 );
printf( "CameraBackTicks[%i]: %i", playerid, CameraBackTicks[playerid] );
CameraBackTicks[playerid] --;
if( CameraBackTicks[playerid] == 0 )
{
print( "kill timer" );
KillTimer( CameraBack[playerid] );
print( "succeed" );
SetCameraBehindPlayer( playerid );
TogglePlayerSpectating( playerid, false );
TogglePlayerControllable( playerid, true );
SpawnPlayer( playerid );
CameraBackTicks[playerid] = 10;
GameTextForPlayer( playerid, "~n~~n~~n~~n~~n~~n~~n~~n~You have been spawned!", 2000, 3 );
}
print( "Cameraback: end" );
return 1;
}
Код:
[19:38:46] Cameraback: call [19:38:46] CameraBackTicks[0]: 10 [19:38:46] Cameraback: end [19:38:47] Cameraback: call [19:38:47] CameraBackTicks[0]: 9 [19:38:47] Cameraback: end [19:38:49] Cameraback: call [19:38:49] CameraBackTicks[0]: 8 [19:38:49] Cameraback: end [19:38:50] Cameraback: call [19:38:50] CameraBackTicks[0]: 7 [19:38:50] Cameraback: end [19:38:51] Cameraback: call [19:38:51] CameraBackTicks[0]: 6 [19:38:51] Cameraback: end [19:38:52] Cameraback: call [19:38:52] CameraBackTicks[0]: 5 [19:38:52] Cameraback: end [19:38:53] Cameraback: call [19:38:53] CameraBackTicks[0]: 4 [19:38:53] Cameraback: end [19:38:54] Cameraback: call [19:38:54] CameraBackTicks[0]: 3 [19:38:54] Cameraback: end [19:38:55] Cameraback: call [19:38:55] CameraBackTicks[0]: 2 [19:38:55] Cameraback: end [19:38:56] Cameraback: call [19:38:56] CameraBackTicks[0]: 1 [19:38:56] kill timer [19:38:56] succeed [19:38:56] Cameraback: end
~Wesley