Jump to content
Sign in to follow this  
Mero^

Cerere Plugin

Recommended Posts

Nume : anti change name

Versiune : The newest.

Descriere detaliata : I need something that prevents players from changing their names in Server

something like this 2018-11-12-20-46-55.png 

 

Share this post


Link to post
Share on other sites
Spoiler

#include <amxmodx> 
#include <fakemeta> 
#include <amxmisc>

#define VERSION "0.1.0" 

new g_allowed[33]

public plugin_init() 

    register_plugin("One Name", VERSION, "ConnorMcLeod") 
    register_forward(FM_ClientUserInfoChanged, "ClientUserInfoChanged") 
}

public client_connect(id)
{
    g_allowed[id] = 0
}

public client_command(id)  
{    
    static szCommand[ 33 ] , name[33]
    read_argv( 0, szCommand, 32 ) 
    read_argv( 1, name, 32 ) 

    if( contain( szCommand, "rcon amx_nick" )) 
    { 
        new player = cmd_target(id, name, 8)
        g_allowed[player] = 1
    }          
     
    return PLUGIN_CONTINUE; 
}  

public ClientUserInfoChanged(id) 

    if( is_user_admin( id ) )
    {
        return FMRES_IGNORED
    }
    
    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) ) 
        {
            if(g_allowed[id])
            {
                g_allowed[id] = 0
                return FMRES_IGNORED
            }
                
            set_user_info(id, name, szOldName) 
            return FMRES_HANDLED 
        } 
    } 
    return FMRES_IGNORED
}  

or 

https://forums.alliedmods.net/showthread.php?t=302005

Share this post


Link to post
Share on other sites

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Block_name_change"
#define VERSION "1.0"
#define AUTHOR "adry"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_message(get_user_msgid("SayText"), "message")
}

public message()
{
    new arg[32]
    get_msg_arg_string(2, arg, 31)
    if(containi(arg,"name")!=-1)
    {
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}
public client_infochanged(id)
{
    new newname[32],oldname[32]
    get_user_info(id, "name", newname,31)
    get_user_name(id,oldname,31)
    if(!is_user_connected(id) || is_user_bot(id)) return PLUGIN_CONTINUE
    if(!equali(newname, oldname))
    {
        set_user_info(id,"name",oldname)
        client_print(id , print_chat , "[ZP] Nu este permisa schimbarea numelui pe server!")
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}

Share this post


Link to post
Share on other sites

This original code

Quote

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "ANTI Change Name"
#define VERSION "0.1beta"
#define AUTHOR "F.E.A.R.&Many"


public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    register_forward(FM_ClientUserInfoChanged, "ClientUserInfoChanged") 
}

public message()
{
    new arg[32]
    get_msg_arg_string(2, arg, 31)
    if(containi(arg,"name")!=-1)
    {
        return PLUGIN_HANDLED
    }
    return PLUGIN_CONTINUE
}
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) 
        client_print(id , print_chat , "[AMXX] Nu este permisa schimbarea numelui pe server!")
        return PLUGIN_HANDLED;
        } 
    } 
    return FMRES_IGNORED 
}

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×