Counting issue
#1

Hi.
It is supposed to show time left like minuteeconds but something is wrong and it sends me bullshit like:
Код:
9983:2
9966:4
9950:0
9933:2
9916:4
9900:0
9883:2
9866:4
9850:0
9833:2
9816:4
9800:0
9783:2
9766:4
9750:0
9733:2
9716:4
.............
Код:
setting: Count(600000); //10 minutes

forward Count(ms);
public Count(ms){
	static string[6];
  	if(ms == 0){
   		//end
	}else{
		static minute, second;
		ConvertMilisecondTime(ms, minute, second);

		TextDrawHideForAll(TextDraw[0]);
		format(string, sizeof(string), "%i:%i", minute, second);
		TextDrawSetString(TextDraw[0], string);
		TextDrawShowForAll(TextDraw[0]);

		printf("%i:%i", minute, second);

		SetTimerEx("Count", 1000, 0, "i", ms - 1000);}}

ConvertMilisecondTime(ms, &Minutes, &Seconds){
	Minutes = ms / 60;
	ms -= Minutes * 60;
	Seconds = ms / 10;}
Any idea? Thanks!
Reply
#2

Seconds = (ms > 1000) ? (ms / 1000) : (0);
Minutes = (Seconds > 60) ? (Seconds / 60) : (0);
Seconds -= (Minutes > 0) ? (Minutes * 60) : (0);
Reply
#3

Thank u so much!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)