21.07.2012, 17:56
Help, this timer never does stop!
I want it to go 10,9,8,7,6, etc. but it counts down 9 7 5 3 1 and does Go! infinite times...
Please help!
[ame]http://www.youtube.com/watch?v=DLGtBpJu6QU[/ame]
I want it to go 10,9,8,7,6, etc. but it counts down 9 7 5 3 1 and does Go! infinite times...
Please help!
[ame]http://www.youtube.com/watch?v=DLGtBpJu6QU[/ame]
pawn Код:
new countdowntimer;
new count = 11;
pawn Код:
if(!strcmp(cmdtext, "/start", true, 8))
{
if(isclanwarstarted == 0)
{
new string[128];
format(string, sizeof(string), "** Prepare yourself, a round is about to start!");
SendClientMessageToAll(COLOR_MESSAGE, string);
SetTimer("startcw", 5000, false);
isclanwarstarted = 1;
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerPlaySound(i, 1139, 0.0, 0.0, 0.0);
}
}
else
{
SendClientMessage(playerid, COLOR_ERROR, "ERROR: A round is currently running active!");
PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
}
return 1;
}
pawn Код:
forward startcw(i);
public startcw()
{
if(IsPlayerConnected(i))
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(gTeam[i] == TEAM_HOME || gTeam[i] == TEAM_AWAY)
{
count = 11;
countdowntimer = SetTimer("Countdown", 1000, true);
iDM[i] = 0;
First[i] = 0;
ResetPlayerWeapons(i);
SetPlayerInterior(i, 10);
GivePlayerWeapon(i, 31, 9999);
GivePlayerWeapon(i, 27, 9999);
GivePlayerWeapon(i, 24, 9999);
SetPlayerHealth(i, 100);
SetPlayerArmour(i, 100);
TogglePlayerControllable(i,0);
if(gTeam[i] == TEAM_HOME)
{
SetPlayerPos(i, -1131.9910,1057.6470,1346.4126);
SetPlayerFacingAngle(i, 270);
}
else if(gTeam[i] == TEAM_AWAY)
{
SetPlayerPos(i, -973.9210,1061.2968,1345.6729);
SetPlayerFacingAngle(i, 90);
}
}
}
}
}
forward Countdown();
public Countdown()
{
new str[128];
count--;
if(count < 1)
{
for(new i=0; i<MAX_PLAYERS;++i)
{
if(IsPlayerConnected(i))
{
KillTimer(countdowntimer);
GameTextForPlayer(i,"~g~~h~GO!",1000,3);
PlayerPlaySound(i, 1057, 0, 0, 0);
TogglePlayerControllable(i, 1);
if(gTeam[i] == TEAM_HOME)
{
SendClientMessage(i, TEAM_HOME_COLOR, "** The round has been started, good luck!");
}
else if(gTeam[i] == TEAM_AWAY)
{
SendClientMessage(i, TEAM_AWAY_COLOR, "** The round has been started, good luck!");
}
}
}
return 1;
}
format(str, sizeof str, "~r~Round Begins in: ~h~~h~~h~%d", count);
for(new i=0; i<MAX_PLAYERS;++i)
{
GameTextForPlayer(i,str,1000,3);
PlayerPlaySound(i, 1056, 0, 0, 0);
}
return 1;
}