Timer countdown with textdraws
#1

I have a timer - http://i.imgur.com/4NKcsN2.jpg But i want to make it dynamic to countdown. Now it only shows and then disapears.

Код:
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;
}
This is the code. And if you can help me to set it up on the top of the screen it will be very nice.
Reply
#2

PHP код:
stock CountDown(playeridtime)
{
    
CountDownTime[playerid] = time;
    
CTimer[playerid] = SetTimerEx("CountDownTimer"1000true"i"playerid);
    return 
0;
}
forward CountDownTimer(playerid);
public 
CountDownTimer(playerid)
{
    new 
timer[28];
    
format(timersizeof(timer), "%i Seconds"CountDownTime[playerid]);
    
GameTextForPlayer(playeridtimer10003);
    
    if(!(--
CountDownTime[playerid]))
    {
        
GameTextForPlayer(playerid"~g~GOOOOO!!!!"10003);
        
KillTimer(CTimer[playerid]);
        
CTimer[playerid] = -1;
    }
    return 
1;

Reply
#3

Just use gametext, its easier.
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
PHP код:
stock CountDown(playeridtime)
{
    
CountDownTime[playerid] = time;
    
CTimer[playerid] = SetTimerEx("CountDownTimer"1000true"i"playerid);
    return 
0;
}
forward CountDownTimer(playerid);
public 
CountDownTimer(playerid)
{
    new 
timer[28];
    
format(timersizeof(timer), "%i Seconds"CountDownTime[playerid]);
    
GameTextForPlayer(playeridtimer10003);
    
    if(!(--
CountDownTime[playerid]))
    {
        
GameTextForPlayer(playerid"~g~GOOOOO!!!!"10003);
        
KillTimer(CTimer[playerid]);
        
CTimer[playerid] = -1;
    }
    return 
1;

This man here is a BEAST! He helps a lot he deserves +1312 rep... Thanks again!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)