SA-MP Forums Archive
New Years Countdown Help - 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: New Years Countdown Help (/showthread.php?tid=113955)



New Years Countdown Help - wilcock33 - 16.12.2009

ok first, here is the script...

Код:
#define FILTERSCRIPT

#include <a_samp>
new counter;
new countTimer;

forward timer();

#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
  counter = 0;
	return 1;
}

public OnFilterScriptExit()
{
  counter = 0;
	return 1;
}
#else

main()
{
	print("\n------------------------------------------");
	print(" NewYearCountdown Script");
	print("------------------------------------------\n");
}

#endif


public OnPlayerConnect(playerid)
{
	SendClientMessage(playerid, 0xFF00FF,"Welcome to the New Year's Party!");
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/count", true) || !strcmp(cmdtext, "/countdown", true))
{
	if(counter != 0)
		return SendClientMessage(playerid, 0xFFFF00FF, "The new-year countdown is already running...print what till next year!");
	countTimer = SetTimer("timer", 1000, true);
	return true;
}
	return 0;
}

public timer()
{
	counter++;
	if(counter == 1)
		GameTextForAll("3", 500, 3);
	else if(counter == 2)
		GameTextForAll("2", 500, 3);
	else if(counter == 3)
		GameTextForAll("1", 500, 3);
	else if(counter == 4)
	{
		GameTextForAll("HAPPY NEW YEAR 2010!!!", 500, 2000);
		counter = 0;
		KillTimer(countTimer);
	}
	return true;
}
the prolem is that, when i start the countdown, it goes 3,2,1 etc ut the HAPPY NEW YEAR 2010!! does not appear, any reason,?
thanks


Re: New Years Countdown Help - dice7 - 16.12.2009

Because there is no style 2000
GameText has only 6 styles
https://sampwiki.blast.hk/wiki/GameTextStyle


Re: New Years Countdown Help - wilcock33 - 16.12.2009

ok there is that, but how do i make the countdown from 60?

thanks


Re: New Years Countdown Help - bigcomfycouch - 16.12.2009

Код:
public timer()
{
	new string[3];
	counter++;
	if(counter > 0 && counter < 60)
	{
		format(string, sizeof(string), "%d", counter);
		GameTextForAll(string, 500, 3);
	}
	else
	{
		GameTextForAll("HAPPY NEW YEAR 2010!!!", 500, 2000);
		counter = 0;
		KillTimer(countTimer);
	}
	return true;
}