#include <amxmodx>

#define PLUGIN "Block Change Name"
#define VERSION "1.0"
#define AUTHOR "DJ_WEST"

#define MAX_PLAYERS 32

new g_SayText

public plugin_init() 
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	g_SayText = get_user_msgid("SayText")
	register_message(g_SayText, "Block_NameChange")
}

public Block_NameChange(msgid, msgdest, msgent)
{
	new s_MessageType[32]
	get_msg_arg_string(2, s_MessageType, charsmax(s_MessageType))
	
	if (equal(s_MessageType, "#Cstrike_Name_Change"))
	{
		client_print(msgent, print_console, "Sorry, change name not allowed!")
		return PLUGIN_HANDLED
	}
	
	return PLUGIN_CONTINUE
}

public client_infochanged(id)
{
	if (is_user_connected(id))
	{
		new s_NewName[32], s_OldName[32]
		
		get_user_info(id, "name", s_NewName, charsmax(s_NewName))
		get_user_name(id, s_OldName, charsmax(s_OldName))
		
		if (!equali(s_OldName, s_NewName))
			set_user_info(id, "name", s_OldName)
	}
}
