/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "[COD:Elite] Menu Serwera"
#define VERSION "1.0"
#define AUTHOR "Play"

native cod_set_user_hud(id)
native cod_get_user_hud(id)

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("say /menu"		, "CentrumPomocy");
	register_clcmd("say_team /menu"		, "CentrumPomocy");
	register_clcmd("say /pomoc"		, "CentrumPomocy");
	register_clcmd("say_team /pomoc"	, "CentrumPomocy");
	register_clcmd("say /item"		, "CentrumPomocy");
	register_clcmd("say_team /item"		, "CentrumPomocy");
	register_clcmd("say /Kontakt"		, "Kontakt");
	register_clcmd("say_team /Kontakt"	, "Kontakt");
	
	// Language files
	register_dictionary("CodElite.txt")	
}
public CentrumPomocy(id)
{
	if(cod_set_user_hud(id))
		return PLUGIN_CONTINUE;
		
	static menu[128], formats
	
	// Title	
	formatex(menu, charsmax(menu), "%L", LANG_PLAYER, "MENU_CENTRAL_HELP_TITLE")
	formats = menu_create(menu,"CentrumPomocy_Handler");	
	
	
	menu_additem(formats, "\y~\wKontakt \y-Kontakt Do H@~");
	menu_additem(formats, "\y~\rGildie \y-System Gildi~^n");	
	menu_additem(formats, "\y~\rKomendy \y-Komendy Serwera~");
	menu_additem(formats, "\y~\rRegulamin \y-Regulamin Serwera~ ");
	
	// Back - Next - Exit
	formatex(menu, charsmax(menu), "%L", id, "MENU_BACK")
	menu_setprop(formats, MPROP_BACKNAME, menu)
	formatex(menu, charsmax(menu), "%L", id, "MENU_NEXT")
	menu_setprop(formats, MPROP_NEXTNAME, menu)
	formatex(menu, charsmax(menu), "%L", id, "MENU_EXIT")
	menu_setprop(formats, MPROP_EXITNAME, menu)
		
	client_cmd(id, "spk CodElite/select");
		
	menu_display(id, formats)
	return PLUGIN_CONTINUE;
}
public CentrumPomocy_Handler(id, menu, item)
{
	client_cmd(id, "spk CodElite/select");
	
	if(item == MENU_EXIT)
	{
		cod_get_user_hud(id);
		menu_destroy(menu);
		return PLUGIN_CONTINUE;
	}
	switch(item) 
	{
		case 0: {
			Kontakt(id, menu, item)
		}
		case 1: {
			client_cmd(id, "say /Gildie");
		}		
		case 2:{
			Komendy(id, menu, item)
		}
		case 3: {
			show_motd(id, "regulamin.txt", "Regulamin Serwera");
		}
		
	}
	return PLUGIN_CONTINUE
}
public Kontakt(id, menu, item)
{
	if(cod_set_user_hud(id))
		return PLUGIN_CONTINUE;
		
	client_cmd(id, "spk CodElite/select");
	
	if(item++ == MENU_EXIT)
	{
		cod_get_user_hud(id);
		menu_destroy(menu);
		return PLUGIN_CONTINUE;
	}
	new opis[1023]
	formatex(opis, charsmax(opis), "%L", LANG_PLAYER, "KONTAKT");
	
	new menu = menu_create(opis, "CentrumPomocy")
	
	menu_additem(menu, "Wroc")
	menu_display(id, menu)
	
	return PLUGIN_CONTINUE;
}
public Komendy(id, menu, item)
{
	if(cod_set_user_hud(id))
		return PLUGIN_CONTINUE;
		
	client_cmd(id, "spk CodElite/select");
	if(item == MENU_EXIT)
	{
		cod_get_user_hud(id);
		menu_destroy(menu);
		return PLUGIN_CONTINUE;
	}	
	static menu[128], formats
	
	// Title	
	formatex(menu, charsmax(menu), "%L", id, "MENU_COMMANDS_TITLE")
	formats = menu_create(menu,"Komendy_Handler");	
		
	menu_additem(formats, "\r|\y \ Reset\r |\w Resetuje Statystyki"); // 0
	menu_additem(formats, "\r|\y \ Statystyki\r |\w Statystyki Twojej Klasy"); //1
	menu_additem(formats, "\r|\y \ Klasa\r |\w Wybor Klas"); // 2
	menu_additem(formats, "\r|\y \ Wyrzuc\r |\w Wyrzuca Perk"); // 3
	menu_additem(formats, "\r|\y \ Perk\r |\w Opis Twojego Perku"); // 4
	menu_additem(formats, "\r|\y \ Klasy\r |\w Opis Klas"); // 5
	menu_additem(formats, "\r|\y \ Konto\r |\w Twoje Konto"); // 6
	menu_additem(formats, "\r|\y \ Sklep\r |\w Dodatki do kupienia"); // 7
	menu_additem(formats, "\r|\y \ Knife\r |\w Mozliwosc zmiany noza"); // 8
	menu_additem(formats, "\r|\y \ Gildie\r |\w System Gildi"); // 9
	menu_additem(formats, "\r|\y \ Wymien\r |\w Wymiana sie perkiem"); // 10
	menu_additem(formats, "\r|\y \ Daj\r |\w Oddaj komus perk"); // 11
	menu_additem(formats, "\r|\y \ IP\r |\w Mozliwosc sprawdzenia ip gracza");	// 12
	menu_additem(formats, "\r|\y \ toplvl\r |\w Lista najwiekszych leveli graczy"); // 13
	menu_additem(formats, "\r|\y \ czas\r |\w Sprawdz ile juz grasz na serwerze"); // 14
	menu_additem(formats, "\r|\y \ Magazyn\r |\w Mozliwosc przechowania perku"); // 14
	menu_additem(formats, "\r|\y \ Rynek\r |\w Mozliwosc wystawienia perku na rynek"); // 15
	
	// Back - Next - Exit
	formatex(menu, charsmax(menu), "%L", id, "MENU_BACK")
	menu_setprop(formats, MPROP_BACKNAME, menu)
	formatex(menu, charsmax(menu), "%L", id, "MENU_NEXT")
	menu_setprop(formats, MPROP_NEXTNAME, menu)
	formatex(menu, charsmax(menu), "%L", id, "MENU_EXIT")
	menu_setprop(formats, MPROP_EXITNAME, menu)
		
	client_cmd(id, "spk CodElite/select");
		
	menu_display(id, formats)
	return PLUGIN_CONTINUE;
}
public Komendy_Handler(id, menu, item)	
{
	client_cmd(id, "spk CodElite/select");
	if(item == MENU_EXIT)
	{
		cod_get_user_hud(id);
		menu_destroy(menu);
		return PLUGIN_CONTINUE;
	}
	switch(item) 
	{
		case 0: { 
			client_cmd(id, "say /reset"); 
		}
		case 1: {
			client_cmd(id, "say /statystyki");
		}
		case 2: {
			client_cmd(id, "say /klasa");
		}
		case 3: {
			client_cmd(id, "say /wyrzuc");
		}
		case 4: {
			client_cmd(id, "say /perk");
		}
		case 5: {
			client_cmd(id, "say /klasy");
		}	
		case 6:{ 
			client_cmd(id, "say /konto");
		}
		case 7: {	
			client_cmd(id, "say /sklep");
		}		
		case 8: {
			client_cmd(id, "say /knife");	
		}
		case 9: {
			client_cmd(id, "say /gildie");	
		}
		case 10: {
			client_cmd(id, "say /daj");
		}
		case 11: {
			client_cmd(id, "say /wymien");
		}		
		case 12: {
			client_cmd(id, "say /ip");
		}
		case 13: {
			client_cmd(id, "say /toplvl");
		}
		case 14: {
			client_cmd(id, "say /czas");
		}
		case 15:{
			client_cmd(id, "say /magazyn");
		}
		case 16: {
			client_cmd(id, "say /rynek");
		}
	}
	cod_get_user_hud(id);
	return PLUGIN_CONTINUE
}
