Raised This Month: $51 Target: $400
 12% 

[color chat]


Post New Thread Reply   
 
Thread Tools Display Modes
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 03-13-2010 , 11:43   Re: [color chat]
Reply With Quote #31

Quote:
Originally Posted by K.K.Lv View Post
do you know what mean normal color ?

e.g:^3 -->team color (CT blue, TE red, SP grey)
^4 -- >green
^1 -- >yellow
Yes, I know what normal color is.. why don't you just stop posting because it's already over. You lost.
__________________
Hi.
Kreation is offline
lkh1018
Junior Member
Join Date: Aug 2007
Old 03-17-2010 , 23:10   Re: [color chat]
Reply With Quote #32

Quote:
Originally Posted by Emp` View Post
Mine can show the normal color.
Emp`, how to display the team color with your code?_?
for example,
CT can see the message is blue but T can see the same message is red.
if it can't, can you modify it for me?_?
lkh1018 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-04-2010 , 16:07   Re: [color chat]
Reply With Quote #33

Added COLOR_TEAM:

With enum:
Code:
enum COLOR_PRINT
{
	COLOR_TEAM = -5,
	COLOR_RANDOM,
	COLOR_GREY,
	COLOR_BLUE,
	COLOR_RED,
}

stock client_print_color(id, {_,COLOR_PRINT}:color_id, message[], any:...)
{
	static SayText, TeamInfo;
	if( !SayText )
		SayText = get_user_msgid("SayText");
	if( !TeamInfo )
		TeamInfo = get_user_msgid("TeamInfo");

	if( COLOR_PRINT:color_id == COLOR_TEAM )
	{
		new message2[128];
		message2[0] = '^1'; //The message must start with a color, this is for normal colors
		vformat(message2[1], 127, message, 4);

		if( id )
		{
			message_begin( MSG_ONE_UNRELIABLE, SayText, _, id);
			write_byte(id);
			write_string(message2);
			message_end();
		}
		else
		{
			for( new i; i<=32; i++ )
			{
				if( is_user_connected(i) )
				{
					message_begin( MSG_ONE_UNRELIABLE, SayText, _, i);
					write_byte(i);
					write_string(message2);
					message_end();
				}
			}
		}
		return;
	}

	new const TeamName[][] = 
	{
		"",
		"TERRORIST",
		"CT",
		"SPECTATOR"
	};

	new ColorChange;
	if( color_id < 0 )
	{
		ColorChange = color_id;
		for( new i=1; i<=32; i++ )
		{
			if(is_user_connected(i))
			{
				color_id = i;
				break;
			}
		}
		if( color_id <= 0 )
			return;

		if( message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, TeamInfo, _, id) )
		{
			write_byte(color_id);
			switch( COLOR_PRINT:ColorChange )
			{
				case COLOR_RED: write_string(TeamName[1]);
				case COLOR_BLUE: write_string(TeamName[2]);
				case COLOR_GREY: write_string(TeamName[3]);
				default: write_string(TeamName[random_num(1,3)]);
			}
			message_end();
			ColorChange = get_user_team(color_id);	
		}
	}

	new message2[128];
	message2[0] = '^1'; //The message must start with a color, this is for normal colors
	vformat(message2[1], 127, message, 4);

	if( message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, SayText, _, id) )
	{
		write_byte(color_id);
		write_string(message2);
		message_end();
	}

	if( ColorChange && message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, TeamInfo, _, id) )
	{
		write_byte(color_id);
		write_string(TeamName[ColorChange]);
		message_end();
	}
}
Without enum:
Code:
stock client_print_color(id, color_id, message[], any:...)
{
	static SayText, TeamInfo;
	if( !SayText )
		SayText = get_user_msgid("SayText");
	if( !TeamInfo )
		TeamInfo = get_user_msgid("TeamInfo");

	if( color_id == -5 )
	{
		new message2[128];
		message2[0] = '^1'; //The message must start with a color, this is for normal colors
		vformat(message2[1], 127, message, 4);

		if( id )
		{
			message_begin( MSG_ONE_UNRELIABLE, SayText, _, id);
			write_byte(id);
			write_string(message2);
			message_end();
		}
		else
		{
			for( new i; i<=32; i++ )
			{
				if( is_user_connected(i) )
				{
					message_begin( MSG_ONE_UNRELIABLE, SayText, _, i);
					write_byte(i);
					write_string(message2);
					message_end();
				}
			}
		}
		return;
	}

	new const TeamName[][] = 
	{
		"",
		"TERRORIST",
		"CT",
		"SPECTATOR"
	};

	new ColorChange;
	if( color_id < 0 )
	{
		ColorChange = color_id;
		for( new i=1; i<=32; i++ )
		{
			if(is_user_connected(i))
			{
				color_id = i;
				break;
			}
		}
		if( color_id <= 0 )
			return;

		if( message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, TeamInfo, _, id) )
		{
			write_byte(color_id);
			switch( ColorChange )
			{
				case -1: write_string(TeamName[1]);
				case -2: write_string(TeamName[2]);
				case -3: write_string(TeamName[3]);
				default: write_string(TeamName[random_num(1,3)]);
			}
			message_end();
			ColorChange = get_user_team(color_id);	
		}
	}

	new message2[128];
	message2[0] = '^1'; //The message must start with a color, this is for normal colors
	vformat(message2[1], 127, message, 4);

	if( message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, SayText, _, id) )
	{
		write_byte(color_id);
		write_string(message2);
		message_end();
	}

	if( ColorChange && message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, TeamInfo, _, id) )
	{
		write_byte(color_id);
		write_string(TeamName[ColorChange]);
		message_end();
	}
}

