Code:
#include <amxmodx>
#if AMXX_VERSION_NUM < 180
#define charsmax(%1) (sizeof(%1)-1)
#endif
#define MAX_PLAYERS 32
new const g_NameChange[] = "#Cstrike_Name_Change"
new const g_NameInfo[] = "name"
new const g_NotAllowed[] = "** You are not allowed to change your name"
new bool:dontcheck[MAX_PLAYERS+1]
public plugin_init() {
register_plugin("One Name", "1.0", "default")
register_message(get_user_msgid("SayText") , "msg_SayText")
}
public msg_SayText(msg_id, msg_dest, msg_entity) {
new arg2[32]
get_msg_arg_string(2, arg2, charsmax(arg2))
if(equal(arg2, g_NameChange))
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public client_infochanged(id) {
if(dontcheck[id])
{
dontcheck[id] = false
}
else if(is_user_connected(id))
{
new newname[32], oldname[32]
get_user_info(id, g_NameInfo, newname, charsmax(newname))
get_user_name(id, oldname, charsmax(oldname))
if(!equal(oldname,newname))
{
dontcheck[id] = true
client_print(id, print_chat, g_NotAllowed)
set_user_info(id, g_NameInfo, oldname)
}
}
}