#include <amxmodx>
#include <fun>
#include <cstrike>
#include <zombieplague>

new g_glock18, g_usp, g_p228, g_deagle, g_fiveseven, g_elite
new g_m3, g_xm1014
new g_tmp, g_mac10, g_mp5, g_ump45, g_p90
new g_galil, g_famas, g_ak47, g_m4a1, g_aug, g_sg552
new g_scout, g_sg550, g_awp, g_g3sg1
new g_m249
new g_hegrenade, g_flashbang, g_smokegrenade

const PRIMARY_WEAPONS_BIT_SUM = 
(1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<
CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)

public plugin_init()
{
	register_plugin("[ZP] Extra Item: Classic Weapons", "1.0", "LARS-BLOODLIKER") 

	g_glock18 = zp_register_extra_item("Glock18", 0, ZP_TEAM_HUMAN)
	g_usp = zp_register_extra_item("USP45 Tactical", 0, ZP_TEAM_HUMAN)
	g_p228 = zp_register_extra_item("P228 Compact", 0, ZP_TEAM_HUMAN)
	g_deagle = zp_register_extra_item("Desert Eagle", 0, ZP_TEAM_HUMAN)
	g_fiveseven = zp_register_extra_item("ES Five-Seven", 0, ZP_TEAM_HUMAN)
	g_elite = zp_register_extra_item("Dual Elites", 0, ZP_TEAM_HUMAN)

	g_m3 = zp_register_extra_item("M3", 0, ZP_TEAM_HUMAN)
	g_xm1014 = zp_register_extra_item("XM1014", 0, ZP_TEAM_HUMAN)

	g_tmp = zp_register_extra_item("TMP", 0, ZP_TEAM_HUMAN)
	g_mac10 = zp_register_extra_item("MAC-10", 0, ZP_TEAM_HUMAN)
	g_mp5 = zp_register_extra_item("MP5 Navy", 0, ZP_TEAM_HUMAN)
	g_ump45 = zp_register_extra_item("UMP445", 0, ZP_TEAM_HUMAN)
	g_p90 = zp_register_extra_item("P90", 0, ZP_TEAM_HUMAN)

	g_galil = zp_register_extra_item("Galil", 0, ZP_TEAM_HUMAN)
	g_famas = zp_register_extra_item("Famas", 0, ZP_TEAM_HUMAN)
	g_ak47 = zp_register_extra_item("AK-47", 0, ZP_TEAM_HUMAN)
	g_m4a1 = zp_register_extra_item("M4A1", 0, ZP_TEAM_HUMAN)
	g_aug = zp_register_extra_item("AUG", 0, ZP_TEAM_HUMAN)
	g_sg552 = zp_register_extra_item("SG-552", 0, ZP_TEAM_HUMAN)

	g_scout = zp_register_extra_item("Scout", 0, ZP_TEAM_HUMAN)
	g_sg550 = zp_register_extra_item("SG-550", 0, ZP_TEAM_HUMAN)
	g_awp = zp_register_extra_item("AWP", 0, ZP_TEAM_HUMAN)
	g_g3sg1 = zp_register_extra_item("G3SG1", 0, ZP_TEAM_HUMAN)

	g_m249 = zp_register_extra_item("M249", 0, ZP_TEAM_HUMAN)

	g_hegrenade = zp_register_extra_item("HE Grenade", 0, ZP_TEAM_HUMAN)
	g_flashbang = zp_register_extra_item("Flashbang", 0, ZP_TEAM_HUMAN)
	g_smokegrenade = zp_register_extra_item("Smoke Grenade", 0, ZP_TEAM_HUMAN)
}

