
/* AMX Mod script.
*
* Adminwho
*  by Namralkeeg
*
* Instructions:
*  This plugin lists all the people who currently have admin,
*  and those who have reserved slots.
*
*
*/

new ADMINS_ONLY = 1

#include <amxmod> /* read this file to learn the functions */

public admin_who(id)
{
	new flags

	if(ADMINS_ONLY)
		flags = get_user_flags(id) /* Make sure only admins can use this. */
	else
		flags = 1 /* Anyone can use this command. */

	if (flags)
	{
		client_print(id,print_console,"--- Current Admins ---")
		new players[32], inum, name[32]
		get_players(players,inum)
		new i
		for(i = 0; i < inum; i++)
		{
			if (get_user_flags(players[i])) /* if any flags set */
			{
				get_user_name(players[i],name,32)
				client_print(id,print_console,"%s",name)
			}
		}

		client_print(id,print_console,"^n--- Reserved Slots ---")
		for(i = 0; i < inum; i++)
		{
			if (get_user_flags(players[i])&ADMIN_RESERVATION) /* if reservation flags set */
			{
				get_user_name(players[i],name,32)
				client_print(id,print_console,"%s",name)
			}
		}
	}
	else
	{
		client_print(id,print_console,"^n[AMX] You are not logged as admin or user with privileges")
	}

	return PLUGIN_CONTINUE
}

public plugin_init()
{
	register_plugin("Admin Who","0.61","default")
	register_clcmd("amx_who","admin_who",0,"amx_who")
	return PLUGIN_CONTINUE
}

