/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Silah Vereni Goster"
#define VERSION "1.0"
#define AUTHOR "byetovice"
new weapons[33][] = {
	"weapon_usp",
	"weapon_glock18",
	"weapon_deagle",
	"weapon_p228",
	"weapon_elite",
	"weapon_fiveseven",
	"weapon_m3",
	"weapon_xm1014",
	"weapon_tmp",
	"weapon_mac10",
	"weapon_mp5navy",
	"weapon_p90",
	"weapon_ump45",
	"weapon_famas",
	"weapon_galil",
	"weapon_ak47",
	"weapon_m4a1",
	"weapon_sg552",
	"weapon_aug",
	"weapon_scout",
	"weapon_sg550",
	"weapon_awp",
	"weapon_g3sg1",
	"weapon_m249",
	"weapon_hegrenade",
	"weapon_smokegrenade",
	"weapon_flashbang",
	"weapon_shield",
	"weapon_c4",
	"weapon_knife",
	"item_kevlar",
	"item_assaultsuit",
	"item_thighpack"
}



new const RLWT[33] = {
	12,11,14,13,16,15,
	21,22,31,32,33,34,35,
	40,41,42,43,44,45,
	46,47,48,49,
	51,83,85,84,87,91,
	1,81,82,86
}



public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_concmd("amx_weapon","admin_weapon",ADMIN_KICK)
}




public admin_weapon(id,level,cid)
{
	if ( !cmd_access(id,level,cid,3) )
		return PLUGIN_CONTINUE
	
	new arg[32],arg2[8],weapon
	new aName[32], aAuthid[36]
	read_argv(1,arg,31)
	read_argv(2,arg2,7)
	get_user_name(id,aName,31)
	get_user_authid(id,aAuthid,35)
	
	weapon = str_to_num(arg2)
	
	if(!weapon){
		//cycle thru our weapons array under position 30 until match
		for(new i; i < 30; i++){
			if(containi(arg2,weapons[i][7]) != -1){
				weapon = RLWT[i]
				break
			}
		}
	}
	
	new xweapon[64];
	new y
	for(y = 0; y<sizeof(RLWT); y++)
	{
		if(RLWT[y] == weapon)
		{
			copy(xweapon,63,weapons[y])
		}
	}
	replace_all(xweapon,63,"weapon_","")
	
	
	if (arg[0]=='@'){
		new plist[32], pnum
		if (equali("T",arg[1]))         copy(arg[1],31,"TERRORIST")
		if (equali("ALL",arg[1]))       get_players(plist,pnum,"a")
		else                            get_players(plist,pnum,"ae",arg[1])
		
		if (pnum == 0) {
			//console_print(id,"Oyle biri yok burda =P")
			return PLUGIN_CONTINUE
		}
		
		
		//for(new i=0; i<pnum; i++)
		//	give_weapon(plist[i],weapon)
		
		
		if(equali("TERRORIST",arg[1]))
		{
			if(weapon == 200) client_print(0, print_chat,"[%s] isimli admin TERORISTlere Her Silahtan (200) verdi !",aName,xweapon) 
			else {
				
				client_print(0, print_chat,"[%s] isimli admin TERORISTlere %s (%d) verdi !",aName,xweapon,weapon)
			}
		}
		else if(equali("ALL",arg[1]))
		{
			if(weapon == 200) client_print(0, print_chat,"[%s] isimli admin herkese Her Silahtan (200) verdi !",aName,xweapon) 
			else {
				client_print(0, print_chat,"[%s] isimli admin herkese %s (%d) verdi !",aName,xweapon,weapon)
			}
		}
		else
		{
			if(weapon == 200) client_print(0, print_chat,"[%s] isimli admin CTlere Her Silahtan (200) verdi !",aName,xweapon) 
			else {
				client_print(0, print_chat,"[%s] isimli admin CTlere %s (%d) verdi !",aName,xweapon,weapon)
			}
		}
		
		
	}
	else
	{
		new pName[32], pAuthid[36]
		new player = cmd_target(id,arg,7)
		if (!player) return PLUGIN_CONTINUE
		//give_weapon(player,weapon)
		get_user_name(player,pName,31)
		get_user_authid(player,pAuthid,35)
		if(weapon == 200) client_print(0, print_chat,"[%s] isimli admin %s isimli oyuncuya Her Silahtan verdi !",aName,pName,xweapon) 
		else {
			client_print(0, print_chat,"[%s] isimli admin %s isimli oyuncuya %s (%d) verdi !",aName,pName,xweapon,weapon)
		}
		
	}
	return PLUGIN_CONTINUE
}
