SetTimerEx | KillTimer
#1

Ok, well... Heres my problemo... I set a timer, using SetTimerEx... BUT, when the player dies that the timer is set on, i wanna kill it... Here is what i got...

pawn Код:
forward bombtimer(Target, dynamite);



SetTimerEx("bombtimer", 3000, false, "i", Target, dynamite); // This is on my command, /plantbomb (Its a command that attaches dynamite to a target, and then starts the timer, and when the timer is done, BOOM... And so on, you get the idea...)



new dynamite;  // Heres the object, the dynamite...
dynamite = CreateObject(1654, 0.0, 0.0, -1000.0, 0.0, 0.0, 0.0, 10.0);



public bombtimer(Target, dynamite)          // Obviously... This is my public....
{
    ExplodePlayer(Target);
    DestroyObject(dynamite);
    return 1;
}



KillTimer(bombtimer); //This is on OnPlayerDeath

Can someone tell me why i get this error?
Код:
error 076: syntax error in the expression, or invalid function call
On this line...?
Код:
KillTimer(bombtimer);
Reply
#2

pawn Код:
new TimerBomb[MAX_PLAYERS];

TimerBomb[playerid] = SetTimerEx("bombtimer", 3000, false, "i", Target, dynamite);

KillTimer(TimerBomb[playerid]);
Reply
#3

You need to store the timer ID first and then you can kill it.
pawn Код:
// Global variable:
new bomb_TIMER;

bomb_TIMER = SetTimerEx("bombtimer", 3000, false, "ii", Target, dynamite);// Target and dynamite are 2 parameters, it needs double i/d.
// Assign the ID to bomb_TIMER

// Somewhere else
KillTimer(bomb_TIMER);
Reply
#4

Oh... Duh, I knew that... XD (+REPPED...)


[I really did know that, guess i wasn't thinking too well, XD...]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)