CD Command
#1

i tried to make a CountDown command and it works... but when i made a /CCD(/cancelcountdown) command... it doesn't work completly...
it cancel the GameText and write: "~r~CountDown Canceled" but the timer is keep running and when it come to zero it says GO!!! (even that i canceled the CD and the gametext has desabled...)
please help me!
Reply
#2

Drop your commands here ...
Reply
#3

do you want the "new" and "forward" too? or just /CD & /CCD
Reply
#4

Just drop everything
Reply
#5

Do you use KillTimer? Show us your code, otherwise we cannot help.
Reply
#6

CD command:
pawn Код:
if(strcmp(cmd, "/countdown", true) == 0 || strcmp(cmd, "/cd", true) == 0)
    {
        if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] >= 1)
        {
            new tmp[256], tmp2[256];
            tmp = strtok(cmdtext, idx);
            tmp2 = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOUR_ORANGE, "/CountDown [Time] [0/1 - Freeze]");
                return 1;
            }
            if(!strlen(tmp2))
            {
                SendClientMessage(playerid, COLOUR_ORANGE, "/CountDown [Time] [0/1 - Freeze]");
                return 1;
            }
            new timer, number, string[128];
            timer = strval(tmp);
            number = strval(tmp2);
            if(CountDownOn == 1) return SendClientMessage(playerid, COLOUR_RED, "лбш йщ сфйшд фетмъ");
            if(ResServCdOn == 1) return SendClientMessage(playerid, COLOUR_RED, "дсфйшд майфес дщшъ лбш фетмъ");
            if(number > 1 || number < 0) return SendClientMessage(playerid, COLOUR_RED, "оцб ддчфад йлем мдйеъ шч 0/1. 0 - бмй дчфад / 1 - тн дчфад");
            if(timer < 1 || timer > 1000) return SendClientMessage(playerid, COLOUR_RED, "лоеъ дщрйеъ зййбъ мдйеъ бйп 1 - 1000");
            CountDownOn = 1;
            if(number == 0)
            {
                format(string, sizeof(string), "дордм дзм сфйшд щм %d щрйеъ бмй айфес дчфад", timer);
                SendClientMessageToAll(COLOUR_YELLOW, string);
                CountDownTimer = SetTimer("CountDown", timer*1000, 0);
                CountDown(timer, 0);
            }
            else
            {
                format(string, sizeof(string), "дордм дзм сфйшд щм %d щрйеъ тн айфес дчфад");
                SendClientMessageToAll(COLOUR_YELLOW, string);
                CountDownTimer = SetTimer("CountDown", timer*1000, 0);
                CountDown(timer, 1);
                ToggleAllPlayersControllable(0);
            }
        }
        else return SendClientMessage(playerid, COLOUR_RED, "аъд зййб мдйеъ мфзеъ агойп шод 1 бщбйм мдщъощ бфчегд же");
        return 1;
    }
CCD command:
pawn Код:
if(strcmp(cmd, "/cancelcountdown", true) == 0 || strcmp(cmd, "/ccd", true) == 0)
    {
        if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] >= 1)
        {
            if(CountDownOn == 0) return SendClientMessage(playerid, COLOUR_RED, "айп сфйшд фтймд");
            GameTextForAll("~r~Count Down Canceled", 3000, 3);
            CountDownOn = 0;
            KillTimer(CountDownTimer);
            ToggleAllPlayersControllable(1);
        }
        else return SendClientMessage(playerid, COLOUR_RED, "аъд зййб мдйеъ мфзеъ агойп шод 1 бщбйм мдщъощ бфчегд же");
        return 1;
    }
Reply
#7

anyone!?!? b.t.w: no errors or warnings...
Reply
#8

Come On! please help!
Reply
#9

PHP код:
forward CountDown();
new 
boolIsCountdownStarted;
new 
CountdownTimer;
public 
CountDown()
{
    switch(
Count)
    {
        case 
5: { GameTextForAll("~b~-~r~ 5 ~b~-"11003); }
        case 
4: { GameTextForAll("~b~-~r~ 4 ~b~-"11003); }
        case 
3: { GameTextForAll("~b~-~r~ 3 ~b~-"11003); }
        case 
2: { GameTextForAll("~b~-~r~ 2 ~b~-"11003); }
        case 
1: { GameTextForAll("~b~-~r~ 1 ~b~-"11003); }
        case 
0:
        {
            
GameTextForAll("~b~-~g~ go! ~b~-"20003);
             
KillTimer(CountdownTimer);
              
IsCountdownStarted false;
        }
    }
    
Count--;
}
COMMAND:count(playeridparams[]) {
    
#pragma unused params
    
if(IsCountdownStarted == false)
         {
            
Count 5;
            
CountdownTimer SetTimer("CountDown"10001);
            
IsCountdownStarted true;
            
SendClientMessage(playeridCOLOR_ORANGE"You have started the CountDown!");
            new 
countstring2[128];
            new 
PlayerName[MAX_PLAYER_NAME];
            
GetPlayerName(playerid,PlayerNameMAX_PLAYER_NAME);
            
format(countstring2128"%s has started the CountDown"PlayerName);
            
SendClientMessage(COLOR_GREYcountstring2);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_RED"The CountDown has already started!");
          }
          return 
1;

if i could help please click a rep star for me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)