AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help to solve problem with FM_ClientUserInfoChanged (https://forums.alliedmods.net/showthread.php?t=296253)

ZASTRELIS 04-16-2017 02:06

Need help to solve problem with FM_ClientUserInfoChanged
 
Code:
public fwClientUserInfoChanged(id, buffer) {     if (!is_user_connected(id))         return FMRES_IGNORED;     static name[32], val[32];     get_user_name(id, name, sizeof name - 1)         engfunc(EngFunc_InfoKeyValue, buffer, "name", val, sizeof val - 1)         if (equal(val, name))         return FMRES_IGNORED;         if(i_NickNamer[id])     {         if(isNickChangeAccepted(val))         {             if(task_exists(NICK_NAMER + id))                 remove_task(NICK_NAMER + id)                         i_NickNamer[id] = 0;                         set_user_info(id, "name", val);             engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", val);                         set_task(3.0, "pub_NnChRspwner", id);             client_print_color(id, -1, "%s %L", PREFIX, LANG_PLAYER, "NICK_WAIT_RESPAWN", 3.0);                         return FMRES_SUPERCEDE;         }     }         else if(!isNickChangeAccepted(val) && isNickChangeAccepted(name))         NnChRspwner(id, 1);         return FMRES_IGNORED; }

When player changed nickname as !isNickChangeAccepted(val) && isNickChangeAccepted(name) msg in chat section about that user changed its nick not bloked.

I tried many operation with this block, but noting can't block default chat msg. I think that I can use #MSG hook and block it, but I want to know why fwClientUserInfoChanged can't block this msg?
Code:
else if(!isNickChangeAccepted(val) && isNickChangeAccepted(name))     NnChRspwner(id, 1);

Other, it's blocked any msgs about name change in 1st section of this: if(i_NickNamer[id])

P.S. i think this's engine feature, becouse it happens only when player in alive mode. And otherwise it not send any msg in chat when client changed its name when in dead state

ZASTRELIS 04-16-2017 02:41

Re: Need help to solve problem with FM_ClientUserInfoChanged
 
LOL. SOLVED.

Code:
else if(!isNickChangeAccepted(val) && isNickChangeAccepted(name)) {     //client_print_color(id, -1, "New: %s || Old: %s", val, name);     engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", name);     NnChRspwner(id, 1);     engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", val);     return FMRES_SUPERCEDE; }

PRoSToTeM@ 04-16-2017 15:29

Re: Need help to solve problem with FM_ClientUserInfoChanged
 
Don't use FMRES_SUPERCEDE in ClientUserInfoChanged, its buggy.


All times are GMT -4. The time now is 17:49.

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