Raised This Month: $51 Target: $400
 12% 

[L4D2] How can I hook and block usermsg "PZDmgMsg" for only certain clients?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
little_froy
Senior Member
Join Date: May 2021
Old 03-25-2024 , 15:29   [L4D2] How can I hook and block usermsg "PZDmgMsg" for only certain clients?
Reply With Quote #1

as the title.
I can't modify the "players" in https://sm.alliedmods.net/new-api/usermessages/MsgHook

Last edited by little_froy; 03-26-2024 at 17:00.
little_froy is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 03-26-2024 , 11:31   Re: [L4D2] How can I hook and block usermsg for only certain clients?
Reply With Quote #2

Quote:
Originally Posted by little_froy View Post
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;

__________________

Last edited by HarryPotter; 03-26-2024 at 11:32.
HarryPotter is offline
little_froy
Senior Member
Join Date: May 2021
Old 03-26-2024 , 16:59   Re: [L4D2] How can I hook and block usermsg for only certain clients?
Reply With Quote #3

Quote:
Originally Posted by HarryPotter View Post
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.
little_froy is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-27-2024 , 07:07   Re: [L4D2] How can I hook and block usermsg for only certain clients?
Reply With Quote #4

Quote:
Originally Posted by HarryPotter View Post
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.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Forgetest
Member
Join Date: Aug 2020
Old 04-04-2024 , 04:39   Re: [L4D2] How can I hook and block usermsg for only certain clients?
Reply With Quote #5

Quote:
Originally Posted by HarryPotter View Post
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.
Forgetest is offline
Reply



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 04:19.


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