How can i make a countdown and when the time finish counting other codes starting to activate ?
Код:
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;
}