Raised This Month: $51 Target: $400
 12% 

Solved allow/Block changing nick


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 07-13-2017 , 08:13   allow/Block changing nick
Reply With Quote #1

how to do server will able to change his nick but player will not able to change his nick
server change his nick in client_putinserver after that block his nick so that he will not able to change his nick
PHP Code:
#include <amxmodx>
#include <fakemeta>

#define VERSION "0.1.0"

public plugin_init()
{
    
register_plugin("One Name"VERSION"ConnorMcLeod"
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged"
}

public 
client_putinserver(id)
{
//suppose here i am changing nick to indra after this nick changing should be block from clientUserInfoCHhanged
set_user_info(id"name""indra");  
}

public 
ClientUserInfoChanged(id

    static const 
name[] = "name" 
    
static szOldName[32], szNewName[32
    
pev(idpev_netnameszOldNamecharsmax(szOldName)) 
    if( 
szOldName[0] ) 
    { 
        
get_user_info(idnameszNewNamecharsmax(szNewName)) 
        if( !
equal(szOldNameszNewName) ) 
        { 
            
set_user_info(idnameszOldName
            return 
FMRES_HANDLED 
        

    } 
    return 
FMRES_IGNORED 

__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 07-14-2017 at 00:15.
indraraj striker is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-13-2017 , 09:38   Re: allow/Block changing nick
Reply With Quote #2

Are you saying that set_user_info() doesn't work? I didn't think that would trigger the event that you are blocking.
__________________
fysiks is offline
SpawnerF
Member
Join Date: Apr 2017
Location: Morocco
Old 07-13-2017 , 21:16   Re: allow/Block changing nick
Reply With Quote #3

what? You can't! because it's already blocked by returning FMRES_HANDLED and on each change name you call set_user_info again.

The only solution is to use a boolean.
__________________
XX was created just for giving evidence and not meant to damage public servers.
&We do not test on public servers.
Thank's.

Last edited by SpawnerF; 07-13-2017 at 21:45.
SpawnerF is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 07-14-2017 , 00:15   Re: allow/Block changing nick
Reply With Quote #4

Quote:
Originally Posted by SpawnerF View Post
what? You can't! because it's already blocked by returning FMRES_HANDLED and on each change name you call set_user_info again.

The only solution is to use a boolean.
Thanks for response fysiks & SpawnerF
solved by boolean
__________________
Thanks everyone. #miss_you_all
indraraj striker 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 20:30.


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