Making a Countdown? Beginner +REP
#1

I want to make a simple countdown but I dont know where or how to start. I figured if i could get an example everything would become clear. I am trying to make a countdown (3, 2, 1, GO!) to start the game and a timer so the game doesnt last forever.
Reply
#2

Quote:
Originally Posted by ShawtyyMacJunior
Посмотреть сообщение
I want to make a simple countdown but I dont know where or how to start. I figured if i could get an example everything would become clear. I am trying to make a countdown (3, 2, 1, GO!) to start the game and a timer so the game doesnt last forever.
Add this at the top of your script, maybe under your defines.

pawn Код:
forward CountDownCheck3();
forward CountDownCheck2();
forward CountDownCheck1();
forward CountDownCheckGo();

Add this maybe at the bottom of your script I recommend.But it's your choice.
pawn Код:
//==============================================================================
public CountDownCheck3()
{
    SendClientMessageToAll(-1 "  3");
    SetTimer("CountDownCheck2", 1000, 0);
}
//==============================================================================
public CountDownCheck2()
{
    SendClientMessageToAll(-1, "  2");
    SetTimer("CountDownCheck1", 1000, 0);
}
//==============================================================================
public CountDownCheck1()
{
    SendClientMessageToAll(-1, "  1");
    SetTimer("CountDownCheckGo", 1000, 0);
}
//==============================================================================
public CountDownCheckGo()
{
    SendClientMessageToAll(-1, "  Go!");
}
//==============================================================================
If you are using ZCMD:
pawn Код:
CMD:countdown(playerid, params[])
{
     SetTimer("CountDownCheck3", 1000, 0);
     return 1;
}
If you are using strcmp:
pawn Код:
if(strcmp(cmd, "/countdown", true) == 0)
{
     SetTimer("CountDownCheck3", 1000, 0);
     return 1;
}
And that's all, haven't tested it

But I gurantee it will work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)