OnPlayerText changing color
#1

When I login /rcon and chat, it shows up [Admin]Brandon: blah blah.
But it shows up in white. Any way to change that to red?

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), "[Admin]%s: %s", pName, text);
        SendClientMessageToAll(-1,String);
        return 0;
    }
    return 1;
}
Reply
#2

Like This (?) :-
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), "{FF0000}[Admin] {%06x}%s(%d): {FFFFFF}%s", (GetPlayerColor(playerid) >>> 8), pName, playerid, text);
        SendClientMessageToAll(-1,String);
        return 0;
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
Like This (?) :-
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), "{FF0000}[Admin] {%06x}%s(%d): {FFFFFF}%s", (GetPlayerColor(playerid) >>> 8), pName, playerid, text);
        SendClientMessageToAll(-1,String);
        return 0;
    }
    return 1;
}
Ehhh sorta.
It turns the [Admin] red, and the Brandon: text as black so its not readable

EDIT:
If it helps?
pawn Код:
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x00FF00C8
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x3A47DEFF
#define COLOR_TAN 0xBDB76BAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_INDIGO 0x1E90FFAA
#define COLOR_BLACK 0x00000000
#define COLOR_DARKGREY 0x696969FF
Reply
#4

Like This (?) :-
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), ""COLOR_RED"[Admin] %s: "COLOR_BLACK"%s", pName, text);
        SendClientMessageToAll(-1,String);
        return 0;
    }
    return 1;
}
Reply
#5

Just replace this -1 with some other hexadecimal color code!
This is a sample of red!

Try this.. Is this what you were asking?

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), "[Admin] %s: %s", pName, text);
        SendClientMessageToAll(0xFF0000FF,String); //-1 to replace with hexdecimal color code, here now its red.. try it
        return 0;
    }
    return 1;
}
Working?
Reply
#6

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
Like This (?) :-
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), ""COLOR_RED"[Admin] %s: "COLOR_BLACK"%s", pName, text);
        SendClientMessageToAll(-1,String);
        return 0;
    }
    return 1;
}
Heh...Fixed my own problem.
Went back to original code and changed the variable inside the sendmessagetoall
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), "[Admin]%s: %s", pName, text);
        SendClientMessageToAll(0xFF0000AA,String); //<--the 0xFF0000AA(red) was a -1.
        return 0;
    }
    return 1;
}
Reply
#7

I would say he wants white. Black is unreadable in his words.

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), "[Admin] %s: {FFFFFF}%s", pName, text);
        SendClientMessageToAll(0xFF0000FF,String);
        return 0;
    }
    return 1;
}
EDIT: Okay... apparently 2 new posts were made in the 20 seconds it took me to post this?
Reply
#8

pawn Код:
#define COLOR_RED 0xFF0000AA
Lets take this as an example.

If you're going to use such a thing as a HEX code you need to convert it as well, so the following color would look like this:

pawn Код:
#define COL_RED "{FF0000}"
Now let's move on to the usage as well:

pawn Код:
public OnPlayerText(playerid, text[])
{
new string[50];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, 24);
format(string,sizeof(string),"My name is "#COL_RED"%s",pName);
SendClientMessageToAll(-1, string);
I hope that I helped you!.
Reply
#9

Quote:
Originally Posted by ShivRp
Посмотреть сообщение
Just replace this -1 with some other hexadecimal color code!
This is a sample of red!

Try this.. Is this what you were asking?

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        new pName[MAX_PLAYER_NAME], String[128];
        GetPlayerName(playerid, pName, 24);
        format(String, sizeof(String), "[Admin] %s: %s", pName, text);
        SendClientMessageToAll(0xFF0000FF,String); //-1 to replace with hexdecimal color code, here now its red.. try it
        return 0;
    }
    return 1;
}
Working?
Yes right before I posted haha it dawned on me why the hell dont I just change the -1
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)