/*****************************************************************
                    Admin Namechange Plugin
                       By: -=AS1=-MjrStryker
******************************************************************/
 
/*
*Comments:
*
*This script contains the command for altering a user's name via
*AdminMod. It will not work on anyone with admin immunity but
*may work on llama's without altering the llama flag.
*
*Commands registered by this plugin:
*
*admin_name
*
*Usage:
*
*To change a person's name type
*admin_name followed by the Target,
*and the new name to change to.
*
*/
 
#include <core>
#include <string>
#include <admin>
#include <adminlib>
#include <console>
 
/* admin_name <target> <target's new name> */
public admin_name(HLCommand,HLData,HLUserName,userindex) {
	new Command[MAX_COMMAND_LENGTH];
	new User[MAX_NAME_LENGTH];
	new Data[MAX_DATA_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	new TargetNName[MAX_NAME_LENGTH];
	new Cmd[MAX_COMMAND_LENGTH];
 
	convert_string(HLCommand,Command,MAX_NAME_LENGTH);
	convert_string(HLData,Data,MAX_NAME_LENGTH);
	convert_string(HLUserName,User,MAX_NAME_LENGTH);
	strsep(Data," ",Data,MAX_NAME_LENGTH,TargetNName,MAX_NAME_LENGTH);
	if(check_user(Data)==1) {
		if (check_immunity(Data) != 0) {
			snprintf(Cmd,MAX_COMMAND_LENGTH,"name %s",TargetNName);
			execclient(Data,Cmd);
		} else {
			snprintf(Cmd,MAX_TEXT_LENGTH,"Laf, you can't change %s's name, silly bear.",Data);
			selfmessage(Cmd);
		}
	} else {
		snprintf(Text,MAX_TEXT_LENGTH,"Unrecognized User.");
		selfmessage(Text);
	}	
	return PLUGIN_HANDLED;
}
 
public plugin_init() {
	plugin_registerinfo("Admin Name Alteration Plugin","Command for altering client's names.","Version BASIC");
 
	plugin_registercmd("admin_name","admin_name",8192,"admin_name <target> <target's new name> | Changes the name of <target> to <target's new name>. ");
}