Countdown of the gametime. Minutes and seconds
#1

I'm trying to create a function to note the time left, until the game ends, but it fails. The calculation to calculate the seconds works perfectly, but if the seconds are above 60, it will fail. Same for the minutes.

This is the code I am using to countdown.
A timer has been set every second on this 'callback'.
pawn Код:
public Timer()
{
    new time[6];
    Seconds--;
    Minute = Seconds/60;
    format(time, 6, "%d:%d",Minute, Seconds);
    if(Seconds == 0) return Seconds = 60;
    TextDrawSetString(TDraw, time);
    return 1;
}
And I'm using this to start the timer.
pawn Код:
Seconds = ((30000+time)/1000);
    SetTimer("Timer", 1000, true);
It's actually really easy to calculate this. But it's hard to calculate this for a script.

Thanks
Reply


Messages In This Thread
Countdown of the gametime. Minutes and seconds - by Biesmen - 13.04.2011, 10:10
Re: Countdown of the gametime. Minutes and seconds - by Voldemort - 13.04.2011, 10:17
Re: Countdown of the gametime. Minutes and seconds - by Biesmen - 13.04.2011, 10:21
Re: Countdown of the gametime. Minutes and seconds - by (SF)Noobanatior - 13.04.2011, 10:21
Re: Countdown of the gametime. Minutes and seconds - by Biesmen - 13.04.2011, 10:34

Forum Jump:


Users browsing this thread: 1 Guest(s)