Raised This Month: $ Target: $400
 0% 

Restrict changename [unnamed error]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 23:42.


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