#include <amxmodx>

new const PLUGIN[]  = "Admin Cursor";
new const VERSION[] = "1.0";
new const AUTHOR[]  = "se7en aka Ashcan";

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR);
	register_clcmd( "cursor","KursorMenu");
	register_clcmd( "say /cursor","KursorMenu");
	register_clcmd( "say cursor","KursorMenu");
	register_clcmd( "say_team /cursor","KursorMenu");
	register_clcmd( "say_team cursor","KursorMenu");
}

public KursorMenu(id)
{
	new menu = menu_create("\rAdminCursor \yMENU\w:", "menu_handler");
	menu_additem(menu, "\wWho is?", "1", ADMIN_CHAT);
	menu_additem(menu, "\wSlap", "2", ADMIN_SLAY);
	menu_additem(menu, "\wSlay", "3", ADMIN_SLAY);
	menu_additem(menu, "\wKick", "4", ADMIN_KICK);
	menu_setprop(menu,MPROP_EXITNAME,"Exit");
	menu_setprop(menu,MPROP_EXIT, MEXIT_ALL);
	menu_setprop(menu,MPROP_NUMBER_COLOR,"\y");
	menu_display(id, menu, 0);
}
public menu_handler(id, menu, item)
{
	if( item == MENU_EXIT )
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}
	
	new data[6], iName[64];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
	new key = str_to_num(data);
	switch(key)
		{
		case 1:
		{
			cel_ktoto(id);
			KursorMenu(id);
		}
		case 2:
		{
			cel_slap(id);
			KursorMenu(id);
		}
		case 3:
		{
			cel_slay(id);
			KursorMenu(id);
		}
		case 4:
		{
			cel_kick(id);
			KursorMenu(id);
		}
	}
	return PLUGIN_HANDLED;
}

public cel_ktoto(id)
{
	new tid, body, cel_gracz[32], podcelownikiem[32]
	get_user_name(id,podcelownikiem,31)
	get_user_aiming(id,tid,body)
	get_user_name(tid,cel_gracz,31)
	new gracz=find_player("a",cel_gracz)
	if (gracz)
	{
		client_print(id,print_chat,"Player under Cursor: %s", cel_gracz)
	}
	if (!gracz)
	{
		client_print(id,print_chat,"Player not found!")
	}
	return PLUGIN_HANDLED
}

public cel_slap(id)
{
	new tid, body, cel_gracz[32], podcelownikiem[32]
	get_user_name(id,podcelownikiem,31)
	get_user_aiming(id,tid,body)
	get_user_name(tid,cel_gracz,31)
	new gracz=find_player("a",cel_gracz)
	if (gracz)
	{
		client_cmd(id,"^"amx_slap^" ^"%s^"", cel_gracz)
	}
	if (!gracz)
	{
		client_print(id,print_chat,"Player not found!")
	}
	return PLUGIN_HANDLED
}

public cel_slay(id)
{
	new tid, body, cel_gracz[32], podcelownikiem[32]
	get_user_name(id,podcelownikiem,31)
	get_user_aiming(id,tid,body)
	get_user_name(tid,cel_gracz,31)
	new gracz=find_player("a",cel_gracz)
	if (gracz)
	{
		client_cmd(id,"^"amx_slay^" ^"%s^"", cel_gracz)
	}
	if (!gracz)
	{
		client_print(id,print_chat,"Player not found!")
	}
	return PLUGIN_HANDLED
}

public cel_kick(id)
{
	new tid, body, cel_gracz[32], podcelownikiem[32]
	get_user_name(id,podcelownikiem,31)
	get_user_aiming(id,tid,body)
	get_user_name(tid,cel_gracz,31)
	new gracz=find_player("a",cel_gracz)
	if (gracz)
	{
		client_cmd(id,"^"amx_kick^" ^"%s^"", cel_gracz)
	}
	if (!gracz)
	{
		client_print(id,print_chat,"Player not found!")
	}
	return PLUGIN_HANDLED
}
