03.12.2015, 11:51
how to change player chat color to team color?
if(pInfo[playerid][Team] == USA) { //This checks if the player's team is USA(change it to your system) format(text, SOS, "%s[%d]: %s", pInfo[playerid][Name], playerid, text); // This is the format(what will type if his team matches,that means if he is USA, it will say Player[hisid]: and the message here SendClientMessageToAll(-1, text); //here it will send the message to all players, Use whatever color you want, -1 means white } |
new string[128]; if(GetPlayerTeam(playerid) == 0) { format(string,sizeof(string),"(id: %d): "#blue"%s",playerid,text); SendPlayerMessageToAll(playerid, string); return 0; }
new string[128]; if(GetPlayerTeam(playerid) == 0) { format(string,sizeof(string),"{B7B7B7}(id: %d): {00FFF2}%s",playerid,text); SendPlayerMessageToAll(playerid, string); return 0; }
#define C_Red "{FF0000}"
#define C_Green "{00FF00}"
#define C_Blue "{0000FF}"
#define C_Yellow "{FFFF00}"
new string[128];
if(GetPlayerTeam(playerid) == 0)
{
format(string,sizeof(string),"(id: %d): "C_Yellow"%s",playerid,text);
SendPlayerMessageToAll(playerid, string);
return 1;
}
#define COLOR_RED 0xFF0000FF
#define COLOR_GREEN 0x00FF00FF
#define COLOR_BLUE 0x0000FFFF
#define COLOR_YELLOW 0xFFFF00FF
#define COLOR_WHITE 0xFFFFFFFF
SetPlayerColor(playerid,SetTeamColors(playerid));
// case 0: or
// case TEAM_RED:
stock SetTeamColors(playerid)
{
switch (GetPlayerTeam(playerid))
{
case 0: COLOR_RED
case 1: COLOR_BLUE
case 2: COLOR_GREEN
case 3: COLOR_YELLOW
default: COLOR_WHITE // if no team
}
}
Define colors
PHP код:
PHP код:
PHP код:
|
new string[128]; SetPlayerColor(playerid,SetTeamColors(playerid)); if(GetPlayerTeam(playerid) == 0) { format(string,sizeof(string),"{B7B7B7}(id: %d): {00FFF2}%s",playerid,text); SendPlayerMessageToAll(playerid, string); return 0; }