I need a little help with Colour messages
#1

I need a little help with Colour messages.

Код:
new chat = 1;

// OnPlayerText
if(chat)
{
     format(string, sizeof(string), "(%d): %s", playerid, text[0]);
     SendPlayerMessageToAll(playerid, string);
     return 0;
}
I want to do when I write {FF0000} (or other color)Text to write my message in red
Reply
#2

pawn Код:
new chat = 1;

// OnPlayerText
if(chat)
{
     format(string, sizeof(string), "(%d): %s", playerid, text[0]);
     SendPlayerMessageToAll(playerid, 0xFF0000AA, string);
     return 0;
}
Please REP xD
Reply
#3

Not what I want when I write in different colors as {FFFFFF}, {CC33CC} and others, it appears in the chat with them.

Example: the "T" write "{F0F0F0} my text" chatting and hanging out with his color
Reply
#4

List of 0.3 colours:

pawn Код:
#define COL_EASY "{FFF1AF}"
#define COL_WHITE "{FFFFFF}"
#define COL_BLACK "{0E0101}"
#define COL_GREY "{C3C3C3}"
#define COL_GREEN "{6EF83C}"
#define COL_RED "{F81414}"
#define COL_YELLOW "{F3FF02}"
#define COL_ORANGE "{FFAF00}"
#define COL_LIME "{B7FF00}"
#define COL_CYAN "{00FFEE}"
#define COL_LIGHTBLUE "{00C0FF}"
#define COL_BLUE "{0049FF}"
#define COL_MAGENTA "{F300FF}"
#define COL_VIOLET "{B700FF}"
#define COL_PINK "{FF00EA}"
#define COL_MARONE "{A90202}"
#define COL_CMD "{B8FF02}"
#define COL_PARAM "{3FCD02}"
#define COL_SERVER "{AFE7FF}"
#define COL_VALUE "{A3E4FF}"
#define COL_RULE "{F9E8B7}"
#define COL_RULE2 "{FBDF89}"
#define COL_RWHITE "{FFFFFF}"
#define COL_LGREEN "{C9FFAB}"
#define COL_LRED "{FFA1A1}"
#define COL_LRED2 "{C77D87}"
Try this:

pawn Код:
new chat = 1;

// OnPlayerText
if(chat)
{
     format(string, sizeof(string), ""#COL_WHITE"(%d): "#COL_RED"%s", playerid, text[0]);
     SendPlayerMessageToAll(playerid, -1, string);
     return 0;
}
Reply
#5

Ahhh....

Red = {FF{FF0000}0000} Text Here
Blue = {00{0000FF}00FF} Text Here
Green = {00{00FF00}FF00} Text Here
Cyan = {00{00F0F0}F0F0} Text Here

That's all I know off by heart... I am not sure if this was patched in 0.3d, I haven't tested. But this definitely works in 0.3c

EDIT: As you can see in the codes above, they all have 6 digit codes.
The input is like this {1-2{1-2-3-4-5-6}3-4-5-6}

Example ABC522{A-B{A-B-C-5-2-2}C-5-2-2}
Reply
#6

You need this: https://sampforum.blast.hk/showthread.php?tid=194202
Colour codes like "{FF0000}" are hidden in the chat text input. You need to replace the format of the code into some others, and convert them back when you use SendClientMessage(ToAll).

Also,
pawn Код:
format(string, sizeof(string), "(%d): %s", playerid, text);//Putting [0] will only output the first character of the text.
SendPlayerMessageToAll(GetPlayerColor(playerid), string);//You need to use SetPlayerColor in OnPlayerConnect first if you want to use this, otherwise you need to change GetPlayerColor(playerid) into some other constant colours.
Reply
#7

Yes, exactly what I want.
Nicknames in chat are fine. I do not want change. I just change the text color
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)