Posts: 944
Threads: 77
Joined: Dec 2010
Reputation:
0
Is there any kind of a function that could count down from 3 mins in textdraw? Like over the hud? I really need it but dont have a idea how to make it. And also make something when its over.. Please. Didnt find anything on search and ****** :/
Posts: 372
Threads: 44
Joined: Feb 2011
Reputation:
0
That is Mins:Seconds. But a little bit formatted..
Just fix the errors (I didn't test it) and it'll work. (I think..)
Posts: 1,046
Threads: 29
Joined: Mar 2010
pawn Код:
#define MAX_TIME 180 //Add here your time in seconds. 180 seconds/60 seconds per minute makes 3 minutes
new Text:TimeText, ticked, countdowntimer;
forward Tick();
public Tick()
{
ticked++;
new ticktime = MAX_TIME-ticked, tempticktime = ticktime, minutes = 0;
while(tempticktime > 59)
{
minutes++;
tempticktime = tempticktime-60;
}
format(str, sizeof(str), "%02d:%02d", minutes, tempticktime);
TextDrawSetString(TimeText, str);
if(ticktime == 0)
{
KillTimer(countdowntimer);
//Do here your things when the time end.
}
}
public OnGameModeInit()
{
TimeText = TextDrawCreate(550.0, 33.0, "--:--");
new ticktime = MAX_TIME, minutes = 0;
while(ticktime > 59)
{
minutes++;
ticktime = ticktime-60;
}
new str[128];
format(str, sizeof(str), "%02d:%02d", minutes, ticktime);
TextDrawSetString(TimeText, str);
countdowntimer = SetTimer("Tick", 1000, true);
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, TimeText);
return 1;
}
Posts: 1,046
Threads: 29
Joined: Mar 2010
Quote:
Originally Posted by Markx
Fucking awesome dude, you got credits
|
Thanks