SA-MP Forums Archive
Killtimer for one player - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Killtimer for one player (/showthread.php?tid=300783)



Killtimer for one player - bartje01 - 01.12.2011

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;
}



Re: Killtimer for one player - MP2 - 01.12.2011

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


Re: Killtimer for one player - grand.Theft.Otto - 01.12.2011

Yes, what MP2 said.

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


Re: Killtimer for one player - bartje01 - 01.12.2011

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

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


Re: Killtimer for one player - grand.Theft.Otto - 01.12.2011

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);



Re: Killtimer for one player - bartje01 - 01.12.2011

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