[FilterScript] [FS] Simple Count Down
#21

good job
Reply
#22

wheres the pastebin?
Reply
#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
#24

Make sure it dont have the dreaded - glitch
e.g:
/countdown -10
forever countup untill you restart your server
Reply
#25

nice one suggestion could you to it with a timer that you can only use it every 5 seconds?? because some players abuse with it
Thanks
Reply
#26

Ok, good. I've edited it that it works for the player chat box.
Reply
#27

Good job. Want a cookie?! But seriously you just bumped a 8 month old topic.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)