23.10.2011, 18:45
How do I make a timer to count down from 5 to Go! and un pause the players?
new CountTimer;
new countamount=5;
//command
if(!strcmp(command, "/count", true))
{
CountTimer = SetTimer("Count",1000,true);//Setting the timer, for the count down.
return 1;
}
public Count()
{
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if (IsPlayerConnected(i))
{
TogglePlayerControllable(i, 1)
}
}
new string[4];//Creating the string variable, where we will store the count down value.
format(string,sizeof(string),"%i",countamount);//Formating it.
GameTextForAll(string,1000,3);//Showing it to everyone.
countamount--;//Counting less 1 to the count down variable.
if(countamount == -1)
{
KillTimer(CountTimer);
countamount=5;
GameTextForAll("~g~~h~Go!",1000,3);
}//It's -1,
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if (IsPlayerConnected(i))
{
TogglePlayerControllable(i, 0)
}
}
return 1;
}
new CountTimer;
new countamount=5;
CMD:count(playerid,params[])
{
CountTimer = SetTimer("Count",1000,true);//Setting the timer, for the count down.
return 1;
}
public Count()
{
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if (IsPlayerConnected(i))
{
TogglePlayerControllable(i, 0)
}
}
new string[4];//Creating the string variable, where we will store the count down value.
format(string,sizeof(string),"%i",countamount);//Formating it.
GameTextForAll(string,1000,3);//Showing it to everyone.
countamount--;//Counting less 1 to the count down variable.
if(countamount == -1)
{
KillTimer(CountTimer);
countamount=5;
GameTextForAll("~g~~h~Go!",1000,3);}//It's -1,
for (new i = 0; i != MAX_PLAYERS; ++i)
{
if (IsPlayerConnected(i))
{
TogglePlayerControllable(i,1)
}
}
}
return 1;
}
forward Count();
Public Count()