Set to 30sec, change it for your needs.
PHP Code:
#include <amxmodx>
#define MAX_PLAYERS 32
new bool:g_bForceChange[MAX_PLAYERS+1]
new g_iCantChange[MAX_PLAYERS+1]
new g_pCvarChangeTime
public plugin_init()
{
register_plugin("One Name", "1.0", "Amxx Community")
g_pCvarChangeTime = register_cvar("amx_change_name", "30")
register_message(get_user_msgid("SayText") , "Message_SayText")
}
public client_putinserver( id )
{
g_iCantChange[id] = get_systime() + get_pcvar_num(g_pCvarChangeTime)
}
public Message_SayText(msg_id, msg_dest, msg_entity)
{
new szArg[21]
get_msg_arg_string(2, szArg, charsmax(szArg))
if( Equal(szArg, "#Cstrike_Name_Change") && g_iCantChange[get_msg_arg_int(1)] < get_systime())
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public client_infochanged(id)
{
if( g_iCantChange[id] > get_systime() )
{
return
}
if(g_bForceChange[id])
{
g_bForceChange[id] = false
return
}
if(is_user_connected(id))
{
static szNewName[32], szOldName[32]
static const szNameInfo[] = "name"
get_user_info(id, szNameInfo, szNewName, charsmax(szNewName))
get_user_name(id, szOldName, charsmax(szOldName))
if( !Equal(szOldName, szNewName) )
{
g_bForceChange[id] = true
client_print(id, print_chat, "** You are not allowed to change your name")
set_user_info(id, szNameInfo, szOldName)
}
}
}
Equal(const szA[], const szB[])
{
static a, i ; i = 0
a = szA[i]
do
{
if( a != szB[i])
return 0
}
while( (a = szA[++i]) )
return 1
}
__________________