17.05.2011, 18:14
Hehe
I'm wondering about some things, for example these two stocks:
Why are you using strings to check the colour? You could just use numbers or the #define function, like:
Then when formatting the string, you'll only need an if - else if statement when choosing the colour.
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;
}
pawn Код:
#define COLOR_CDI_RED 0
#define COLOR_CDI_GREEN 1