All pastes #520194 Raw Edit

Someone

public text v1 · immutable
#520194 ·published 2007-05-29 21:29 UTC
rendered paste body
new Countdown;
new tmrCountdown;
new str[12];

public LaunchCountdown()
{
	Countdown++; // add one to the countdown
	if (Countdown >= 11) // if we're over 3 (done counting)
	{
	    Countdown = 0; // reset countdown
	    SendClientMessageToAll(COLOR_RED, "Go! Go! Go!");
	    KillTimer(tmrCountdown); // end the countdown timer
 	}
	else
	{  //  if we're 3 or below (still counting)
		format(str, sizeof(str), "%i...", (11 - Countdown));
		SendClientMessageToAll(COLOR_WHITE, str); // send message (3,2 or 1 ...) to all
	}
}


public SetupPlayerForClassSelection(playerid)
{
 	SetPlayerInterior(playerid,14);
	SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
	SetPlayerFacingAngle(playerid, 270.0);
	SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
	SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnGameModeInit()
{
	AddPlayerClass(1,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	new idx;
	cmd = strtok(cmdtext, idx); // get first word of command

	if(strcmp(cmd, "/StartD", true) == 0) // if its /countdown
	{
		tmrCountdown = SetTimer("LaunchCountdown", 1000, true); // launch the countdown with a 1000 ms interval
		return 1; // Valid command

	}
	return 0; // Invalid command
}