/* This plugin contains commands specific for SI, converted from plugin_TFC, special thanks to darope for the code */
 
/* $Id: plugin_SI.sma,v 1.0.0.0 6/25/2003 21:30 Lightning Blue $ */
 
#include <core>
#include <string>
#include <admin>
#include <adminlib>
 
#define ACCESS_CHANGE_TEAM 8192
 
new STRING_VERSION[] = "2.50.1";
 
 
/* admin_blue <target>
   admin_green <target>
   admin_bindvote <target>
   admin_popoff <target> */
public admin_changeteam(HLCommand,HLData,HLUserName,UserIndex) {
	new Command[MAX_COMMAND_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new TargetName[MAX_NAME_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLCommand,Command,MAX_NAME_LENGTH);
	convert_string(HLData,Data,MAX_NAME_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);
		if (check_immunity(TargetName) != 0) {
			snprintf(Text, MAX_TEXT_LENGTH, "Laf. You can't do stuff to %s, you silly bear.", TargetName);
			messageex(User, Text, print_chat);
		} else if (streq(Command,"admin_blue")==1) {
			execclient(TargetName, "changeteam 2");
		} else if (streq(Command,"admin_green")==1) {
			execclient(TargetName, "changeteam 1");
		} else if (streq(Command,"admin_bindvote")==1) {
			execclient(TargetName, "bind v vote");
		} else if (streq(Command,"admin_popoff")==1) {
			execclient(TargetName, "cl_tutorial 0");
		}
	} else {
		selfmessage("Unrecognized player: ");
		selfmessage(Data);
	}
 
	return PLUGIN_HANDLED;
}
 
 
public plugin_init() {
	plugin_registerinfo("Admin SI Plugin","Commands specific to the Science and Industry mod.",STRING_VERSION);
 
	plugin_registercmd("admin_blue","admin_changeteam",ACCESS_CHANGE_TEAM,"admin_blue <target>: Changes target to the blue team.");
	plugin_registercmd("admin_green","admin_changeteam",ACCESS_CHANGE_TEAM,"admin_green <target>: Changes target to the green team.");
	plugin_registercmd("admin_bindvote","admin_changeteam",ACCESS_CHANGE_TEAM,"admin_bindvote <target>: Binds the vote to the v key for the target.");
	plugin_registercmd("admin_popoff","admin_changeteam",ACCESS_CHANGE_TEAM,"admin_popoff <target>: turns help popups off for the target.");
 
	return PLUGIN_CONTINUE;
}