Raised This Month: $32 Target: $400
 8% 

Restrict changename [unnamed error]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tristanoff
Junior Member
Join Date: Oct 2011
Old 10-04-2011 , 14:45   Restrict changename [unnamed error]
Reply With Quote #1

Hi, im triying to block changename & message so i have this:
PHP Code:
register_message(get_user_msgid("SayText"), "MessageNameChange");
register_forward(FM_ClientUserInfoChanged"fwClientUserInfoChanged")
[...] 
block changename:
PHP Code:
public fwClientUserInfoChanged(idbuffer) {
    
// can_proced_to_tag[id] it's a flag...
    
if (!is_user_connected(id) || can_proced_to_tag[id]){
        
can_proced_to_tag[id] = false;
        return 
FMRES_IGNORED
    
}

    static 
name[32], val[32]
    
get_user_name(idnamesizeof name 1)
    
engfunc(EngFunc_InfoKeyValuebufferg_namevalsizeof val 1)
    if (
equal(valname))
        return 
FMRES_IGNORED

    engfunc
(EngFunc_SetClientKeyValueidbufferg_namename)
    
console_print(id"%s""cant changename!")

    return 
FMRES_SUPERCEDE

block msg:
PHP Code:
public MessageNameChange(msgiddestreceiver) {     
    static 
info[64];     
    
get_msg_arg_string(2infosizeof(info) - 1);         
    if( !
equali(info"#Cstrike_Name_Change") ) return PLUGIN_CONTINUE;  
    
    static 
client;         
    for( new 
35i++ ){         
        
get_msg_arg_string(iinfosizeof(info) - 1);         
        
client get_user_index(info);                 
        if( 
is_user_connected(client) ) break;                
        
client 0;     
        }         
 
    return 
PLUGIN_HANDLED ;

 } 
Ok that's work ( i think ) .. so i have too some like this:
PHP Code:
public set_tag(playerid groupid){
    new 
name[28] , newname[33];
    
    
get_user_name(playerid,name,27)
    
copy(old_names[playerid],27,name)
    

    
formatex(newname,32,"%s.%s",group_tag[groupid],name)
    
    
can_proced_to_tag[playerid] = true;
    
client_cmd(playerid,"name ^"%s^";setinfo name ^"%s^"",newname,newname)
    
can_proced_to_tag[playerid] = true;
    
set_user_info(playerid,"name",newname)
    
    

so.. the player can change his name if can_proced_to_tag[id] its true .. and this work but the problem it's when changemap .. the player's name has set to "unnamed,unnamed(1)...etc" and when they are connecting get some "overflow"

Last edited by tristanoff; 10-04-2011 at 18:59.
tristanoff is offline
keyblade
Member
Join Date: Nov 2010
Location: China
Old 10-05-2011 , 02:04   Re: Restrict changename [unnamed error]
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>
 
#define PLUGIN "TEST"
#define VERSION "1.0"
#define AUTHOR "Ice-Action |#KeyBlade"
 
new bool:can_proced_to_tag[33]
 
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_ClientUserInfoChanged"InfoChanged"1)
    
register_message(get_user_msgid("SayText"), "Message_SayText")
}
 
public 
Message_SayText(msg_idmsg_destmsg_entity)
{
    new 
Marg[32]
    
get_msg_arg_string(2Marg31)
    if( 
equal(Marg"#Cstrike_Name_Change") )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}
public 
InfoChanged(id)
{
    if( 
is_user_connected(id) && !can_proced_to_tag[id] )
    {
        new 
pname[32], oldname[32]
        
pev(idpev_netnameoldname31)
        
get_user_info(id"name"pname31)
        if( !
equali(pnameoldname) )
        {
            
set_user_info(id"name"oldname)
        }
    }

tested
keyblade is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 10-05-2011 , 07:02   Re: Restrict changename [unnamed error]
Reply With Quote #3

There are serval plugins that do what you need:

http://forums.alliedmods.net/showthread.php?p=240578
http://forums.alliedmods.net/showthread.php?p=221805
http://forums.alliedmods.net/showthread.php?p=154865

And that's what I found in a few seconds, there may be more.
__________________
Hunter-Digital is offline
tristanoff
Junior Member
Join Date: Oct 2011
Old 10-05-2011 , 15:10   Re: Restrict changename [unnamed error]
Reply With Quote #4

Quote:
Originally Posted by keyblade View Post
PHP Code:
#include <amxmodx>
#include <fakemeta>
 
#define PLUGIN "TEST"
#define VERSION "1.0"
#define AUTHOR "Ice-Action |#KeyBlade"
 
new bool:can_proced_to_tag[33]
 
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_ClientUserInfoChanged"InfoChanged"1)
    
register_message(get_user_msgid("SayText"), "Message_SayText")
}
 
public 
Message_SayText(msg_idmsg_destmsg_entity)
{
    new 
Marg[32]
    
get_msg_arg_string(2Marg31)
    if( 
equal(Marg"#Cstrike_Name_Change") )
    {
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE
}
public 
InfoChanged(id)
{
    if( 
is_user_connected(id) && !can_proced_to_tag[id] )
    {
        new 
pname[32], oldname[32]
        
pev(idpev_netnameoldname31)
        
get_user_info(id"name"pname31)
        if( !
equali(pnameoldname) )
        {
            
set_user_info(id"name"oldname)
        }
    }

tested
It's the same.. i got "unnamed" in players
tristanoff is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-05-2011 , 15:23   Re: Restrict changename [unnamed error]
Reply With Quote #5

This is what you need : http://forums.alliedmods.net/showpos...27&postcount=3
Don't need to register message.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
keyblade
Member
Join Date: Nov 2010
Location: China
Old 10-05-2011 , 22:02   Re: Restrict changename [unnamed error]
Reply With Quote #6

Quote:
Originally Posted by tristanoff View Post
It's the same.. i got "unnamed" in players
...but i didn't get it...maybe you can try what digital posted in #3
keyblade is offline
tristanoff
Junior Member
Join Date: Oct 2011
Old 10-06-2011 , 11:24   Re: Restrict changename [unnamed error]
Reply With Quote #7

Fixed, thanks bro!!
tristanoff is offline
Reply


Thread Tools
Display Modes

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:45.


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