AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved allow/Block changing nick (https://forums.alliedmods.net/showthread.php?t=299394)

indraraj striker 07-13-2017 08:13

allow/Block changing nick
 
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 



fysiks 07-13-2017 09:38

Re: allow/Block changing nick
 
Are you saying that set_user_info() doesn't work? I didn't think that would trigger the event that you are blocking.

SpawnerF 07-13-2017 21:16

Re: allow/Block changing nick
 
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.

indraraj striker 07-14-2017 00:15

Re: allow/Block changing nick
 
Quote:

Originally Posted by SpawnerF (Post 2535144)
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


All times are GMT -4. The time now is 22:45.

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