28.06.2011, 00:12
That what I did -
This is the function that I seen here -
The problem - I doing "(red) check" and the message sending regulary, without the red color, why ?
THANKS !
PHP код:
new text2[256], Length = strlen(string);
if(Length > 135)
{
if(Length > 270) return scm(playerid, red, "!too long"), 0;
new string2[ 1024 ];
new string3[ 1024 ];
//
strmid(text2, string, 0, Length / 2);
format(string2, sizeof(string2), "%s", text2);
scmToAll(0xFFFFFFAA,ColouredText(string2));
strmid(text2, string, Length / 2, Length);
format(string3, sizeof(string3), "%s", text2);
scmToAll(0xFFFFFFAA,ColouredText(string3));
}
else
scmToAll(red, ColouredText(string));
PHP код:
stock ColouredText(text[])
{
enum
colorEnum
{
colorName[16],
colorID[7]
}
;
new
colorInfo[][colorEnum] =
{
{ "BLUE", "1B1BE0" },
{ "PINK", "E81CC9" },
{ "YELLOW", "DBED15" },
{ "LIGHTGREEN", "8CED15" },
{ "LIGHTBLUE", "15D4ED" },
{ "RED", "FF0000" },
{ "GREY", "BABABA" },
{ "WHITE", "FFFFFF" },
{ "ORANGE", "DB881A" },
{ "GREEN", "37DB45" },
{ "PURPLE", "7340DB" }
},
string[(128 + 32)],
tempString[16],
pos = -1,
x
;
strmid(string, text, 0, 128, sizeof(string));
for( ; x != sizeof(colorInfo); ++x)
{
format(tempString, sizeof(tempString), "#%s", colorInfo[x][colorName]);
while((pos = strfind(string, tempString, true, (pos + 1))) != -1)
{
new
tempLen = strlen(tempString),
tempVar,
i = pos
;
format(tempString, sizeof(tempString), "{%s}", colorInfo[x][colorID]);
if(tempLen < 8)
{
for(new j; j != (8 - tempLen); ++j)
{
strins(string, " ", pos);
}
}
for( ; ((string[i] != 0) && (tempVar != 8)) ; ++i, ++tempVar)
{
string[i] = tempString[tempVar];
}
if(tempLen > 8)
{
strdel(string, i, (i + (tempLen - 8)));
}
x = -1;
}
}
return string;
}
THANKS !