#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <engine>

#define PLUGIN "press E to pick weapons"
#define VERSION "1.0"
#define AUTHOR "Equali"

new G_normal;

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	RegisterHam(Ham_Touch, "weaponbox", "fw_TouchWeapon")
	RegisterHam(Ham_Touch, "armoury_entity", "fw_TouchWeapon")
	RegisterHam(Ham_Touch, "weapon_shield", "fw_TouchWeapon")
	
	G_normal = register_cvar("amx_normal_pick", "0")
}

public fw_TouchWeapon(weapon, id)
{
	if(get_pcvar_num(G_normal) == 0)
	{
		if(get_user_button(id) & IN_USE) 
		{
			dllfunc(DLLFunc_Touch, weapon ,id)
		}
		else
		{
			if (id && !is_user_bot(id))
			{
				return HAM_SUPERCEDE;
			}
		}
	}
	else
	{
		return PLUGIN_CONTINUE;
	}
		
	return PLUGIN_HANDLED;
}