Last edited by Emp`; 04-06-2010 at 13:28.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-04-2010 , 17:33   Re: [color chat]
Reply With Quote #34

Here is mine lol

PHP Code:
enum _:Colors {
    
DONT_CHANGE,
    
TERRORIST,
    
CT,
    
SPECTATOR
}

ColorChat(idCOLOR=DONT_CHANGEfmt[], any:...)
{
    new 
szMsg[192]
    
szMsg[0] = 0x04
    vformat
(szMsg[1], charsmax(szMsg)-1fmt4)

    new 
szTeam[11], MSG_DEST id MSG_ONE MSG_ALL

    
static const szTeamNames[Colors][] = {"UNASSIGNED""TERRORIST""CT""SPECTATOR"}

    if( 
COLOR )
    {
        
Send_TeamInfo(idszTeamNames[COLOR], MSG_DEST)
    }

    static 
iSayText

    
if( iSayText || (iSayText get_user_msgid("SayText")) )
    {
        
message_begin(MSG_DESTiSayText_id)
        {
            
write_byte(id id 1)
            
write_string(szMsg)
        }
        
message_end()
    }

    if( 
COLOR )
    {
        if( 
id || is_user_connected(1) )
        {
            
get_user_team(id id 1szTeamcharsmax(szTeam))
            
Send_TeamInfo(idszTeamMSG_DEST)
        }
        else
        {
            
Send_TeamInfo(0"UNASSIGNED"MSG_DEST)
        }
    }
}

Send_TeamInfo(const id, const szTeam[], MSG_DEST)
{
    static 
iTeamInfo
    
if( iTeamInfo || (iTeamInfo get_user_msgid("TeamInfo")) )
    {
        
message_begin(MSG_DESTiTeamInfo_id)
        {
            
write_byte(id id 1)
            
write_string(szTeam)
        }
        
message_end()
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 04-04-2010 , 21:25   Re: [color chat]
Reply With Quote #35

Good job ! Con !!!
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
lkh1018
Junior Member
Join Date: Aug 2007
Old 04-06-2010 , 12:22   Re: [color chat]
Reply With Quote #36

Quote:
Originally Posted by Emp` View Post
Added COLOR_TEAM:

With enum:
Code:
enum COLOR_PRINT
{
    COLOR_TEAM = -5,
    COLOR_RANDOM,
    COLOR_GREY,
    COLOR_BLUE,
    COLOR_RED,
}

