need help with chat color
#1

I want to get color of player and the text of the player will be the same color
Reply
#2

pawn Код:
#define white "{FFFFFF}" //at the top of script after #include

//OnPlayerText

new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "(%d) %s: "white"%s", playerid, pname, text); //(%d) will be the playerid, %s will be the players name, "white"%s should be the player typed message text
SendClientMessageToAll(GetPlayerColor(playerid), string); //will sent message to everyone with players color
if you didn't SetPlayerColor, the players color will be color black when sent chat.

and almost forgot set the OnPlayerText return 1; to return 0;
Reply
#3

i want the message will the same color of player
Reply
#4

Yes it does that function, please sometimes read the post first before posting
Reply
#5

its not its give me the id the same color i want all the text the player write be the same color
Reply
#6

how works your team system if i know it i can help you.
Reply
#7

omg read the wiki

pawn Код:
public OnPlayerText(playerid, text[])
{
new string[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "(%d) %s: %s", playerid, pname, text); //(%d) will be the playerid, %s will be the players name, "white"%s should be the player typed message text
SendClientMessageToAll(GetPlayerColor(playerid), string); //will sent m
return 0;
}
Reply
#8

If you use no team system here a team system tutorial

https://sampwiki.blast.hk/wiki/PAWN_tutorial

If you use that then

pawn Код:
// Under includes
forward TeamMessgae(team, color, string[]);

//OnPlayerText
new string[128];
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));

format(string, sizeof(string), "Gang: %s: %s", pname, text);
TeamMessage(gTeam[playerid], COLOR HERE, string);

// Put it somewhere but not in a OTHER public
public TeamMessage(team, color, string[])
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(gTeam[ii] == team)
        {
            SendClientMessage(i, color, string);
        }
    }
}
I don't know if it works
Reply
#9

Quote:
Originally Posted by Reklez
Посмотреть сообщение
Yes it does that function, please sometimes read the post first before posting
you should read :P

I think he want the if the player got red color the text will be red
if the player is green the text will be green
Not only White
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)