Help /countdown +[rep]
#1

i can do /countdown 1000000 well i dont want that.i want /countdown from 10 seconds!No matter the admin....giving rep

PHP код:
     if(strcmp(cmd"/countdown"true) == 0)
    {
    if (
PlayerInfo[playerid][pAdmin] >= 3)
    {
    
tmp strtok(cmdtextidx);
    if(!
strlen(tmp))
    {
    
SendClientMessage(playeridCOLOR_GREEN"USAGE: /countdown [seconds(3-10)]");
    return 
1;
    }
    new 
countdowns strval(tmp);
    if((
countdowns 60 || countdowns 3) && PlayerInfo[playerid][pAdmin] < 1337) return SendClientMessage(playeridCOLOR_GREY,"* Seconds must not go above 60 or below 3!");
    if(
CountdownRunning == 0)
    {
    
CountdownRunning 1;
    
CountdownSeconds countdowns;
    
CountdownTimer SetTimer("CountDown",1000,true);
    
format(stringsizeof(string),"~p~Countdown: ~w~%d",countdowns);
    
TextDrawSetString(Textdraw46string);
    
TextDrawShowForAll(Textdraw46);
    new 
ymd;
    new 
h,mi,s;
    
getdate(y,m,d);
    
gettime(h,mi,s);
    
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Announced a Countdown: [Seconds: %s]",d,m,y,h,mi,s,sendernamecountdowns);
    }
    else
    {
    
KillTimer(CountdownTimer);
    
TextDrawHideForAll(Textdraw46);
    
CountdownRunning 1;
    
CountdownSeconds countdowns;
    
CountdownTimer SetTimer("CountDown",1000,true);
    
format(stringsizeof(string),"~p~Countdown: ~w~%d",countdowns);
    
TextDrawSetString(Textdraw46string);
    
TextDrawShowForAll(Textdraw46);
    new 
ymd;
    new 
h,mi,s;
    
getdate(y,m,d);
    
gettime(h,mi,s);
    
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Announced a Countdown: [Seconds: %s]",d,m,y,h,mi,s,sendernamecountdowns);
    }
    }
    return 
1;
    } 
Reply
#2

You want the coutdown time predefined? If so, then try this.

pawn Код:
if ( strcmp (cmd, "/countdown", true) == 0 )
{
    if ( PlayerInfo[playerid][pAdmin] >= 3 )
    {
        new countdowns = 1000;
        if ( CountdownRunning == 0 )
        {
            CountdownRunning = 1;
            CountdownSeconds = countdowns;
            CountdownTimer   = SetTimer( "CountDown", 1000, true );
            format( string, sizeof(string), "~p~Countdown: ~w~%d", countdowns );
            TextDrawSetString( Textdraw46, string );
            TextDrawShowForAll( Textdraw46 );
            new y, m, d;
            new h, mi, s;
            getdate( y, m, d );
            gettime( h, mi, s );
            format( string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Announced a Countdown: [Seconds: %s]", d, m, y, h, mi, s, sendername, countdowns );
        } else  {
            KillTimer( CountdownTimer );
            TextDrawHideForAll( Textdraw46 );
            CountdownRunning = 1;
            CountdownSeconds = countdowns;
            CountdownTimer   = SetTimer( "CountDown", 1000, true );
            format( string, sizeof(string), "~p~Countdown: ~w~%d", countdowns );
            TextDrawSetString( Textdraw46, string );
            TextDrawShowForAll( Textdraw46 );
            new y, m, d;
            new h, mi, s;
            getdate( y, m, d );
            gettime( h, mi, s );
            format( string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Announced a Countdown: [Seconds: %s]", d, m, y, h, mi, s, sendername, countdowns );
        }
    }
    return(1);
}
Reply
#3

what do u mean time??i want the countdown to start at 10!
Reply
#4

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
what do u mean time??i want the countdown to start at 10!
Try the code above.
Reply
#5

Use this somewhere:

pawn Код:
SetTimerEx("CountDown", 1000, false, "i", 10);
pawn Код:
forward CountDown(sec);
public CountDown(sec) {

    printf("sec: %d", sec);
   
    //show it to everyone using the 'sec' variable.
   
    sec --;
    if(sec) SetTimerEx("CountDown", 1000, false, "i", 10);
}
Reply
#6

i want me to do /countdown 1-10 so i can do /countdown 1-10 get it?not just countdown from 10...please help!
Reply
#7

Here: http://pastebin.com/1bDT9GUQ
Got rid of redundant code. Still ignoring the fact that you're using strtok.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)