Countdown
#1

How do I make a timer to count down from 5 to Go! and un pause the players?
Reply
#2

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, 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;
}

Let me know if it's works
Reply
#3

Make it a bit abstract.
pawn Код:
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;
}
Reply
#4

pawn Код:
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;
}
This is right, I think. You unfreezed the players when the timer started, and freezed them when it stopped.
Reply
#5

Don't forget to add:

pawn Код:
forward Count();
This goes above:
pawn Код:
Public Count()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)