#include <amxmodx>
#include <amxmisc> 

native	MH_SendClientModRunning(id,i)
native	MH_SendClientWeaponLimit(id,i)
native	bte_wpn_get_weapon_limit()

#define TASK_WAITTEXT	1451
#define TASK_SENDMODE	1551

public plugin_init()
{
	register_dictionary("bte_other.bte")
	register_plugin("BTE NONE INIT", "1.0", "BTE TEAM");
	register_event("HLTV", "Event_HLTV", "a", "1=0", "2=0")
	register_event("TeamInfo","Event_TeamInfo","a")
	server_cmd("mp_flashlight 1");
}
public Event_TeamInfo()
{
	static id;
	id = read_data(1)
	
	set_task(1.0, "Task_SendMode", TASK_SENDMODE + id);
}

public Event_HLTV()
{
	for(new i=1;i<=32;i++)
	{
		set_task(1.0, "Task_SendMode", TASK_SENDMODE + i);
	}
}

public client_putinserver(id)
{
	if(GetPlayer()>=2)
	{
		for(new i=1;i<=32;i++)
		{
			if(task_exists(TASK_WAITTEXT + i))
				remove_task(TASK_WAITTEXT + i)
		}
	}
	else
	{
		set_task(1.0, "Task_WaitText", TASK_WAITTEXT + id, _, _, "b");
	}
}
stock GetPlayer()
{
	new a = 0;
	for(new i=1;i<33;i++)
	{
		if(is_user_connected(i))	a += 1;
	}
	return a;
}

public Task_WaitText(iTask)
{
	new id = iTask - TASK_WAITTEXT
	client_print(id, print_center, "%L", LANG_PLAYER, "BTE_WAITING");
}

public Task_SendMode(iTask)
{
	new id = iTask - TASK_SENDMODE

	MH_SendClientModRunning(id,1);

	
	MH_SendClientWeaponLimit(id,bte_wpn_get_weapon_limit());
		
}



