Countdown backwards help
#1

hi all,

i have a prob with my new years timer!

i want it to count down from 60, but the one i made (BY ACCIDENT ) counts from 0 to 60

can anyone help me change it?

here it is:

Код:
#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()
{
	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!!!", 5000, 4);
		counter = 0;
		KillTimer(countTimer);
	}
	return true;
}
thanks everyone, merry christmmas!!!
Reply
#2

Код:
#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!");
	counter = 60;
	countTimer = SetTimer("timer", 1000, true);
	return true;
}
	return 0;
}

public timer()
{
	if(counter > 0)
	{
		new string[3];
		format(string, sizeof(string), "%d", counter);
		GameTextForAll(string, 500, 3);
	}
	else
	{
		GameTextForAll("HAPPY NEW YEAR 2010!!!", 5000, 4);
		counter = 0;
		KillTimer(countTimer);
	}
	counter--;
	return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)