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

The color line in chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sutar
Senior Member
Join Date: Sep 2010
Old 05-10-2012 , 04:44   The color line in chat
Reply With Quote #1

Hello, here found a script that does the line in the chat "red", you can trim it to the max?
I just do not know what you need and what is not ...

here's the script:

HTML Code:
#include <amxmodx>
#include <amxmisc>

new g_msgSayText, g_msgTeamInfo

enum ChatColor
{
	CHATCOLOR_NORMAL = 1,
	CHATCOLOR_GREEN,
	CHATCOLOR_TEAM_COLOR,
	CHATCOLOR_GREY, 	
	CHATCOLOR_RED, 		
	CHATCOLOR_BLUE, 	
}

new g_TeamName[][] = 
{
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
}

public  plugin_init()
{
	register_plugin("Color line", "1.5", "Sutar")
	
	register_clcmd("say /mms", "colors")
}

public colors(id)
{
	colorChat(0, CHATCOLOR_RED, " Цветная строчка...")
	return PLUGIN_CONTINUE
}


colorChat(id, ChatColor:color, const msg[], {Float,Sql,Result,_}:...)
{
	new team, index, MSG_Type
	new bool:teamChanged = false
	static message[192]
	
	switch(color)
	{
		case CHATCOLOR_NORMAL: message[0] = 0x01;
		case CHATCOLOR_GREEN: message[0] = 0x04;
		default: message[0] = 0x03;
	}
	
	vformat(message[1], 190, msg, 4);
	replace_all(message, 190, "$g", "^x04")
	replace_all(message, 190, "$n", "^x01")
	replace_all(message, 190, "$t", "^x03")
		
	if(id == 0)
	{
		index = findAnyPlayer();
		MSG_Type = MSG_ALL;
	}
	else
	{
		index = id;
		MSG_Type = MSG_ONE;
	}
	if(index != 0)
	{
		team = get_user_team(index);	
		if(color == CHATCOLOR_RED && team != 1)
		{
			messageTeamInfo(index, MSG_Type, g_TeamName[1])
			teamChanged = true
		}
		else
		if(color == CHATCOLOR_BLUE && team != 2)
		{
			messageTeamInfo(index, MSG_Type, g_TeamName[2])
			teamChanged = true
		}
		else
		if(color == CHATCOLOR_GREY && team != 0)
		{
			messageTeamInfo(index, MSG_Type, g_TeamName[0])
			teamChanged = true
		}
		messageSayText(index, MSG_Type, message);
		if(teamChanged)
		{
			messageTeamInfo(index, MSG_Type, g_TeamName[team])
		}
	}
}

messageSayText(id, type, message[])
{
	message_begin(type, g_msgSayText, _, id)
	write_byte(id)		
	write_string(message)
	message_end()
}
	
messageTeamInfo(id, type, team[])
{
	message_begin(type, g_msgTeamInfo, _, id)
	write_byte(id)
	write_string(team)
	message_end()
}
	
findAnyPlayer()
{
	static players[32], inum, pid
	
	get_players(players, inum, "ch")
	
	for (new a = 0; a < inum; a++)
	{
		pid = players[a]
		if(is_user_connected(pid))
			return pid
	}
	
	return 0
}
Needs to be done so that the red line deduced all the players on the server and it was red ...
Sutar is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 05-10-2012 , 04:56   Re: The color line in chat
Reply With Quote #2

wrong section. AMXX Scripting

Last edited by Leonardo; 05-10-2012 at 04:56.
Leonardo 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 19:25.


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