Raised This Month: $ Target: $400
 0% 

Other way to block changing name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-05-2011 , 15:10   Re: Other way to block changing name
Reply With Quote #1

PHP Code:
public plugin_init()
{
    
register_forward(FM_ClientUserInfoChanged"ClientUserInfoChanged")
}

public 
ClientUserInfoChanged(id)
{
    static const 
name[] = "name"
    
new szOldName[32], szNewName[32]
    
pev(idpev_netnameszOldNamecharsmax(szOldName))
    if( 
szOldName[0] )
    {
        
get_user_info(idnameszNewNamecharsmax(szNewName))
        if( !
equal(szOldNameszNewName) )
        {
            
// name change, to block or change use set_user_info and return FMRES_HANDLED (don't need to superceede)
        
}
    }
    else if( 
get_user_info(idnameszNewNamecharsmax(szNewName)) )
    {
        
// first time client name is taken in account
        // to change, use set_user_info and return FMRES_HANDLED (don't need to superceede)
    
}
    return 
FMRES_IGNORED

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-05-2011 at 15:11.
ConnorMcLeod is offline
m0skVi4a
Senior Member
Join Date: May 2011
Location: Rousse, Bulgaria
Old 11-05-2011 , 15:33   Re: Other way to block changing name
Reply With Quote #2

Thanks
I changed it to
PHP Code:
public NoNameChange(id
{
    static const 
name[] = "name"
    
new szOldName[32], szNewName[32]
    
pev(idpev_netnameszOldNamecharsmax(szOldName))
    if(
szOldName[0])
    {
        
get_user_info(idnameszNewNamecharsmax(szNewName))
        if(!
equal(szOldNameszNewName))
        {
            if(
is_logged[id])
            {
                
set_user_info(idnameszOldName)
                
client_printcolor(id"%L"LANG_SERVER"NAME_CHANGE"prefix)
                return 
FMRES_HANDLED
            
}
            else if(
is_registerd[id])
            {
                
is_registerd[id] = false
                remove_task
(id)
                return 
FMRES_HANDLED
            
}            
        }
    }
    return 
FMRES_IGNORED

Tomorrow i will write the description and i will post the plugin in the forum
m0skVi4a is offline
Send a message via Skype™ to m0skVi4a
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-05-2011 , 15:37   Re: Other way to block changing name
Reply With Quote #3

PHP Code:
            else if(is_registerd[id])
            {
                
is_registerd[id] = false
                remove_task
(id)
                return 
FMRES_HANDLED
            

You don't need to return HANDLED there since you changed nothing except plugin internal datas.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 01:29.


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