/*  Various commands for DoD mod including force team change, class limiting, and 
 *  respawn time  */
/*$Id: plugin_DoD.sma,v 1.1  2/27/2002 SR71Goku ICQ: 146538715 Exp $*/
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
 
#define ACCESS_CHANGETEAM 8192
#define ACCESS_LIMITCLASS 8192
#define ACCESS_RESPAWNTIME 32
 
new STRING_VERSION[MAX_DATA_LENGTH] = "2.51.00"; 
 
public admin_ally(HLCommand,HLData,HLUserName,UserIndex) { 
	new Command[MAX_COMMAND_LENGTH]; 
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH]; 
	new TargetName[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	if (check_user(Data) == 1) {
		get_username(Data,TargetName,MAX_NAME_LENGTH);
		say_command(User,Command,TargetName);
		execclient(TargetName, "jointeam 1");
	} else {
		selfmessage("Unrecognized player: ");
		selfmessage(Data);
	}	
	return PLUGIN_HANDLED; 
} 
 
public admin_axis(HLCommand,HLData,HLUserName,UserIndex) { 
	new Command[MAX_COMMAND_LENGTH]; 
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
	new TargetName[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	if (check_user(Data) == 1) {
		get_username(Data,TargetName,MAX_NAME_LENGTH);
		say_command(User,Command,TargetName);
		execclient(TargetName, "jointeam 2"); 
	} else {
		selfmessage("Unrecognized player: ");
		selfmessage(Data);
	}
 
	return PLUGIN_HANDLED; 	 
}
 
public admin_alliesassault(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_limitalliesassault",Data);
	return PLUGIN_HANDLED;
}
 
public admin_allieslight(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_limitallieslight",Data);
	return PLUGIN_HANDLED;
}
 
public admin_alliesheavy(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_limitalliesheavy",Data);
	return PLUGIN_HANDLED;
}
 
public admin_alliessniper(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_limitalliessniper",Data);
	return PLUGIN_HANDLED;
}	
 
public admin_axislight(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_limitaxislight",Data);
	return PLUGIN_HANDLED;
}
 
public admin_axisheavy(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_limitaxisheavy",Data);
	return PLUGIN_HANDLED;
}
 
public admin_axisassault(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_limitaxisassault",Data);
	return PLUGIN_HANDLED;
}
 
public admin_axissniper(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_limitaxisniper",Data);
	return PLUGIN_HANDLED;
}
 
public admin_respawntime(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH]; 
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_COMMAND_LENGTH);
	convert_string(HLData,Data,MAX_DATA_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	execute_command(User,Command,"mp_respawntime",Data);
	return PLUGIN_HANDLED;
}
 
public plugin_init() { 
	plugin_registerinfo("Various DoD commands","Gives admins DoD specific commands.",STRING_VERSION); 
 
	plugin_registercmd("admin_ally","admin_ally",ACCESS_CHANGETEAM,"admin_ally: Changes target to ALLIE team."); 
	plugin_registercmd("admin_axis","admin_axis",ACCESS_CHANGETEAM,"admin_axis: Changes target to AXIS team. "); 
	plugin_registercmd("admin_allylight","admin_allieslight",ACCESS_LIMITCLASS,"admin_allylight <data>:  Limits the number of rifleman allowed on the the allies team"); 
	plugin_registercmd("admin_allyassault","admin_alliesassault",ACCESS_LIMITCLASS,"admin_allyassault <data>:  Limits the number of sargeants allowed on allies team"); 
	plugin_registercmd("admin_allyheavy","admin_alliesheavy",ACCESS_LIMITCLASS,"admin_allyheavy <data>:  Limits the number of support infantry allowed on allies team");
	plugin_registercmd("admin_allysniper","admin_alliessniper",ACCESS_LIMITCLASS,"admin_allysniper <data>:  Limits the number of snipers allowed on allies team"); 
	plugin_registercmd("admin_axislight","admin_axislight",ACCESS_LIMITCLASS,"admin_axislight <data>:  Limits the number of Grenadiers allowed on the axis team"); 
	plugin_registercmd("admin_axisassault","admin_axisassault",ACCESS_LIMITCLASS,"admin_axisassault <data>:  Limits the number of Unteroffiziers allowed on the axis team");
	plugin_registercmd("admin_axisheavy","admin_axisheavy",ACCESS_LIMITCLASS,"admin_axisheavy <data>:  Limits the number of Scharführers allowed on the axis team");
	plugin_registercmd("admin_axissniper","admin_axissniper",ACCESS_LIMITCLASS,"admin_axissniper <data>:  Limits the number of Scharfschuetzes allowed on the axis team");
	plugin_registercmd("admin_respawntime","admin_respawntime",ACCESS_RESPAWNTIME,"admin_respawntime <data>: The time it takes for a player to respawn after beign killed");
 
 
 
	return PLUGIN_CONTINUE;
}