/*Quit Plugin*/
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
 
#define ACCESS_SLAY 128
 
 
new STRING_VERSION[MAX_DATA_LENGTH] = "1.1.1";
 
public admin_quit(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_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);
		if(check_immunity(TargetName)!=0) {
			snprintf(Text, MAX_TEXT_LENGTH, "You can not close the HL of %s.", TargetName);
			selfmessage(Text);
		} else {				
			execclient(TargetName,"quit");
			snprintf(Text, MAX_TEXT_LENGTH, "Hl of %s closed succesfully.", TargetName);			
			selfmessage(Text);
		}
	} else {
		selfmessage("Unknown player: ");
		selfmessage(Data);
	}
	return PLUGIN_HANDLED;
}
 
 
public plugin_init() {
	plugin_registerinfo("Admin Quit Plugin","Closes the HL of target player",STRING_VERSION);
	plugin_registercmd("admin_quit","admin_quit",ACCESS_SLAY,"admin_quit <targetname>: Closes the HL of target player.");
 
	return PLUGIN_CONTINUE;	
}