SA-MP Forums Archive
need help with chat color - 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: need help with chat color (/showthread.php?tid=330996)



need help with chat color - YossiBz - 03.04.2012

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


Re: need help with chat color - Reklez - 03.04.2012

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;


Re: need help with chat color - YossiBz - 03.04.2012

i want the message will the same color of player


Re: need help with chat color - Reklez - 03.04.2012

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


Re: need help with chat color - YossiBz - 03.04.2012

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


Re: need help with chat color - sjvt - 03.04.2012

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


Re: need help with chat color - Jonny5 - 03.04.2012

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;
}



Re: need help with chat color - sjvt - 03.04.2012

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


Re: need help with chat color - MrEnd - 03.04.2012

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