Counting issue - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Counting issue (
/showthread.php?tid=591950)
Counting issue -
cdoubleoper - 18.10.2015
Hi.
It is supposed to show time left like minute
econds 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!
Re: Counting issue -
[ABK]Antonio - 18.10.2015
Seconds = (ms > 1000) ? (ms / 1000) : (0);
Minutes = (Seconds > 60) ? (Seconds / 60) : (0);
Seconds -= (Minutes > 0) ? (Minutes * 60) : (0);
Re: Counting issue -
cdoubleoper - 18.10.2015
Thank u so much!