[Include] CountDownForPlayer, CountDownForAll
#6

Quote:
Originally Posted by Markx
Посмотреть сообщение
Your English grammar is horrible.
Hehe

I'm wondering about some things, for example these two stocks:
pawn Код:
stock AvailableColors(TColor[])
{
        if(strcmp(TColor,"r", true) == 0) return 1;
        if(strcmp(TColor,"g", true) == 0) return 1;
        if(strcmp(TColor,"b", true) == 0) return 1;
        if(strcmp(TColor,"w", true) == 0) return 1;
        if(strcmp(TColor,"y", true) == 0) return 1;
        if(strcmp(TColor,"p", true) == 0) return 1;
        if(strcmp(TColor,"l", true) == 0) return 1;
        if(strcmp(TColor,"h", true) == 0) return 1;
        else return 0;
}

stock CountDownForAll(Color[2], EndMessage[30], Seconds)
{
        foreach(Player, i)
        {
                if(CD[i][CDUsed] == 1) return print("CountDown ERROR: There's a player still having the Countdown messages!");
                if(strlen(Color) > 1 || !AvailableColors(Color)) return print("CountDown ERROR: Invalid color used!");
                if(strlen(EndMessage) > 30) return print("CountDown ERROR: End Message is too long!");
                if(Seconds < 0 ) return print("CountDown ERROR: Negative amount of seconds.");
                CD[i][cdc] = Color;
                CD[i][cdem] = EndMessage;
                CD[i][cds] = Seconds;
                CDTimerA = SetTimer("CountD", 1000, true);
                CD[i][CDUsed] = 1;
        }
        return 1;
}
Why are you using strings to check the colour? You could just use numbers or the #define function, like:
pawn Код:
#define COLOR_CDI_RED 0
#define COLOR_CDI_GREEN 1
Then when formatting the string, you'll only need an if - else if statement when choosing the colour.
Reply


Messages In This Thread
CountDownForPlayer, CountDownForAll - by Biesmen - 10.05.2011, 14:57
Re: CountDownForPlayer, CountDownForAll - by gamer931215 - 10.05.2011, 15:01
Re: CountDownForPlayer, CountDownForAll - by TheGarfield - 10.05.2011, 15:09
Re: CountDownForPlayer, CountDownForAll - by Markx - 10.05.2011, 15:25
Re: CountDownForPlayer, CountDownForAll - by Biesmen - 17.05.2011, 17:52
Re: CountDownForPlayer, CountDownForAll - by Hiddos - 17.05.2011, 18:14
Re: CountDownForPlayer, CountDownForAll - by Biesmen - 17.05.2011, 18:28
Re: CountDownForPlayer, CountDownForAll - by Michael@Belgium - 17.05.2011, 18:36
Respuesta: CountDownForPlayer, CountDownForAll - by Lunnatiicz - 17.05.2011, 19:10
Re: CountDownForPlayer, CountDownForAll - by Sasino97 - 18.05.2011, 11:47

Forum Jump:


Users browsing this thread: 3 Guest(s)