AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [L4D2] How can I hook and block usermsg "PZDmgMsg" for only certain clients? (https://forums.alliedmods.net/showthread.php?t=346981)

little_froy 03-25-2024 15:29

[L4D2] How can I hook and block usermsg "PZDmgMsg" for only certain clients?
 
as the title.
I can't modify the "players" in https://sm.alliedmods.net/new-api/usermessages/MsgHook

HarryPotter 03-26-2024 11:31

Re: [L4D2] How can I hook and block usermsg for only certain clients?
 
Quote:

Originally Posted by little_froy (Post 2820095)
as the title.
I can't modify the "players" in https://sm.alliedmods.net/new-api/usermessages/MsgHook

You can see this as an example: https://forums.alliedmods.net/showthread.php?t=339035

PHP Code:


g_umFade 
GetUserMessageId("Fade");
HookUserMessage(g_umFadeFadeHooktrue);

Action FadeHook(UserMsg msg_idBfRead bf, const int[] playersint playersNumbool reliablebool init)
{
    
int client players[0];
    ......
    return 
Plugin_Handled;



little_froy 03-26-2024 16:59

Re: [L4D2] How can I hook and block usermsg for only certain clients?
 
Quote:

Originally Posted by HarryPotter (Post 2820134)
You can see this as an example: https://forums.alliedmods.net/showthread.php?t=339035

PHP Code:


g_umFade 
GetUserMessageId("Fade");
HookUserMessage(g_umFadeFadeHooktrue);

Action FadeHook(UserMsg msg_idBfRead bf, const int[] playersint playersNumbool reliablebool init)
{
    
int client players[0];
    ......
    return 
Plugin_Handled;



seems like "Fade" only send to 1 client, but I need to block such thing like "PZDmgMsg", it will send to all real client.

eyal282 03-27-2024 07:07

Re: [L4D2] How can I hook and block usermsg for only certain clients?
 
Quote:

Originally Posted by HarryPotter (Post 2820134)
You can see this as an example: https://forums.alliedmods.net/showthread.php?t=339035

PHP Code:


g_umFade 
GetUserMessageId("Fade");
HookUserMessage(g_umFadeFadeHooktrue);

Action FadeHook(UserMsg msg_idBfRead bf, const int[] playersint playersNumbool reliablebool init)
{
    
int client players[0];
    ......
    return 
Plugin_Handled;



Are both "Fade" and "PZDmgMsg" exclusive to one player? If not, he's gonna have a bad time working it out.

The hook should refer to each client receiving.

Forgetest 04-04-2024 04:39

Re: [L4D2] How can I hook and block usermsg for only certain clients?
 
Quote:

Originally Posted by HarryPotter (Post 2820134)
You can see this as an example: https://forums.alliedmods.net/showthread.php?t=339035

PHP Code:


g_umFade 
GetUserMessageId("Fade");
HookUserMessage(g_umFadeFadeHooktrue);

Action FadeHook(UserMsg msg_idBfRead bf, const int[] playersint playersNumbool reliablebool init)
{
    
int client players[0];
    ......
    return 
Plugin_Handled;



It looks like the game server never sends "PZDmgMsg" to multiple clients in one message, so should be safe to do so.

If that doesn't work, I believe it's possible to do Pl_Handled pre-hook -> send your own one in post-hook.


All times are GMT -4. The time now is 12:28.

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