SA-MP Forums Archive
Question ? - 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: Question ? (/showthread.php?tid=586711)



Question ? - Andy5 - 24.08.2015

How can i make a countdown and when the time finish counting other codes starting to activate ?

can anyone answer me please !!


Re: Question ? - MBilal - 24.08.2015

Код:
new CountDown,Timer,Jstring[128];
CMD:countdown(playerid, params[])
{
	if(sscanf(params, "i", CountDown))
 	Timer = SetTimer("CountDownTimer",1000,1);
    format(Jstring, sizeof(Jstring), "~r~Count down~n~ ~y~Please Wait.~n~~r~%d~b~ seconds left.",CountDown);
    GameTextForAll(Jstring,30000,3);
	return 1;
}
forward CountDownTimer();
public CountDownTimer()
{
    CountDown--;
	 if(CountDown <= 0)
    {
    KillTimer(Timer);
	 // use the code which you want to exicute after the countdown end
   	}

    format(Jstring, sizeof(Jstring), "~r~Count down~n~ ~y~Please Wait.~n~~r~%d~b~ seconds left.",CountDown);
    GameTextForAll(Jstring,30000,3);
    return 1;
}