13.04.2011, 10:10
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'.
And I'm using this to start the timer.
It's actually really easy to calculate this. But it's hard to calculate this for a script.
Thanks
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;
}
pawn Код:
Seconds = ((30000+time)/1000);
SetTimer("Timer", 1000, true);
Thanks