Chat help
#1

Hey all. I need help with my chat. When players is in some faction/org his name is ex. Blue and chat he write too like this Berzelius:test. So could i make smth like this -Berzelius:test.
Reply
#2

u mean like this example?

pawn Код:
#define COLOR_BLUE 0x0000FF96

new fname[20];

static Team[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[128];
    if(strcmp(cmd, "/family", true) == 0 || strcmp(cmd, "/f", true) == 0)
    {
        for(new i=0; i<256; i++)
        {
        if( /* Check if player in that faction */ Team[playerid] == /* faction name*/Berzelius)
       {
            GetPlayerName(playerid,fname,sizeof(fname));  
            format(string,sizeof(string),"(%s): %s",fname,cmdtext[3]);
            SendClientMessageToAll(COLOR_BLUE, string);
            printf("%s: %s", fname, cmdtext[3]);
        }
        }
    }
return 1;
}
Reply
#3

Find the OnPlayerText, and change the string, so that it makes the written text white.
Basic example:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new
         string[128],
         pName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, pName, sizeof(pName));

    format(string, sizeof(string), "{0000FF}%s {FFFFFF}: ''%s''", pName, text[0]); // Blue playername, white text.

    SendClientMessageToAll(colorwanted, string);
    return true;
}
What I've basically done is: Change the string, by adding {FFFFFF} before the supplied text. - This will change the color of the supplied text to white. (As {FFFFFF} == White HEX color.) He'll also keep the blue playername, as I've also changed the string to give him that color.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)