•  
     

Bloquear mudar nome de jogador no Server - AMXX

Código: Selecionar todos

#include <amxmodx> 
#include <fakemeta> 
#define VERSION "0.1.0" 
public plugin_init() 
{ 
    register_plugin("One Name", VERSION, "ConnorMcLeod") 
    register_forward(FM_ClientUserInfoChanged, "ClientUserInfoChanged") 
} 
public ClientUserInfoChanged(id) 
{ 
    static const name[] = "name" 
    static szOldName[32], szNewName[32] 
    pev(id, pev_netname, szOldName, charsmax(szOldName)) 
    if( szOldName[0] ) 
    { 
        get_user_info(id, name, szNewName, charsmax(szNewName)) 
        if( !equal(szOldName, szNewName) ) 
        { 
            set_user_info(id, name, szOldName) 
            return FMRES_HANDLED 
        } 
    } 
    return FMRES_IGNORED 
} 


Ou

Código: Selecionar todos

#define PLUGIN_NAME "No Name Change"
#define PLUGIN_VERSION "0.1.1"
#define PLUGIN_AUTHOR "VEN"
#include <amxmodx>
#include <fakemeta>
new const g_reason[] = "[NNC] Sorry, name change isn't allowed on this server"
new const g_clcmd_template[] = "name ^"%s^"; setinfo name ^"%s^""
new const g_name[] = "name"
public plugin_init() {
	register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
	register_forward(FM_ClientUserInfoChanged, "fwClientUserInfoChanged")
}
public fwClientUserInfoChanged(id, buffer) {
	if (!is_user_connected(id))
		return FMRES_IGNORED
	static name[32], val[32]
	get_user_name(id, name, sizeof name - 1)
	engfunc(EngFunc_InfoKeyValue, buffer, g_name, val, sizeof val - 1)
	if (equal(val, name))
		return FMRES_IGNORED
	engfunc(EngFunc_SetClientKeyValue, id, buffer, g_name, name)
	client_cmd(id, g_clcmd_template, name, name)
	console_print(id, "%s", g_reason)
	return FMRES_SUPERCEDE
}