#include <amxmodx>
#include <engine>
#include <nshelpers>

/* ONOSBLOCKER
 * -
 * Requires 3 hives to go onos, and 2 to go fade.
 *
 * Orginal plugin by mahnsawce
 */

public plugin_init() 
{ 
	register_plugin("Onos blocker AMX","1.0","mahnsawce/AssKicR")
} 

public client_PreThink(id) 
{
	new impulse = entity_get_int(id,EV_INT_impulse)
	if (impulse==117) do_onoscheck(id)
	if (impulse==116) do_fadecheck(id)
}

public do_onoscheck(id)
{
	if (ns_getteam(id) == 2) // Dont let marines do this, else they can use this to tell how many hives aliens have.
	{
		if (ns_getbuild("team_hive",1,0) < 3)
		{
			client_print(id,print_center,"You need 3 hives to go onos.")
			entity_set_int(id,EV_INT_impulse,0)
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}
public do_fadecheck(id)
{
	if (ns_getteam(id) == 2)
	{
		if (ns_getbuild("team_hive",1,0) < 2)
		{
			client_print(id,print_center,"You need 2 hives to go fade.")
			entity_set_int(id,EV_INT_impulse,0)
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}