public Start5()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerRace[i] == true)
{
GameTextForPlayer(i, "~y~5", 1500, 3);
SetTimer("Start4", 1000, false);
PlayerPlaySound(i, 1056, 0, 0, 0);
}
}
return 1;
}
public Start4()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerRace[i] == true)
{
GameTextForPlayer(i, "~b~4", 1500, 3);
SetTimer("Start3", 1000, false);
PlayerPlaySound(i, 1056, 0, 0, 0);
}
}
return 1;
}
public Start3()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerRace[i] == true)
{
GameTextForPlayer(i, "~p~3", 1500, 3);
SetTimer("Start2", 1000, false);
PlayerPlaySound(i, 1056, 0, 0, 0);
}
}
return 1;
}
public Start2()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerRace[i] == true)
{
GameTextForPlayer(i, "~y~2", 1500, 3);
SetTimer("Start1", 1000, false);
PlayerPlaySound(i, 1056, 0, 0, 0);
}
}
return 1;
}
public Start1()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerRace[i] == true)
{
GameTextForPlayer(i, "~r~1", 1500, 3);
SetTimer("StartGo", 1000, false);
PlayerPlaySound(i, 1056, 0, 0, 0);
}
}
return 1;
}
public StartGo()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerRace[i] == true)
{
GameTextForPlayer(i, "~g~go!", 1000, 3);
PlayerPlaySound(i, 1057, 0, 0, 0);
TogglePlayerControllable(i, 1);
DisablePlayerRaceCheckpoint(i);
SetPlayerRaceCheckpoint(i, 0, 1156.5406,-877.0353,43.8308, 1166.3489,-731.7609,60.8410, 20.0);
CountCheck[i] = 1;
Partenza = true;
racez[i] = true;
}
}
return 1;
}
new count=5;
public StartCountDown
{
if(count<= 0) return //race starts
new Str[60];
for(new i=0; i < MAX_PLAYERS; i++)
{
format(str, sizeof str,"race starts in %d",count);
SendClientMessage(i,-1,str);
}
count--;
SetTimer("StartCountDown", 1000, false);
}
You start a global timer 500 times
pawn Код:
|
new count=5;
public StartCountDown()
{
if(count<= 0) return SetTimer("StartRace",100,false),Partenza = true;
new str[60];
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && PlayerRace[i] == true)
{
format(str, sizeof str,"~r~La Gara inizia tra ~g~%d",count);
PlayerPlaySound(i, 1056, 0, 0, 0);
GameTextForPlayer(i,str,1000,3);
}
}
count--;
SetTimer("StartCountDown", 1000, false);
return 1;
}
new CDTxt[][] = {
"~g~go!",
"~r~1",
"~y~2",
"~p~3",
"~b~4",
"~y~5"
};
forward CountDownForAll(times);
public CountDownForAll(times)
{
if(times)
{
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i) && PlayerRace[i])
{
GameTextForPlayer(i, CDTxt[times], 1500, 3);
PlayerPlaySound(i, 1056, 0, 0, 0);
}
SetTimerEx("CountDownForAll",1000,false,"i",times-1);
}else{
for(new i = 0; i < MAX_PLAYERS; i++)
if(IsPlayerConnected(i) && PlayerRace[i])
{
GameTextForPlayer(i, CDTxt[times], 1000, 3);
PlayerPlaySound(i, 1057, 0, 0, 0);
TogglePlayerControllable(i, 1);
DisablePlayerRaceCheckpoint(i);
SetPlayerRaceCheckpoint(i, 0, 1156.5406,-877.0353,43.8308, 1166.3489,-731.7609,60.8410, 20.0);
CountCheck[i] = 1;
racez[i] = true;
}
Partenza = true;
}
return 1;
}
CountDownForAll(sizeof(CDTxt)-1);