CountDown in minutes?
#1

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...
Reply
#2

( I want that too in minutes xD )
Reply
#3

well... hopefully someones gonna answer soon

I need it so badly.
Reply
#4

You are kidding me ?

1 minute = 60 seconds
m minute = s seconds

m = s * 1 / 60 = s / 60

s = countdownzone
Reply
#5

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
Reply
#6

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
Reply
#7

pawn Код:
new
        minutes = floatround(float(countdownzone) / 60.0),
        seconds = countdownzone % 60;

    printf("Time remaining: %02d:%02d", minutes, seconds);
Reply
#8

ah..
now ive got an idea

thank you so much!!
Reply
#9

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 ^^
Reply
#10

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)