[FilterScript] [FS] Simple Count Down
#23

I dont understand all the people yelling "nice" in here.
This snippet is completely inefficent, its using 6 timers only for counting WHILE it could be done with one single timer. Meh.

Hereґs a example.

Code:
new counts;
forward timer1();
new counter1;
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/count", cmdtext, true, 10) == 0)
    {
      if(countspam[playerid]==0)
      {
            counts = 6;
            counter1 = SetTimer("timer1",1000,true);
            // SetTimer("countspam2",120000,0); Optional.
        }
        else
        {
            SendClientMessage(playerid,COLOR_BLUE, "Please wait before using this Command again.");
        }
        return 1;
    }
    return 0;
}

public timer1()
{
    counts--;
    if(counts == 5)
    {
    GameTextForAll("5",2000,3);
    }
    if(counts == 4)
    {
    GameTextForAll("4",2000,3);
    }
    if(counts == 3)
    {
    GameTextForAll("3",2000,3);
    }
    if(counts == 2)
    {
    GameTextForAll("2",2000,3);
    }
    if(counts == 1)
    {
    GameTextForAll("1",2000,3);
    }
    if(counts == 0)
    {
    GameTextForAll("~w~GO!",2000,3);
    KillTimer(counter1);
    }
    return 1;
}
Clean, nice and efficent. And not using 6 timers.
Reply


Messages In This Thread
[FS] Simple Count Down - by V1ceC1ty - 17.08.2009, 10:32
Re: [FS] Simple Count Down - by James_Alex - 17.08.2009, 10:35
Re: [FS] Simple Count Down - by V1ceC1ty - 17.08.2009, 10:41
Re: [FS] Simple Count Down - by Evoturk - 17.08.2009, 11:10
Re: [FS] Simple Count Down - by .::: Ecko :::. - 17.08.2009, 12:23
Re: [FS] Simple Count Down - by V1ceC1ty - 17.08.2009, 12:38
Re: [FS] Simple Count Down - by radi - 17.08.2009, 21:18
Re: [FS] Simple Count Down - by XCultz - 18.08.2009, 01:42
Re: [FS] Simple Count Down - by V1ceC1ty - 18.08.2009, 08:39
Re: [FS] Simple Count Down - by radi - 18.08.2009, 08:54
Re: [FS] Simple Count Down - by V1ceC1ty - 18.08.2009, 10:22
Re: [FS] Simple Count Down - by Montserrat - 18.08.2009, 11:04
Re: [FS] Simple Count Down - by V1ceC1ty - 18.08.2009, 13:27
Re: [FS] Simple Count Down - by [HLF]Southclaw - 14.09.2009, 08:31
Re: [FS] Simple Count Down - by DokerJr - 14.09.2009, 16:42
Re: [FS] Simple Count Down - by eXchainZ-FoReVeR - 15.09.2009, 00:24
Re: [FS] Simple Count Down - by [CK]Steel - 10.10.2009, 12:18
Re: [FS] Simple Count Down - by vascofg - 19.10.2009, 16:49
Re: [FS] Simple Count Down - by Correlli - 19.10.2009, 18:53
Re: [FS] Simple Count Down - by eXchainZ-FoReVeR - 24.10.2009, 15:09
Re: [FS] Simple Count Down - by nenadninja - 19.12.2009, 12:45
Re: [FS] Simple Count Down - by Willstah - 21.12.2009, 18:32
Re: [FS] Simple Count Down - by Striker_Moe - 21.12.2009, 20:04
Re: [FS] Simple Count Down - by braduz - 10.02.2010, 18:00
Re: [FS] Simple Count Down - by caribe88 - 10.02.2010, 19:17
Re: [FS] Simple Count Down - by $t3ve - 09.10.2010, 22:48
Re: [FS] Simple Count Down - by The Toni - 09.10.2010, 22:58

Forum Jump:


Users browsing this thread: 3 Guest(s)