SA-MP Forums Archive
[SOLVED]Countdown Timer - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED]Countdown Timer (/showthread.php?tid=110121)



[SOLVED]Countdown Timer - Tigerbeast11 - 24.11.2009

How can i make a countdown timer that starts from 8 mins and countsdown? I want it in the top-right cornor of my screen. How can i do it?


Re: [Really Need Help]Countdown Timer - RyDeR` - 24.11.2009

Define your time, after this make a use a timer of 990 ms. And put in the public: nameofyouredefine--;


Re: [Really Need Help]Countdown Timer - Tigerbeast11 - 24.11.2009

Quote:
Originally Posted by [WsR
RyDeR ]
Define your time, after this make a use a timer of 990 ms. And put in the public: nameofyouredefine--;
Plz explain more, i doubt u can explain how to make a timer in just one line...


Re: [Really Need Help]Countdown Timer - RyDeR` - 24.11.2009

Top of the script;
Code:
new CountDownFromAmount;
forward CountDownTimer();
OnGameModeInit;
Code:
CountDownFromAmount = 480; // 8min.
SetTimer("CountDownTimer", 999, 1);
Somewhere in you're script;
Code:
public CountDownTimer()
{
	CountDownFromAmount--;
	if (CountDownFromAmount == 0)
	{
		GameTextForAll("End of round!!", 3000, 5);
	}
	return 1;
}
Edit: Use format and GameText to see the counting.


Re: [Really Need Help]Countdown Timer - Tigerbeast11 - 24.11.2009

Quote:
Originally Posted by [WsR
RyDeR ]
Top of the script;
Code:
new CountDownFromAmount;
forward CountDownTimer();
OnGameModeInit;
Code:
CountDownFromAmount = 480; // 8min.
SetTimer("CountDownTimer", 999, 1);
Somewhere in you're script;
Code:
public CountDownTimer()
{
	CountDownFromAmount--;
	if (CountDownFromAmount == 0)
	{
		GameTextForAll("End of round!!", 3000, 5);
	}
	return 1;
}
Edit: Use format and GameText to see the counting.
How can use use formatting and gametext? In which way?

BTW, nice skills


Re: [Really Need Help]Countdown Timer - RyDeR` - 24.11.2009

Code:
new string[128];
format(string, 128, "%d", CountDownFromAmount);
GameTextForAll(string, 990, 5);



Re: [Really Need Help]Countdown Timer - Tigerbeast11 - 24.11.2009

Quote:
Originally Posted by [WsR
RyDeR ]
Code:
new string[128];
format(string, 128, "%d", CountDownFromAmount);
GameTextForAll(string, 990, 5);
Hmm...

How can i have it it TextDraw format?


Re: [Really Need Help]Countdown Timer - RyDeR` - 24.11.2009

If you have a Textdraw you can do it like this:
Code:
new string[128];
format(string, 128, "%d", CountDownFromAmount);
TextDrawSetString(Text:Textdrawname, string);
TextDrawShowForAll(Text:Textdrawname);



Re: [Really Need Help]Countdown Timer - Tigerbeast11 - 24.11.2009

Quote:
Originally Posted by [WsR
RyDeR ]
If you have a Textdraw you can do it like this:
Code:
new string[128];
format(string, 128, "%d", CountDownFromAmount);
TextDrawSetString(Text:Textdrawname, string);
TextDrawShowForAll(Text:Textdrawname);
Thats what i wanted!

Where would i put it?



Re: [Really Need Help]Countdown Timer - RyDeR` - 24.11.2009

In the timer.
Code:
public CountDownTimer()
{
	CountDownFromAmount--;
    new string[128];
    format(string, 128, "%d", CountDownFromAmount);
    TextDrawSetString(Text:Textdrawname, string);
    TextDrawShowForAll(Text:Textdrawname);
	if (CountDownFromAmount == 0)
	{
		GameTextForAll("End of round!!", 3000, 5);
	}
	return 1;
}



Re: [Really Need Help]Countdown Timer - Tigerbeast11 - 24.11.2009

Quote:
Originally Posted by [WsR
RyDeR ]
In the timer.
Код:
public CountDownTimer()
{
	CountDownFromAmount--;
    new string[128];
    format(string, 128, "%d", CountDownFromAmount);
    TextDrawSetString(Text:Textdrawname, string);
    TextDrawShowForAll(Text:Textdrawname);
	if (CountDownFromAmount == 0)
	{
		GameTextForAll("End of round!!", 3000, 5);
	}
	return 1;
}
pawn Код:
CountDownFromAmount = 480; // 8min.
    SetTimer("CountDownTimer", 999, 1);
    return 1;
}

public CountDownTimer()
{
    new string[128];
    format(string, 128, "%d", CountDownFromAmount);
  TextDrawSetString(Text:Timer, string);
    TextDrawShowForAll(Text:Timer);
    CountDownFromAmount--;
    return 1;
}

This error:

Код:
expected token ; but found public



Re: [Really Need Help]Countdown Timer - Tigerbeast11 - 24.11.2009

Sorry, delete last post