Taken from one of my other posts, given the message,
sText, use the code below along with colors in the format {#FFFFFF} for RGB or {#FFFFFFFF} for RGBA etc.
PHP Code:
new iStart, iEnd, iTotal;
decl String:sHex[9], String:sCodeBefore[12], String:sCodeAfter[10];
while ((iStart = StrContains(sText[(iTotal)], "{#")) != -1) {
if ((iEnd = StrContains(sText[iTotal+iStart+2], "}")) != -1) {
if (iEnd == 6 || iEnd == 8) {
strcopy(sHex, iEnd+1, sText[iTotal+iStart+2]);
Format(sCodeBefore, sizeof(sCodeBefore), "{#%s}", sHex);
Format(sCodeAfter, sizeof(sCodeAfter), (iEnd == 6 ? "\x07%s" : "\x08%s"), sHex);
ReplaceString(sText, sizeof(sText), sCodeBefore, sCodeAfter);
iTotal += iStart + iEnd + 1;
}
else {
iTotal += iStart + iEnd + 3;
}
}
else {
break;
}
}
__________________