How to make countdown time?
#1

I tried searching but I cant find a tutorial that explains how to make a countdown (i.e 4:00 , 3:59 , 3:59 ..)
Reply
#2

Reply number 3 should help you out somewhat: https://sampforum.blast.hk/showthread.php?tid=315000
Reply
#3

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Reply number 3 should help you out somewhat: https://sampforum.blast.hk/showthread.php?tid=315000
but its not counding down as a clock,I mean its counding down as 5..4..3..2..1.. and I need it to counddown like 4:00,3:59,3:58
Reply
#4

use 2 vars, one to store the minutes and otherone for seconds, and when secs get to the 0 --the minutes and set seconds to 59.. I am not in mood to code it, if you didn't understand I'll show you later xD
Reply
#5

what u need that for? , Map changing after the counts end?
Reply
#6

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
pawn Код:
new Time[MAX_PLAYERS];
new FunctionTimer[MAX_PLAYERS];

forward function(playerid);
public function(playerid)
{
     new string, Min, sec;
     if(Time[playerid] > 0)
     {
            Time[playerid] --;
            sec = ((Time[playerid] * 1000));
            Minutes = ((Time[playerid] * 1000) / 60);
            format(string, sizeof(string), "%s:%s", Min, sec);
            TextDrawSetString(TextDrawDefine,  string);
     }
     else KillTimer(FuntionTimer[playerid]);
     return 1;
}

CMD:mycommand(playerid, params[])
{
          //code
          FuntionTimer[targetid/playerid] = SetTimerEx("function", 1000, true, "i", playerid);
          return 1;
}
Do you mean something like this?
Reply
#7

pawn Код:
new mins;
new secs;

new CTTimer;//On Top Of Your Script



forward CT(playerid);
public CT(playerid)
{
    if(mins + secs > -1)
    {
        if(secs > -1)
        {
            new str[10];
            format(str,10,"%i:%i",mins,secs);
            GameTextForPlayer(playerid,str,500,6);
            secs = secs - 1;
        }
        else
        {
            mins = mins - 1;
            secs = 59;
            new str[10];
            format(str,10,"%i:%i",mins,secs);
            GameTextForPlayer(playerid,str,500,6);
            secs = secs - 1;
        }
    }
    else
    {
        GameTextForPlayer(playerid,"GO !",500,6);
        KillTimer(CTTimer);
    }
    return 1;
}


    //put this where you want to start the timer
    mins = 0;//change it with the value of minutes
    secs = 3;//change it with the value of seconds
    CTTimer = SetTimerEx("CT",1000,1,"iii",playerid);
Reply
#8

Quote:
Originally Posted by BlackBomb
Посмотреть сообщение
what u need that for? , Map changing after the counts end?
aha,but the 2 guys in the above have already helped me,thank you very much!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)