CountDown in minutes? -
BlackWolf120 - 09.02.2011
hi,
ive made a countdown in a textdraw counting from 300 seconds (5 mins) down to 0.
Now it counts like 300,299,298.... in seconds but i want to count it down like 5:00,4,59,4,58... in minutes.
How would i do that?
pawn Код:
countdownzone = 300;
public counterzone(playerid)
{
for(new i; i < MAX_PLAYERS; i ++)
{
if(HasEntered[i] == 1 && countdownzone > 0)
{
CDONZone = SetTimer("counterzone",990,false);
new textformat[85];
format(textformat,sizeof textformat,"~g~%d",countdownzone);
TextDrawSetString(MiniCountdown,textformat);
TextDrawShowForPlayer(i,MiniCountdown);
}
}
countdownzone --;
return 1;
}
regards...
Re: CountDown in minutes? -
Michael@Belgium - 09.02.2011
( I want that too in minutes xD )
Re: CountDown in minutes? -
BlackWolf120 - 09.02.2011
well... hopefully someones gonna answer soon
I need it so badly.
AW: CountDown in minutes? -
Nero_3D - 09.02.2011
You are kidding me ?
1 minute = 60 seconds
m minute = s seconds
m = s * 1 / 60 = s / 60
s = countdownzone
Re: CountDown in minutes? -
BlackWolf120 - 09.02.2011
thx,
mhhh nope not kiddin' at all (just read my signature, says it all)
Let's see what i can figure out...
//edit: my main problem is i just dont know how to affect the texdraw...
btw, i know that 1 min is 60 secs
Re: CountDown in minutes? -
DRIFT_HUNTER - 09.02.2011
You need to make public function that will count -1 ( -- )from current time and you will need to set timer with 1 second that will repeat
if your time iz 00:00 than you kill timer
Its not so hard
Re: CountDown in minutes? -
Vince - 09.02.2011
pawn Код:
new
minutes = floatround(float(countdownzone) / 60.0),
seconds = countdownzone % 60;
printf("Time remaining: %02d:%02d", minutes, seconds);
Re: CountDown in minutes? -
BlackWolf120 - 09.02.2011
ah..
now ive got an idea
thank you so much!!
Re: CountDown in minutes? -
Michael@Belgium - 09.02.2011
Quote:
Originally Posted by Vince
pawn Код:
new minutes = floatround(float(countdownzone) / 60.0), seconds = countdownzone % 60;
printf("Time remaining: %02d:%02d", minutes, seconds);
|
yeah it's nice x) !
But if its counts down ... for example 7:10 to 7:00 then next second it displays that: 7:59 and later... 7:30 and one second next it displays: 6:29 6:28 ... and then again 6:00 .. 6:59 --- 6:30 ... 5.29 ....................... xD
yeah just saying ^^
AW: Re: CountDown in minutes? -
Nero_3D - 09.02.2011
Quote:
Originally Posted by Michael@Belgium
yeah it's nice x) !
But if its counts down ... for example 7:10 to 7:00 then next second it displays that: 7:59 and later... 7:30 and one second next it displays: 6:29 6:28 ... and then again 6:00 .. 6:59 --- 6:30 ... 5.29 ....................... xD
yeah just saying ^^
|
Yes thats because of floatround, he didnt defined any methode so its by default floatround_round which rounds up at 5..9 and down at 0..4, 30 is the half of 60, in minutes 30 sec would be (0.5), 29 (0.4
use that
pawn Код:
new
seconds = countdownzone % 60;
minutes = (countdownzone - seconds) / 60;
printf("Time remaining: %02d:%02d", minutes, seconds);