
/* AMX Mod script.
*
* (c) Copyright 2002, OLO
* This file is provided as is (no warranties).
*
*/

/* admin with flag "m" must point someone (during spectating or when playing)
*  and use "say specmenu" (the best way is just binding the command)
*/


#include <amxmod>

new aspec[33]
new agot[33]

public status_changed(id)
	aspec[id] = read_data(2)

public do_action(id){
	if (!(get_user_flags(id)&ADMIN_LEVEL_A)){ 
   client_print(id,print_chat,"[AMX] You have no access to that command") 
   return PLUGIN_HANDLED
  }
	if (aspec[id] == 0){
	 client_print(id,print_chat,"[AMX] You must point someone")
	 return PLUGIN_HANDLED
	}
	if (get_user_flags(aspec[id])&ADMIN_IMMUNITY){
		client_print(id,print_chat,"[AMX] The player has immunity")
		return PLUGIN_HANDLED
	}
	agot[id] = aspec[id]
	new bmenu[256], name[32]
	get_user_name(agot[id],name,32)
	format(bmenu,256,"\ySpec Menu: %s^n\w^n1. Kick^n2. Ban on 5 min.^n3. Slay^n^n0. Exit",name)
	show_menu(id,(1<<0)|(1<<1)|(1<<2)|(1<<9),bmenu)
	return PLUGIN_CONTINUE
}

public action_menu(id,key){
	if (!is_user_connected(agot[id])){
		client_print(id,print_chat,"[AMX] This client has already exit the server") 		
		return PLUGIN_CONTINUE
	}
	switch(key){
		case 0: server_cmd("kick # %d",get_user_userid(agot[id]))
		case 1: {
			new temp[32]
			get_user_authid(agot[id],temp,32)
			server_cmd("banid 5.0 %s kick",temp)
		}
		case 2: user_kill(agot[id])
	}
	return PLUGIN_CONTINUE
}

public plugin_init() {
	register_plugin("Spectating Admin","0.6","default")
	register_event("StatusValue","status_changed","b","1=2")
	register_menucmd(register_menuid("\ySpec Menu: "),1023,"action_menu")
	register_clcmd("say specmenu","do_action",ADMIN_LEVEL_A,"say specmenu")
	return PLUGIN_CONTINUE
}


