Killtimer for one player
#1

Hey all. How can I kill a timer for one player?
I want when this timer hits 0 that the timer stops for the player. How?

pawn Код:
public jcounting(playerid)
{
    Bit16_Set(jcount,playerid,Bit16_Get(jcount,playerid) -1);
    format(String, sizeof(String), "%i", Bit16_Get(jcount,playerid));
    TextDrawSetString(Textdraw8,String);
    return 1;
}
Reply
#2

So, you want it to stop when it stops? That doesn't really make sense.

The only way a timer would start again is if it is set to repeat. See https://sampwiki.blast.hk/wiki/SetTimerEx
Reply
#3

Yes, what MP2 said.

The timer kills it self when it hits 0, so it won't start again unless you set it to.
Reply
#4

Yea but look. It's a countdown so it is a timer that repeats.

SetTimerEx("jcounting",1000,true,"i",playerid);
Reply
#5

Make a variable.

pawn Код:
// top of script

new CountDown;

// wherever you execute the timer

CountDown = SetTimerEx("jcounting",1000,true,"i",playerid);

// when the timer = 0

KillTimer(CountDown);
Reply
#6

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
Make a variable.

pawn Код:
// top of script

new CountDown;

// wherever you execute the timer

CountDown = SetTimerEx("jcounting",1000,true,"i",playerid);

// when the timer = 0

KillTimer(CountDown);
Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)