public zp_extra_item_selected(id, itemid)
{
	//=============Pistols=============
	if(itemid == g_glock18)
	{	
		drop_weapons(id, 2)
		give_item(id, "weapon_glock18")
		cs_set_user_bpammo(id, CSW_GLOCK18, 120)
	}
	else if(itemid == g_usp)
	{	
		drop_weapons(id, 2)
		give_item(id, "weapon_usp")
		cs_set_user_bpammo(id, CSW_USP, 100)
	}
	else if(itemid == g_p228)
	{	
		drop_weapons(id, 2)
		give_item(id, "weapon_p228")
		cs_set_user_bpammo(id, CSW_P228, 52)
	}
	else if(itemid == g_deagle)
	{	
		drop_weapons(id, 2)
		give_item(id, "weapon_deagle")
		cs_set_user_bpammo(id, CSW_DEAGLE, 35)
	}
	else if(itemid == g_fiveseven)
	{	
		drop_weapons(id, 2)
		give_item(id, "weapon_fiveseven")
		cs_set_user_bpammo(id, CSW_FIVESEVEN, 100)
	}
	else if(itemid == g_elite)
	{	
		drop_weapons(id, 2)
		give_item(id, "weapon_elite")
		cs_set_user_bpammo(id, CSW_ELITE, 120)
	}
	//=============Pistols=============

	//============Shotguns============
	else if(itemid == g_m3)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_m3")
		cs_set_user_bpammo(id, CSW_M3, 32)
	}
	else if(itemid == g_xm1014)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_xm1014")
		cs_set_user_bpammo(id, CSW_XM1014, 32)
	}
	//============Shotguns============

	//============Automates============
	else if(itemid == g_tmp)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_tmp")
		cs_set_user_bpammo(id, CSW_TMP, 120)
	}
	else if(itemid == g_mac10)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_mac10")
		cs_set_user_bpammo(id, CSW_MAC10, 100)
	}
	else if(itemid == g_mp5)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_mp5navy")
		cs_set_user_bpammo(id, CSW_MP5NAVY, 120)
	}
	else if(itemid == g_ump45)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_ump45")
		cs_set_user_bpammo(id, CSW_UMP45, 100)
	}
	else if(itemid == g_p90)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_p90")
		cs_set_user_bpammo(id, CSW_P90, 100)
	}
	//============Automates============

	//===========Assault Rifles===========
	else if(itemid == g_galil)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_galil")
		cs_set_user_bpammo(id, CSW_GALIL, 90)
	}
	else if(itemid == g_famas)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_famas")
		cs_set_user_bpammo(id, CSW_FAMAS, 90)
	}
	else if(itemid == g_ak47)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_ak47")
		cs_set_user_bpammo(id, CSW_AK47, 90)
	}
	else if(itemid == g_m4a1)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_m4a1")
		cs_set_user_bpammo(id, CSW_M4A1, 90)
	}
	else if(itemid == g_aug)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_aug")
		cs_set_user_bpammo(id, CSW_AUG, 90)
	}
	else if(itemid == g_sg552)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_sg552")
		cs_set_user_bpammo(id, CSW_SG552, 90)
	}
	//===========Assault Rifles===========

	//===========Sniper Rifles===========
	else if(itemid == g_scout)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_scout")
		cs_set_user_bpammo(id, CSW_SCOUT, 90)
	}
	else if(itemid == g_sg550)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_sg550")
		cs_set_user_bpammo(id, CSW_SG550, 90)
	}
	else if(itemid == g_awp)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_awp")
		cs_set_user_bpammo(id, CSW_AWP, 30)
	}
	else if(itemid == g_g3sg1)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_g3sg1")
		cs_set_user_bpammo(id, CSW_G3SG1, 90)
	}
	//===========Sniper Rifles===========

	//===========Mashinguns===========
	else if(itemid == g_m249)
	{	
		drop_weapons(id, 1)
		give_item(id, "weapon_m249")
		cs_set_user_bpammo(id, CSW_M249, 200)
	}
	//===========Mashinguns===========

	//============Grenades============
	else if(itemid == g_hegrenade)
	{	
		give_item(id, "weapon_hegrenade")
		cs_set_user_bpammo(id, CSW_HEGRENADE, 1)
	}
	else if(itemid == g_flashbang)
	{	
		give_item(id, "weapon_flashbang")
		cs_set_user_bpammo(id, CSW_FLASHBANG, 1)
	}
	else if(itemid == g_smokegrenade)
	{	
		give_item(id, "weapon_smokegrenade")
		cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 1)
	}
	//============Grenades============
}

stock drop_weapons(id, dropwhat)
{
     	static weapons[32], num, i, weaponid
     	num = 0
     	get_user_weapons(id, weapons, num)
     
     	for(i = 0; i < num; i++)
     	{
          	weaponid = weapons[i]
          
          	if(dropwhat == 1 && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM) || dropwhat == 2 && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM))
          	{
               		static wname[32]
               		get_weaponname(weaponid, wname, sizeof wname - 1)
               		engclient_cmd(id, "drop", wname)
          	}
     	}
}