/*There are no bugs that i know of but email me if you find any.  Check out my other plugins, i go for plugins that have no likness to any
other
Made by: Bryan Clay																			*/
 
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "1.0.0.1";
 
/* from the old adminmod */
addstr(strBegin[],strEnd[]) {
	new i=0;
	new Length = strlen(strEnd);
	new j;
	while(strBegin[i]!=0) i++;
	for(j=0;j<Length;j++)
		strBegin[i+j]=strEnd[j];
	/* Null-terminate the string. */
	strBegin[i+j] = NULL_CHAR;
}
 
public admin_whatclass(UserIndex) {
	new numClass;
	new strClass[MAX_DATA_LENGTH];
	new strClassname[MAX_NAME_LENGTH];
	new limited = FALSE;
	new strMess[MAX_TEXT_LENGTH];
	addstr(strMess,"There may be: ");
	for(new i = 1;i<10;i++) {
		strClassname = "";
		if(i==1) { addstr(strClassname,"cr_hwguy"); }
		if(i==2) { addstr(strClassname,"cr_pyro"); }
		if(i==3) { addstr(strClassname,"cr_sniper"); }
		if(i==4) { addstr(strClassname,"cr_medic"); }
		if(i==5) { addstr(strClassname,"cr_demoman"); }
		if(i==6) { addstr(strClassname,"cr_scout"); }
		if(i==7) { addstr(strClassname,"cr_engineer"); }
		if(i==8) { addstr(strClassname,"cr_soldier"); }
		if(i==9) { addstr(strClassname,"cr_spy"); }
		numClass = getvar(strClassname);
		if(numClass!=0) {
			limited = TRUE;
			if(numClass==-1) { addstr(strMess,"No"); }
			if(numClass>0) { 
				numtostr(numClass,strClass);
				addstr(strMess,strClass);
			}
			strtrim(strClassname,"cr_",0);
			addstr(strMess," ");
			addstr(strMess,strClassname);
			addstr(strMess,"s.");
		}
	}
	if(limited==FALSE) { addstr(strMess,"No Class Limitations"); }
	say(strMess);
	return PLUGIN_HANDLED;
}
 
public plugin_init() {
	plugin_registerinfo("What class can I be?","Displays which classes are limited",STRING_VERSION);  
	plugin_registercmd("admin_whatclass","admin_whatclass",ACCESS_ALL,"admin_whatclass : Says the class limitations on a server");
	return PLUGIN_CONTINUE;
}