[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
#2

Awsome [NOT]
Realy Easy!
Reply
#3

Yeah, I know. But I searched and I did not saw this anywhere.
Reply
#4

Thanks!
This is the thing I needed.
Reply
#5

You could explain what the code does, and all that stuff. Ain't bad though.
Reply
#6

Okay. In the next release I will do that + it will save the colour you had hwen you left the server + more colours ^^
Reply
#7

I'll wait for your realease, that's for sure.
Reply
#8

older thread:
http://forum.sa-mp.com/showthread.ph...07#post1309707
Reply
#9

Yeah dude. But that one changes only the name colour. This one changes the players text colour.
Reply
#10

Sorry for double post. UPDATE

+ Changelog added

Go to the 1st post.
Reply
#11

cool
Reply
#12

Not save to chat & name color
Reply
#13

-one " } "

Great Script
Reply
#14

One bug when i choose and finish i auto spawns at at-400 or andromada
Reply
#15

Does this work on all sa:mp servers, or I need to have my own one?
Where to paste these codes?
Reply
#16

Simple Easy and Nice
Reply
#17

So easy
but nice system
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)