SA-MP Forums Archive
Issue - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Issue (/showthread.php?tid=470102)



Issue - Eugene. - 16.10.2013

Hello. I have one little problem and I don't know what to do. What do I have to do so the script allows me to use {FFFFFF} (hex colors) In-Game chat. It just doesn't work. Thanks!


Re: Issue - DanishHaq - 16.10.2013

Can you show us what you've attempted up to now so we can correct it?


Re: Issue - Eugene. - 16.10.2013

I just tried to write {FFFFFF} in admin chat and the color isn't changing and only the text I see.


Re: Issue - DanishHaq - 16.10.2013

I'll repeat what I said...

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
Can you show us what you've attempted up to now so we can correct it?
This would be an example anyway on how to do it:

pawn Код:
format(string, sizeof(string), "The word after the colon will be white: {FFFFFF}White");
SendClientMessage(playerid, COLOR_RED, string);



Re: Issue - iJumbo - 16.10.2013

You can't live add color embeed, only with scripts.

https://sampwiki.blast.hk/wiki/Colour_Em...olor_embedding


Re: Issue - Eugene. - 16.10.2013

Quote:
Originally Posted by iJumbo
Посмотреть сообщение
You can't live add color embeed, only with scripts.

https://sampwiki.blast.hk/wiki/Colour_Em...olor_embedding
I saw on different servers that was possible.


Re: Issue - JamesH - 16.10.2013

It is possible, there you go made by Y less

put this above OnPlayerText
pawn Код:
ReColor(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] = '}';
        }
    }
}
and this at the begenning of OnPlayerText:
pawn Код:
ReColor(text);
although now, you use (FF0000) instead of {FF0000}[/QUOTE]