SA-MP Forums Archive
/cd - 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: /cd (/showthread.php?tid=93264)



/cd - shoru - 24.08.2009

As I aksed in my old topic, is there anyone who can help me how to do an countdown?


Re: /cd - Energyzer - 24.08.2009

Use the search button and read the rules


Re: /cd - ronyx69 - 24.08.2009

Under includes:
Код:
forward CountDown();
new CountText[5][5] ={"~r~1","~b~2","~b~3","~g~4","~g~5"};
Under OnPlayerCommandText:
Код:
if (strcmp(cmdtext, "/count", true)==0)
  		{
  		if(Count >= 5)
  		{
  		new name;
	  GetPlayerName(playerid, name, sizeof(name));
	  format(string, sizeof(string), "SERVER: %s started countdown.", name );
	  SendClientMessageToAll(COLOR_LIGHTBLUE, string);
  		format(string, sizeof(string), "[1234] %s started countdown", name );
 		printf(string);
  		CountDown();
  		return 1;
  		}
  		else
  		{
  		SendClientMessage(playerid, COLOR_LIGHTBLUE, "SERVER: Countdown is already started.");
  		return 1;
		}
}
Everywhere since it's not in another callback:
Код:
public CountDown(){
if (Count > 0){
GameTextForAll( CountText[Count-1], 2500, 3);
Count--;
SetTimer("CountDown", 1000, 0);
}
else{
GameTextForAll("~r~Go~w~! ~r~Go~w~! ~r~Go~w~!", 2500, 3);
Count = 5;
}
return 1;
}