#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich> 
#include <next21_DR_core>

#define PLUGIN "n21_Deathrun_Buttons"
#define VERSION "1.0"
#define AUTHOR "Psycrow"

new ModeId, bool: g_button_pressed[33][999], g_maxplayers

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	ModeId = n21_dr_mode_registration("Кнопки", "", 0, 0, 255, 0, 0)
	
	RegisterHam(Ham_Use, "func_button", "Button_Press")     
	register_event("HLTV", "RoundStart", "a", "1=0", "2=0")
	
	g_maxplayers = get_maxplayers()
}

public RoundStart()
{	
	for(new i=1; i<=g_maxplayers; i++)
		for(new j=g_maxplayers; j < 999; j++)
			g_button_pressed[i][j] = false
}

public Button_Press(ent, id, idactivator, use_type, Float:value)
{     
	if(!is_user_connected(id))
		return HAM_SUPERCEDE  
	
	if(ModeId == n21_dr_get_mode_id() && is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T) 
	{     
		if(!g_button_pressed[id][ent])
		{
			g_button_pressed[id][ent] = true
			return HAM_IGNORED 
		}
		else
		{
			client_print(id, print_center, "Вы уже активировали эту кнопку")
			return HAM_SUPERCEDE
		}
	}     
      	return HAM_IGNORED     
} 
