/*
 
Date: April 4, 2001
Author: Ratty <adminmod@rat.org>
Command: admin_who
 
admin_who will print which users have reserved slot access, as well as "admin"
access.  This came about when after starting to add slots for all the
regulars, I, along with everyone else, wanted to know who else had slots.
 
Think of it like a MUD/MUCK typing 'wizzes', or in IRC seeing that @ sign next
to people's nicks so you know who had access in case you needed something.
 
Literally it counts a moderator as anyone who has ADMIN_BAN acccess,
and "reserved slots" people are anyone with a reserved spot.
 
*/
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.50.1";
 
public admin_who(HLCommand,HLData,HLUserName,UserIndex) {
	new i;
	new maxplayers = maxplayercount();
	new Name[MAX_NAME_LENGTH];
	new SessionID;
	new Team;
//	new Text[MAX_TEXT_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new WONID;
	new Command[MAX_COMMAND_LENGTH];
 
        convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
        convert_string(HLData,Data,MAX_DATA_LENGTH);
        convert_string(HLUserName,User,MAX_NAME_LENGTH);
 
        selfmessage( "-------- Moderators: ------------");
	for(i=1; i<=maxplayers; i++) {
		strinit(Name);
		if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
			if(access(ACCESS_BAN,Name)!=0) {
				selfmessage(Name);
			}
		}
	}
 
        selfmessage( "-------- Reserved slots: --------");
	for(i=1; i<=maxplayers; i++) {
		strinit(Name);
		if(playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team)==1) {
			if(access(ACCESS_RESERVE_SPOT,Name)!=0 && access(ACCESS_BAN,Name)==0) {
				selfmessage(Name);
			}
		}
	}
	log_command(User,Command,Data);
	return PLUGIN_HANDLED;
}
 
 
public plugin_init() {
	plugin_registerinfo("Ratty's admin_who Plugin","admin_who",STRING_VERSION);
	plugin_registercmd("admin_who","admin_who",ACCESS_ALL,"admin_who: Shows who has access above normal.");
	return PLUGIN_CONTINUE;
}