Raised This Month: $ Target: $400
 0% 

Block name command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghostdlr
Senior Member
Join Date: Aug 2010
Old 08-20-2010 , 07:16   Block name command
Reply With Quote #1

I don't want to allow players to change their name .

Registering the command and return PLUGIN_HANDLED seems to be working for other commands , like "say" , but with "name" it doesn't .

Any ideas ?
ghostdlr is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-20-2010 , 07:23   Re: Block name command
Reply With Quote #2

First of all http://forums.alliedmods.net/showthread.php?t=134274
Then
PHP Code:
#include < amxmodx >
#include < amxmisc >

public plugin_init( )
{
    
register_messageget_user_msgid"SayText" ), "MessageSayText" );
}

public 
client_infochangedclient )
{
    static const 
name[ ] = "name";
    
    static 
szNewName32 ], szOldName32 ];
    
get_user_infoclientnameszNewName31 );
    
get_user_nameclientszOldName31 );
    
    if( !
equalszNewNameszOldName ) )
    {
        
set_user_infoclientnameszOldName );
    }
}

public 
MessageSayTextiMsgIdiDestiReceiver )
{
    static const 
Cstrike_Name_Change[ ] = "#Cstrike_Name_Change";
    
    static 
szMessagesizeofCstrike_Name_Change ) + ];
    
get_msg_arg_string2szMessagesizeofszMessage ) - );
    
    return 
equalszMessageCstrike_Name_Change ) ? PLUGIN_HANDLED PLUGIN_CONTINUE;

SpeeDeeR is offline
ghostdlr
Senior Member
Join Date: Aug 2010
Old 08-20-2010 , 07:52   Re: Block name command
Reply With Quote #3

Doesn't work properly . After I connect , my name is "unnamed" .

I want to keep the players name when they connect but not allow them to change it in game .
ghostdlr is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 08-20-2010 , 07:56   Re: Block name command
Reply With Quote #4

It actually blocks the name change and doesnt rename anything.
SpeeDeeR is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-20-2010 , 08:00   Re: Block name command
Reply With Quote #5

PHP Code:
register_forward(FM_ClientUserInfoChanged"Fwd_ClientInfoChanged")

[ ... ]



public 
Fwd_ClientInfoChanged(idbuffer)
{
    if (!
is_user_connected(id))
        return 
FMRES_IGNORED;
    
    static 
val[32];
static 
name[33]
get_user_name(idnamecharsmax(name))
    
    
engfunc(EngFunc_InfoKeyValuebuffer"name"valsizeof val 1);
    
    if(
equal(valname))
        return 
FMRES_IGNORED;

    
engfunc(EngFunc_SetClientKeyValueidbuffer"name"name);
    
    
client_cmd(id"name ^"%s^"; setinfo name ^"%s^"",namename);
    
    
    
    return 
FMRES_SUPERCEDE;

__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
ghostdlr
Senior Member
Join Date: Aug 2010
Old 08-20-2010 , 08:07   Re: Block name command
Reply With Quote #6

Quote:
Originally Posted by lucas_7_94 View Post
PHP Code:
register_forward(FM_ClientUserInfoChanged"Fwd_ClientInfoChanged")

[ ... ]



public 
Fwd_ClientInfoChanged(idbuffer)
{
    if (!
is_user_connected(id))
        return 
FMRES_IGNORED;
    
    static 
val[32];
static 
name[33]
get_user_name(idnamecharsmax(name))
    
    
engfunc(EngFunc_InfoKeyValuebuffer"name"valsizeof val 1);
    
    if(
equal(valname))
        return 
FMRES_IGNORED;

    
engfunc(EngFunc_SetClientKeyValueidbuffer"name"name);
    
    
client_cmd(id"name ^"%s^"; setinfo name ^"%s^"",namename);
    
    
    
    return 
FMRES_SUPERCEDE;

Do I need a particular library to compile this ?
ghostdlr is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-20-2010 , 08:12   Re: Block name command
Reply With Quote #7

fakemeta.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
ghostdlr
Senior Member
Join Date: Aug 2010
Old 08-20-2010 , 08:15   Re: Block name command
Reply With Quote #8

It works .
Thanks
ghostdlr is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-20-2010 , 08:44   Re: Block name command
Reply With Quote #9

np.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
mrgregory
New Member
Join Date: Jan 2011
Old 03-09-2011 , 22:07   Re: Block name command
Reply With Quote #10

lucas794 can u tell me how to compile your script?
mrgregory 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 21:53.


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