#include <amxmodx>
#include <amxmisc>

#define PLUGIN "[COD] Exp Event"
#define VERSION "1.0"
#define AUTHOR "RPK. Shark"

/* Optymalizacja kodu by DarkGL */

#define TASK_ID 666

new iTime, pCvarEvent;
new cvar_eventxp, cvar_eventoff;

public plugin_init() {
	register_plugin("Exp Event", "0.1", "RPK. Shark")
	
	register_clcmd("say /eventkill", "Start");
	
	pCvarEvent = register_cvar("cod_eventczas", "300");
	cvar_eventoff = register_cvar("cod_eventoff", "45");
	cvar_eventxp = register_cvar("cod_eventxp", "15");
}

public Start(id)
{
	if(!(get_user_flags(id) & ADMIN_IMMUNITY) || task_exists( TASK_ID ) )
		return PLUGIN_HANDLED;
	
	server_cmd("cod_killxp %i", get_pcvar_num(cvar_eventxp))
	server_exec();
	
	client_print(0, print_center, "Start EVENTU Exp za Killa");
	
	iTime = get_pcvar_num( pCvarEvent );
	
	remove_task( TASK_ID )
	
	set_task( 1.0, "Koniec", TASK_ID, .flags = "b" )
	
	return PLUGIN_HANDLED
}

public Koniec()
{
	if( iTime <= 0 )
	{
		remove_task( TASK_ID )
		
		server_cmd("cod_killxp %i", get_pcvar_num(cvar_eventoff))
		server_exec();
		
		client_print(0, print_center, "Koniec EVENTU Exp za Killa");
		
		return PLUGIN_CONTINUE;
	}
	set_hudmessage(255, 255, 0, -1.0, 0.01, 0, 2.0, 1.1)
	show_hudmessage( 0, "^n^n^n[Koniec Eventu za %d sekund!]|[3x wiecej expa za Killa]", iTime )
	
	iTime --;
	
	return PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
