/* Rats Fixer
About:
This plugin fixes a few balance issues in de_rats , cs_rats2_final , de_rats_2001. And stops the ability for teammates to hurt their own team
either via drowning them, or gassing them.
 
Modules required: engine
 
Plugin forum thread: http://www.amxmodx.org/forums/viewtopic.php?t=17066
 
Credits:
Ops in #AMXmodx @ Quakenet for alot of help ( + AssKicR & CheesyPeteza ) 
 
Changelog:
 
 1.0.1
	Fixed: Bad CT Spawnpoint on de_rats
 
 1.0.0
	First public release
*/
#include <amxmodx>
#include <engine>
 
#define define_cs_rats2_final 0
#define define_de_rats_2001 1
#define define_de_rats 2
 
#define MapsInList 3
 
new gs_MapList[3][32] = {"cs_rats2_final","de_rats_2001","de_rats"}
new g_MaxEnts
 
public plugin_init()
{
	register_plugin("Rats Fixer", "1.0.2","EKS")
 
	g_MaxEnts = get_global_int(GL_maxEntities)
 
	new MapName[32]
	get_mapname(MapName,31)
 
	for(new i=0;i<MapsInList;i++)
	{
		if(equali(gs_MapList[i],MapName))
			FixMap(i)
	}
}
 
stock FixMap(WhatMap)
{
	new class[32],Float:Origin[3]
	new MaxPlayers = get_maxplayers() + 1
	if(WhatMap == define_de_rats_2001)
	{
		for(new i=MaxPlayers;i<=g_MaxEnts;i++) if(is_valid_ent(i))
		{
			entity_get_string(i,EV_SZ_classname,class,31)
			entity_get_vector(i,EV_VEC_origin,Origin)
			if(equal(class,"func_pushable") || equal(class,"trigger_relay") && ( Origin[2] == 239.00 || Origin[2] == 255.00 ))
			{
				remove_entity(i)
			}
		}
	}
	else if(WhatMap == define_cs_rats2_final)
	{
		for(new i=MaxPlayers;i<=g_MaxEnts;i++) if(is_valid_ent(i))
		{
			entity_get_string(i,EV_SZ_classname,class,31)
			if( equal(class,"func_rot_button"))
			{
				remove_entity(i)
			}
		}
	}
	else if(WhatMap == define_de_rats)
	{
		new ButtonsRemove=0
		//new Float:Org1[3] = {-397.0,181.0,-40.0}
		//new Float:Org2[3] = {-637.0,400.0,92.0}
		//new Float:Org3[3] = {-498.0,183.0,-40.0}
 
		for(new i=MaxPlayers;i<=g_MaxEnts;i++) if(is_valid_ent(i))
		{
			/*
			//entity_get_vector(i,EV_VEC_origin,Origin)
			entity_get_string(i,EV_SZ_classname,class,31)
			if(equal(class,"func_button") && ButtonsRemove < 4)
			{
				remove_entity(i)
				ButtonsRemove++
			}
			if(equal(class,"info_player_start"))
			{
				if(Origin[0] == -576 && Origin[1] == 400)
					entity_set_vector(i,EV_VEC_origin,Org1)
				else if(Origin[0] == -384 && Origin[1] == 488)
					entity_set_vector(i,EV_VEC_origin,Org2)
				else if(Origin[0] == -416 && Origin[1] == 384)
					entity_set_vector(i,EV_VEC_origin,Org3)
			}
			else 
			*/
			if( equal(class,"func_door"))
			{
				remove_entity(i)
			}
		}
	}
}