Help me with Chat Name Colour
#1

Hello I have a problem with the Chat Name Colour , I want to make the FS set a respective colour to every faction I have on the GM,but I can not figure out, heare are the faction chat colours how I want them :

>><<I want only the chat name color to change.

>>Police Department (Blue)
>>FBI (DeepSkyBlue)
>>National Guard (RoyalBlue)
>>Hitman Agency (Red)
>>Corleone (Black)
>>Barzini (Green)
>>Tattaglia (Wheat)
>>Paterno (DarkOrchid)
>>Stracci (DarkOrange)
>>Cuneo (Teal)
>>Fireman/Paramedic (Pink)
>>News Reporter (Purple)
>>Taxi Cab Company (Yellow)
>>School Instructor (Cyan)
>>Tow Car Company (Sienna)

>><<Heare is the pawn code:

pawn Код:
// Chat Name Colour changer
//              ~ by Carrot

#include <a_samp>
#include <YSI\y_ini>

/*
Za Colors.

{33CC00}Green
{FF0000} Red
{FFCC00} Orange
*/


enum Col
{
pChat[9],
pNameCol[9]
}

new Colour[MAX_PLAYERS][Col];

forward LoadCol_data(playerid,name[],value[]);
public LoadCol_data(playerid,name[],value[])
{
    INI_Int("Name Colour", Colour[playerid][pNameCol]);
    INI_Int("Chat Colour", Colour[playerid][pChat]);
    return 1;
}

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Chat colour changer by Carrot loaded.");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    print("\n--------------------------------------");
    print(" Chat colour changer by Carrot unloaded.");
    print("--------------------------------------\n");
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(fexist(WhereTo(playerid)))
    {
    INI_ParseFile(WhereTo(playerid), "LoadCol_%s", .bExtra = true, .extra = playerid);
    }
    else
    {
    Colour[playerid][pNameCol] = "{99DDEE}";
    Colour[playerid][pChat] = "{FFFFFF}";
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new string[128];
    if(dialogid == 1)
    {
        if(response)
        {
            if(listitem == 0)
            {
            Colour[playerid][pNameCol] = "{33CC00}";

            }
            if(listitem == 1)
            {
            Colour[playerid][pNameCol] = "{FF0000}";
            }
            if(listitem == 2)
            {
            Colour[playerid][pNameCol] = "{FFCC00}";
            }
            format(string,sizeof(string),"{FFFFFF}Your chat name colour has changed to %sThis{FFFFFF}.\nChoose the color for your text now.",Colour[playerid][pNameCol]);
            ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"Congratz",string,"Next","");
        }
    }
    if(dialogid == 2)
    {
        if(response)
        {
        ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{FFCC00}Choose the colour for your text.","{33CC00}Green\r\n{FF0000}Red\r\n{FFCC00}Orange","Okay", "Not okay");
        }
    }
    if(dialogid == 3)
    {
        if(listitem == 0)
        {
        Colour[playerid][pChat] = "{33CC00}";
        }
        if(listitem == 1)
        {
        Colour[playerid][pChat] = "{FF0000}";
        }
        if(listitem == 2)
        {
        Colour[playerid][pChat] = "{FFCC00}";
        }
        format(string,sizeof(string),"{FFFFFF}Your chat text colour has changed to %sThis.",Colour[playerid][pChat]);
        ShowPlayerDialog(playerid,4,DIALOG_STYLE_MSGBOX,"Congratz",string,"Finish","");
    }
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new
    pName[24],
    string [256]
    ;
    GetPlayerName(playerid,pName,sizeof(pName));
    format(string,sizeof(string),"%s%s(%d): %s%s",Colour[playerid][pNameCol],pName,playerid,Colour[playerid][pChat],text[0]);
//  print(string); // For debugging.
    SendClientMessageToAll(Colour[playerid][pNameCol],string);
    return 0;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/chatcolour", cmdtext, true) == 0 || strcmp("/ccol", cmdtext, true) == 0)
    {
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"{FFCC00}Choose the colour for your name.","{33CC00}Green\r\n{FF0000}Red\r\n{FFCC00}Orange","Okay", "Not okay");
        return 1;
    }
    return 0;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:ColFile = INI_Open(WhereTo(playerid));
    INI_SetTag(ColFile,"Colours");
    INI_WriteString(ColFile, "Name Colour", Colour[playerid][pNameCol]);
    INI_WriteString(ColFile, "Chat Colour", Colour[playerid][pChat]);
    INI_Close(ColFile);
    return 1;
}

stock WhereTo(playerid)
{
    new string[128],
        pName[24];
    GetPlayerName(playerid,pName,sizeof(pName));
    format(string,sizeof(string),"/Colours/%s.ini",pName);
    return string;
}
>>If the pawn code is not good please give me 1 with the colours I mentioned up.
Please Help !
Reply
#2

pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(WhereTo(playerid)))
    {
    INI_ParseFile(WhereTo(playerid), "LoadCol_%s", .bExtra = true, .extra = playerid);
    SetPlayerColor(playerid, Col[playerid][pNameCol]);
    }
    else
    {
    Colour[playerid][pNameCol] = "{99DDEE}";
    Colour[playerid][pChat] = "{FFFFFF}";
    SetPlayerColor(playerid, Col[playerid][pNameCol]);
    }
    return 1;
}
SetPlayerColor changes Players Name Color.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)