SA-MP Forums Archive
Chat colour only white - 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: Chat colour only white (/showthread.php?tid=478871)



Chat colour only white - Jesper00 - 01.12.2013

Hello. When i make my teams in my gamemode and select it to there team colour and then i join the server and type a text in the chat.

The only colour there comes is white. I cant understand it!!!


Код HTML:
public OnPlayerText(playerid, text[])
{
    new pname[128], str[128];
    GetPlayerName(playerid, pname, 128);
 if(gTeam[playerid] == TEAM_GSF) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_GSF_COLOR, TEAM_GSF_COLOR, TEAM_GSF_COLOR, TEAM_GSF_COLOR, TEAM_GSF_COLOR);
    }
    if(gTeam[playerid] == TEAM_SBF) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_SEVILLE_COLOR, TEAM_SEVILLE_COLOR, TEAM_SEVILLE_COLOR, TEAM_SEVILLE_COLOR, TEAM_SEVILLE_COLOR);
    }
    if(gTeam[playerid] == TEAM_TDF) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_TEMPLA_COLOR, TEAM_TEMPLA_COLOR, TEAM_TEMPLA_COLOR, TEAM_TEMPLA_COLOR, TEAM_TEMPLA_COLOR);
    }
    if(gTeam[playerid] == TEAM_TDB) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_MARKET_COLOR, TEAM_MARKET_COLOR, TEAM_MARKET_COLOR, TEAM_MARKET_COLOR, TEAM_MARKET_COLOR);
    }
    if(gTeam[playerid] == TEAM_FYB) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_FRONT_COLOR, TEAM_FRONT_COLOR, TEAM_FRONT_COLOR, TEAM_FRONT_COLOR, TEAM_FRONT_COLOR);
    }
    if(gTeam[playerid] == TEAM_RHB) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_ROLLIN_COLOR, TEAM_ROLLIN_COLOR, TEAM_ROLLIN_COLOR, TEAM_ROLLIN_COLOR, TEAM_ROLLIN_COLOR);
    }
    if(gTeam[playerid] == TEAM_KTB) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_KILO_COLOR, TEAM_KILO_COLOR, TEAM_KILO_COLOR, TEAM_KILO_COLOR, TEAM_KILO_COLOR);
    }
    if(gTeam[playerid] == TEAM_VAGOS) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_VAGOS_COLOR, TEAM_VAGOS_COLOR, TEAM_VAGOS_COLOR, TEAM_VAGOS_COLOR, TEAM_VAGOS_COLOR);
    }
    if(gTeam[playerid] == TEAM_VLA) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_SURENOS_COLOR, TEAM_SURENOS_COLOR, TEAM_SURENOS_COLOR, TEAM_SURENOS_COLOR, TEAM_SURENOS_COLOR);
    }
    if(gTeam[playerid] == TEAM_GD) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_GD_COLOR, TEAM_GD_COLOR, TEAM_GD_COLOR, TEAM_GD_COLOR, TEAM_GD_COLOR);
    }
    if(gTeam[playerid] == TEAM_LSB) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, COLOR_BROWN, COLOR_BROWN, COLOR_BROWN, COLOR_BROWN, COLOR_BROWN);
    }
    if(gTeam[playerid] == TEAM_LF) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_LF_COLOR, TEAM_LF_COLOR, TEAM_LF_COLOR, TEAM_LF_COLOR, TEAM_LF_COLOR);
    }
    if(gTeam[playerid] == TEAM_LS) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_LS_COLOR, TEAM_LS_COLOR, TEAM_LS_COLOR, TEAM_LS_COLOR, TEAM_LS_COLOR);
    }
    if(gTeam[playerid] == TEAM_LSPD) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_LSPD_COLOR, TEAM_LSPD_COLOR, TEAM_LSPD_COLOR, TEAM_LSPD_COLOR, TEAM_LSPD_COLOR);
    }
    if(gTeam[playerid] == TEAM_HOODRATS) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_HOODRAT_COLOR, TEAM_HOODRAT_COLOR, TEAM_HOODRAT_COLOR, TEAM_HOODRAT_COLOR, TEAM_HOODRAT_COLOR);
    }
    if(gTeam[playerid] == TEAM_RCPD) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_RCPD_COLOR, TEAM_RCPD_COLOR, TEAM_RCPD_COLOR, TEAM_RCPD_COLOR, TEAM_RCPD_COLOR);
    }
    if(gTeam[playerid] == TEAM_LBC) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_LBC_COLOR, TEAM_LBC_COLOR, TEAM_LBC_COLOR, TEAM_LBC_COLOR, TEAM_LBC_COLOR);
    }
    if(gTeam[playerid] == TEAM_BDK_COLOR) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_BDK_COLOR, TEAM_BDK_COLOR, TEAM_BDK_COLOR, TEAM_BDK_COLOR, TEAM_BDK_COLOR);
    }
    if(gTeam[playerid] == TEAM_GC) {
    format(str, sizeof(str), "%s: {FFFFFF}%s", pname, text);
    ProxDetector(10.0, playerid, str, TEAM_GC_COLOR, TEAM_GC_COLOR, TEAM_GC_COLOR, TEAM_GC_COLOR, TEAM_GC_COLOR);
    }
    return 0;
}

// ===================================

forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);

public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                GetPlayerPos(i, posx, posy, posz);
                tempposx = (oldposx -posx);
                tempposy = (oldposy -posy);
                tempposz = (oldposz -posz);
                if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
                {
                    if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
                    {
                        SendClientMessage(i, col1, string);
                    }
                    else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
                    {
                        SendClientMessage(i, col2, string);
                    }
                    else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
                    {
                        SendClientMessage(i, col3, string);
                    }
                    else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
                    {
                        SendClientMessage(i, col4, string);
                    }
                    else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
                    {
                        SendClientMessage(i, col5, string);
                    }
                }
            }
        }
    }
    return 1;
}



Re: Chat colour only white - Areax - 01.12.2013

The names are white or the text is white ?


Re: Chat colour only white - Konstantinos - 01.12.2013

Quote:
Originally Posted by Areax
Посмотреть сообщение
The names are white or the text is white ?
That's a good question and we are not aware of its answer yet. Anyways, I'm going to write about both.

- The text on the chat is white colour because you added "{FFFFFF}" before the text. If you don't want it white, then you'll simply need to remove it.

- The name on the chat is white colour? If so, then you need to use:
pawn Код:
if(gTeam[playerid] == TEAM_GSF)
{
    format(str, sizeof(str), "{%06x}%s: {FFFFFF}%s", TEAM_GSF_COLOR >>> 8, pname, text);
    ProxDetector(10.0, playerid, str, TEAM_GSF_COLOR, TEAM_GSF_COLOR, TEAM_GSF_COLOR, TEAM_GSF_COLOR, TEAM_GSF_COLOR);
}
so the name will get the colour of the team. If that is what you wanted, then change the rest according the example above but each team with its own colour.