/* Script generated by Pawn Studio */
 
#include <amxmodx>
#include <amxmisc>
 
#define fTask 	15.0
 
new const Autor[] = "Chatto."
new const Name[] = "Notifications of festivities"
new const Vers[] = " 1.0 "
new const szPrfx[] = "!g[Unnepek]!y"
 
new const szHolydays[ ][ ] =
{
	"25",
	"31", 
	"01",
	"31"
}
 
new const szMonths[ ][ ] = 
{
	"October",
	"December",
	"January"
}
 
new gMaxPlayers;
 
public plugin_init()
{
	register_plugin(Name, Vers, Autor)	
	register_logevent("RoundStart", 2, "1=Round_Start")
	gMaxPlayers = get_maxplayers();
}
public RoundStart( )
{
	for( new i = 1; i < gMaxPlayers; i++ )
	{
		set_task( fTask, "Recording", i )
	}
}
public Recording( id )
{
	new Month[33], Day[12];
	get_time( "%B", Month, charsmax(Month) )
	get_time( "%d", Day, charsmax(Day) )
 
	new Christmas = str_to_num(szHolydays[ 0 ]) - str_to_num(Day)
	new Halloween =  str_to_num(szHolydays[ 3 ]) - str_to_num(Day)
	new LastDay_ofAge = str_to_num(szHolydays[ 1 ]) - str_to_num(Day)
 
	if( equali( Month, szMonths[0] ) )
	{
		ChatColor( id, "%s Meg!t %d nap van!t Halloween-ig", szPrfx, Halloween )
	}
	else if( equali( Month, szMonths[1] ) )
	{
		ChatColor( id, "%s Meg !t %d!y nap van!t Karacsonyig", szPrfx, Christmas )
		ChatColor( id, "%s Meg !t %d!y nap van!t Szilveszterig", szPrfx, LastDay_ofAge )
	}
	else if( equali( Month, szMonths[2] ) )
	{
		if( equal( Day, szHolydays[3] ) )
		{
			ChatColor( id, "%s Boldog uj evet!", szPrfx )
		}
	}
}
 
stock ChatColor(const id, const input[], any:...)
{
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
 
	replace_all(msg, 190, "!g", "^4"); // Color verde
	replace_all(msg, 190, "!y", "^1"); // Default 
	replace_all(msg, 190, "!t", "^3"); // Team Color
 
	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();
			}
		}
	}
}