Raised This Month: $ Target: $400
 0% 

Solved [L4D2] player_death event is not broadcasted properly.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WinterLady
Junior Member
Join Date: May 2023
Old 05-31-2023 , 10:42   [L4D2] player_death event is not broadcasted properly.
Reply With Quote #1

Hello!

I have a modded server (versus only, l4d2 only, linux), and it has a problem with death broadcast (I am talking about the text showing on the left side of the player screen such as "Rochelle killed Hunter".

What could be the possible reasons?

I don't see any errors in the console regarding any plugins.
I don't have any plugin that sets event.BroadcastDisabled = true on `player_death` event hook.

I tried the following debugging code, and I cannot see anything wrong:
PHP Code:
public void OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeathEventHookMode_Pre);
}

public 
Action Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    
    if (
IsValidClient(attacker) && IsValidClient(victim))
    {
        
PrintToChatAll("[DEBUG] victim: %N, attacker: %N, dontBroadcast: %b"victimattackerdontBroadcast);
    }
    return 
Plugin_Continue;

Output:
Code:
[DEBUG] victim: Hunter, attacker: (1)Ellis, dontBroadcast: 0
[DEBUG] victim: Spitter, attacker: (2)Rochelle, dontBroadcast: 0
[DEBUG] victim: Charger, attacker: (2)Rochelle, dontBroadcast: 0
I would appreciate if anyone can suggest where to start to look. Thanks!

Last edited by WinterLady; 05-31-2023 at 19:16.
WinterLady is offline
WinterLady
Junior Member
Join Date: May 2023
Old 05-31-2023 , 19:16   Re: [L4D2] player_death event is not broadcasted properly.
Reply With Quote #2

I figured it out. One of the plugins I wrote without the full understanding a long time ago was pre-hooking the event and returning `Plugin_Handled` instead of `Plugin_Continue`, which was blocking it

For whomever bumps into the same issue and needs more information: https://wiki.alliedmods.net/Events_(...locking_Events

Last edited by WinterLady; 05-31-2023 at 19:20.
WinterLady is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 06-02-2023 , 12:25   Re: [L4D2] player_death event is not broadcasted properly.
Reply With Quote #3

recommand to use plugin_change
LinLinLin 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 10:58.


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