// Counter
CountDownFromAmount = 300; // 5minutes
SetTimer("CountDownTimer", 999, 1);
new CountDownFromAmount;
forward CountDownTimer();
public CountDownTimer()
{
CountDownFromAmount--;
new string[128];
format(string, 128, "%d", CountDownFromAmount);
TextDrawSetString(Text:MissionCount, string);
TextDrawShowForAll(Text:MissionCount);
if (CountDownFromAmount == 0)
{
GameTextForAll("", 3000, 5);
}
return 1;
}
new CountDownSeconds, CountDownMinutes, CountDownTimer;
CountDownSeconds = 60;
CountDownMinutes = 5;
CountDownTimer = SetTimer("CountDownTimer", 999, 1);
forward CountDownTimer();
public CountDownTimer()
{
CountDownSeconds--;
if(CoundDownSeconds == 0)
{
CountDownMinutes--;
CountDownSeconds = 60;
}
new string[128];
format(string, 128, "%d:%d", CountDownMinutes, CountDownSeconds);
TextDrawSetString(Text:MissionCount, string);
TextDrawShowForAll(Text:MissionCount);
if (CountDownMinutes == 0)
{
GameTextForAll("", 3000, 5);
KillTimer(CountDownTimer);
}
return 1;
}
//minutes new mins; mins = floatround(CountDownFromAmount/60, floatround_floor); //seconds new seconds; seconds = CountDownFromAmount; while (seconds > 60) { seconds -= 60; }
Hello x)
Code:
//minutes new mins; mins = floatround(CountDownFromAmount/60, floatround_floor); //seconds new seconds; seconds = CountDownFromAmount; while (seconds > 60) { seconds -= 60; } https://sampwiki.blast.hk/wiki/Floatround https://sampwiki.blast.hk/wiki/Floatround_method |
seconds = timeleft % 60;
minutes = timeleft / 60;
format(string, 128, "Minutes: %d Seconds: %d", mins, seconds);
public CountDownTimer(){ //This function must be performed every 1 second
CountDownFromAmount++;
new string[128], timesmin, timessek;
timesmin = ((300-(CountDownFromAmount))/60);
timessek = (300-((CountDownFromAmount)+((timesmin)*(60))));
format(string, sizeof(string), "%02d:%02d", timesmin, timessek);
TextDrawSetString(Text:MissionCount, string);
TextDrawShowForAll(Text:MissionCount);
if(CountDownFromAmount == 300){
GameTextForAll("", 3000, 5);
}
return 1;
}