Hi,
I have this function , using which you can change player name to the one you want , also blocking name changing for players. It works also for dead people , what is pretty handy for me, but causes server lags , chokes , sometimes (not always ) even svc_bad's. Is there a better solution for the aim I want, or can my function be optimised in any ways? Thank You.
Working, but still laggy solution:
PHP Code:
public plugin_init() {
register_plugin("test","0.1","m0v3")
register_forward(FM_ClientUserInfoChanged, "forward_client_userinfochanged")
}
public forward_client_userinfochanged(id, buffer) {
if ( !IsConnected[id] )
return FMRES_IGNORED
static val[32];
static name[33];
static neimas[36];
formatex(neimas, charsmax(neimas), "[%03i].%s", SKILL, player_name[id])
get_user_name(id, name, charsmax(name))
engfunc(EngFunc_InfoKeyValue, buffer, "name", val, sizeof val - 1);
if ( equal(name , neimas) && equal(val , neimas) )
return FMRES_IGNORED
engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", neimas);
engclient_cmd( id , "name ^"%s^"" , player_name[id] );
return FMRES_SUPERCEDE
}