/* K1d0x Productions - Chat Color functions
*
* (c) Copyright 2010-2012, K1d0x
*
* This file is provided as is (no warranties).
*/

#if defined _K1d0x_ChatColor_included
  #endinput
#endif
#define _K1d0x_ChatColor_included

stock player_color( const id, const input[ ], any:... )
{
	new count = 1, players[ 32 ]

	static msg[ 191 ]
	vformat( msg, 190, input, 3 )
	
	replace_all( msg, 190, "!v", "^4" ) /* culoarea verde */
	replace_all( msg, 190, "!c", "^1" ) /* culoarea chatului */
	replace_all( msg, 190, "!e", "^3" ) /* culoarea echipei ct = albastru | tero = rosie */
	replace_all( msg, 190, "!e2", "^0" ) /* culoarea normala a echipei */
	
	if( id ) players[ 0 ] = id; else get_players( players, count, "ch" )
	{
		for( new i = 0; i < count; i++ )
		{
			if( is_user_connected( players[ i ] ) )
			{
				message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] )
				write_byte( players[ i ] );
				write_string( msg );
				message_end( );
			}
		}
	}
}