stock client_print_color(id, {_,COLOR_PRINT}:color_id, message[], any:...)
{
    static SayText, TeamInfo;
    if( !SayText )
        SayText = get_user_msgid("SayText");
    if( !TeamInfo )
        TeamInfo = get_user_msgid("TeamInfo");

    if( COLOR_PRINT:color_id == COLOR_TEAM )
    {
        new message2[128];
        message2[0] = '^1'; //The message must start with a color, this is for normal colors
        vformat(message2[1], 127, message, 4);

        if( id )
        {
            message_begin( MSG_ONE_UNRELIABLE, SayText, _, id);
            write_byte(id);
            write_string(message2);
            message_end();
        }
        else
        {
            for( new i; i<=32; i++ )
            {
                if( is_user_connected(i) )
                {
                    message_begin( MSG_ONE_UNRELIABLE, SayText, _, i);
                    write_byte(i);
                    write_string(message2);
                    message_end();
                }
            }
        }
    }

    new const TeamName[][] = 
    {
        "",
        "TERRORIST",
        "CT",
        "SPECTATOR"
    };

    new ColorChange;
    if( color_id < 0 )
    {
        ColorChange = color_id;
        for( new i=1; i<=32; i++ )
        {
            if(is_user_connected(i))
            {
                color_id = i;
                break;
            }
        }
        if( color_id <= 0 )
            return;

        if( message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, TeamInfo, _, id) )
        {
            write_byte(color_id);
            switch( COLOR_PRINT:ColorChange )
            {
                case COLOR_RED: write_string(TeamName[1]);
                case COLOR_BLUE: write_string(TeamName[2]);
                case COLOR_GREY: write_string(TeamName[3]);
                default: write_string(TeamName[random_num(1,3)]);
            }
            message_end();
            ColorChange = get_user_team(color_id);    
        }
    }

    new message2[128];
    message2[0] = '^1'; //The message must start with a color, this is for normal colors
    vformat(message2[1], 127, message, 4);

    if( message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, SayText, _, id) )
    {
        write_byte(color_id);
        write_string(message2);
        message_end();
    }

    if( ColorChange && message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, TeamInfo, _, id) )
    {
        write_byte(color_id);
        write_string(TeamName[ColorChange]);
        message_end();
    }
}
Without enum:
Code:
stock client_print_color(id, color_id, message[], any:...)
{
    static SayText, TeamInfo;
    if( !SayText )
        SayText = get_user_msgid("SayText");
    if( !TeamInfo )
        TeamInfo = get_user_msgid("TeamInfo");

    if( color_id == -5 )
    {
        new message2[128];
        message2[0] = '^1'; //The message must start with a color, this is for normal colors
        vformat(message2[1], 127, message, 4);

        if( id )
        {
            message_begin( MSG_ONE_UNRELIABLE, SayText, _, id);
            write_byte(id);
            write_string(message2);
            message_end();
        }
        else
        {
            for( new i; i<=32; i++ )
            {
                if( is_user_connected(i) )
                {
                    message_begin( MSG_ONE_UNRELIABLE, SayText, _, i);
                    write_byte(i);
                    write_string(message2);
                    message_end();
                }
            }
        }
    }

    new const TeamName[][] = 
    {
        "",
        "TERRORIST",
        "CT",
        "SPECTATOR"
    };

    new ColorChange;
    if( color_id < 0 )
    {
        ColorChange = color_id;
        for( new i=1; i<=32; i++ )
        {
            if(is_user_connected(i))
            {
                color_id = i;
                break;
            }
        }
        if( color_id <= 0 )
            return;

        if( message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, TeamInfo, _, id) )
        {
            write_byte(color_id);
            switch( ColorChange )
            {
                case -1: write_string(TeamName[1]);
                case -2: write_string(TeamName[2]);
                case -3: write_string(TeamName[3]);
                default: write_string(TeamName[random_num(1,3)]);
            }
            message_end();
            ColorChange = get_user_team(color_id);    
        }
    }

    new message2[128];
    message2[0] = '^1'; //The message must start with a color, this is for normal colors
    vformat(message2[1], 127, message, 4);

    if( message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, SayText, _, id) )
    {
        write_byte(color_id);
        write_string(message2);
        message_end();
    }

    if( ColorChange && message_begin( id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, TeamInfo, _, id) )
    {
        write_byte(color_id);
        write_string(TeamName[ColorChange]);
        message_end();
    }
}
Oh, thanks a lot, it's very useful
lkh1018 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-06-2010 , 13:28   Re: [color chat]
Reply With Quote #37

Updated above code, forgot a return.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 04-08-2010 , 18:53   Re: [color chat]
Reply With Quote #38

Quote:
Originally Posted by Cuchii View Post
replace_all(msg, 190, "!team2", "^0") // Team2 Color
Please remove that, it's the second time I see someone using that code with its non-sense ^0.

Last edited by Seta00; 04-08-2010 at 18:57.
Seta00 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode