[FilterScript] Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR!
#1

Chat colour changer

Intro
Ladies and gentleman I present to you the Chat Color Changer!
With this little filterscript you can change the colour of the name and the text in chat!

Commands

The only command there is: /ccol or /chatcolour.
It will bring a dialog in where you will first choose the colour of your name and after that one the colour of your text.

Credits

Carrot a.k.a. Berlovan for making this,
****** for his Y_ini,
SA:MP team for making this great game;

Changelog

pawn Код:
// ============================ [ Changelog ] ============================
//
// ------------------------------ [ v 1.0 ] ------------------------------
// ~  Initial Release.
// ------------------------------ [ v 1.1 ] ------------------------------
// ~ Added file saving with y_ini. The colours save when player disconnects.
Download

(It is a small script. Only 116 lines.) Now 152!

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


Messages In This Thread
Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! v1.1 - by sleepysnowflake - 03.08.2011, 17:27
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by RandomDude - 03.08.2011, 18:34
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by sleepysnowflake - 03.08.2011, 18:42
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by ⒹⒾⓇⒺⒸⓉⓄⓇ - 03.08.2011, 19:47
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by Mean - 03.08.2011, 20:10
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by sleepysnowflake - 03.08.2011, 21:35
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by ⒹⒾⓇⒺⒸⓉⓄⓇ - 03.08.2011, 22:33
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by Horrible - 04.08.2011, 01:05
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by sleepysnowflake - 04.08.2011, 11:46
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by sleepysnowflake - 04.08.2011, 19:21
Respuesta: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by Abruu - 08.10.2011, 01:34
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by szabyxxx - 29.01.2012, 14:50
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by Dead01 - 29.01.2012, 16:31
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by NiCo_222 - 11.07.2012, 15:21
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by [COD5]Sergang - 06.08.2012, 21:40
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by Ghost_Boii - 05.10.2012, 08:08
Re: Chat colour changer >> CHANGE YOUR NAME && TEXT COLOUR! - by Pro_Drifter - 05.10.2012, 08:10

Forum Jump:


Users browsing this thread: 1 Guest(s)