Textdraw Countdown
#1

Hi!

How can i write textdraw countdown with 5 seconds ?
Reply
#2

By using Timers.
Reply
#3

Try this .

Code:
new CTimer[MAX_PLAYERS] = 0;
new CountDownTime[MAX_PLAYERS] = 0;

stock CountDown(playerid, time)
{
	CountDownTime[playerid] = time;
	CTimer[playerid] = SetTimerEx("CountDownTimer", 1000, false, "i", playerid);
	return 0;
}

forward CountDownTimer(playerid);
public CountDownTimer(playerid)
{
	if(CountDownTime[playerid] > 1)
	{
		new timer[28];
		format(timer, sizeof(timer), "%i Seconds", CountDownTime[playerid]);
		GameTextForPlayer(playerid, timer, 1000, 0);
		CountDownTime[playerid] -= 1;
		return 1;
	}
	else
	{
		GameTextForPlayer(playerid, "GOOOOO!!!!", 1000, 0);
		KillTimer(CTimer[playerid]);
	}
	return 1;
}
Now all you have to do to make a timer that counts down is use:
Code:
CountDown(playerid, *the time you want in seconds*);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)