coloured chat text
public text v1 · immutable#include <a_samp>
ReColour(text[])
{
new
pos = -1;
while ((pos = strfind(text, "(", false, pos + 1)) != -1)
{
new
c = pos + 1,
n = 0,
ch;
// Note that the order of these is important!
while ((ch = text[c]) && n != 6)
{
if (!('a' <= ch <= 'f' || 'A' <= ch <= 'F' || '0' <= ch <= '9'))
{
break;
}
++c;
++n;
}
if (n == 6 && ch == ')')
{
text[pos] = '{';
text[c] = '}';
}
}
}
public OnPlayerText(playerid, text[])
{
// Recolour the text
ReColour(text);
return 1;
}