Raised This Month: $ Target: $400
 0% 

Getting Name in namechange


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shadow.hk
Senior Member
Join Date: Dec 2008
Location: WA, Australia
Old 07-03-2009 , 07:09   Getting Name in namechange
Reply With Quote #1

As the title says... How do I get the name when a client changes their name, so I can block it before it changes.
shadow.hk is offline
Send a message via MSN to shadow.hk
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 07-03-2009 , 07:25   Re: Getting Name in namechange
Reply With Quote #2

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_message(get_user_msgid("SayText"), "msg_namechange")
}

public 
msg_namechange()
{
    new 
msg[22];
    
get_msg_arg_string(2msgsizeof (msg));

    if (
equal(sz_msg"#Cstrike_Name_Change"))
    {
        return 
1;
    }

    return 
0
}

public 
client_infochanged(id)
{
    new 
oldnick[32];
    new 
newnick[32];

    
get_user_name(idoldnicksizeof (oldnick));
    
get_user_info(id"name"newnicksizeof (newnick));


Last edited by TheRadiance; 07-03-2009 at 07:30.
TheRadiance is offline
Send a message via ICQ to TheRadiance
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 07-03-2009 , 07:26   Re: Getting Name in namechange
Reply With Quote #3

PHP Code:
public client_infochanged(id)
{
    if(!
is_user_connected(id))
        return

    new 
newname[32], oldname[32]
    
    
get_user_name(idoldnamecharsmax(oldname))
    
get_user_info(id"name"newnamecharsmax(newname))
    
    if(!
equali(newnameoldname))
    {
        
//staff here...
    
}

__________________
alan_el_more is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 07-03-2009 , 08:05   Re: Getting Name in namechange
Reply With Quote #4

If i understand you right, you want to block name change
PHP Code:
register_forwardFM_ClientUserInfoChanged"FwdClientUserInfoChanged" );

public 
FwdClientUserInfoChangedidszBuffer ) {
    new 
szName32 ], szOldName32 ];
    
get_user_nameidszNamecharsmaxszName ) );
    
engfuncEngFunc_InfoKeyValueszBuffer"name"szOldNamecharsmaxszOldName ) );
    
    if( 
equaliszOldNameszName ) )
        return 
FMRES_IGNORED;
    
    
engfuncEngFunc_SetClientKeyValueidszBuffer"name"szName );
    
    return 
FMRES_SUPERCEDE;

__________________
xPaw is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode