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(id, buffer) {
// 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(id, name, sizeof name - 1)
engfunc(EngFunc_InfoKeyValue, buffer, g_name, val, sizeof val - 1)
if (equal(val, name))
return FMRES_IGNORED
engfunc(EngFunc_SetClientKeyValue, id, buffer, g_name, name)
console_print(id, "%s", "cant changename!")
return FMRES_SUPERCEDE
}
block msg:
PHP Code:
public MessageNameChange(msgid, dest, receiver) {
static info[64];
get_msg_arg_string(2, info, sizeof(info) - 1);
if( !equali(info, "#Cstrike_Name_Change") ) return PLUGIN_CONTINUE;
static client;
for( new i = 3; i < 5; i++ ){
get_msg_arg_string(i, info, sizeof(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"