AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.16) [21-Apr-2024] (https://forums.alliedmods.net/showthread.php?t=322132)

Silvers 03-16-2020 20:05

[L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.16) [21-Apr-2024]
 
20 Attachment(s)
Features:
  • Provides more options for both games, such as when the screen should turn black and white and how many revives are allowed.
  • Options to control when the heartbeat sound plays and when survivors should start vocalizing that they're about to die.
  • This plugins cvar l4d_heartbeat_revives overwrites the games survivor_max_incapacitated_count cvar, so set your desired value in this plugins cvar config.
  • Cvar default values of "2" is what the game uses by default.
  • This fixes L4D1 players going from black and white on the 2nd revive to normal color after subsequent revives when increasing the survivor_max_incapacitated_count cvar value.
  • In L4D1 this plugin overwrites and controls "m_currentReviveCount" netprop. Because this variable can no longer be relied on, plugins using that must change to use the 2 natives provided for accurate revive counts.
  • In L4D2 this plugin overwrites and controls "m_bIsOnThirdStrike". This netprop and the one above are used to make players screen black and white.
  • The bug is described here by Dragokas.



Natives: (for 3rd party revive/respawn style plugins)
Spoiler




Thanks:
  • "Dragokas" - For the inspiration and help testing.



Admin Command:

PHP Code:

// Set someone as black and white health status or toggle their state. Usage: sm_heartbeat [#userid|name] [state: 0=Healed. 1=Black and white.]
sm_heartbeat 




CVars:

Saved to l4d_heartbeat.cfg in your servers \cfg\sourcemod\ folder.

PHP Code:

// 0=Plugin off, 1=Plugin on.
l4d_heartbeat_allow "1"

// Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).
l4d_heartbeat_modes ""

// Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).
l4d_heartbeat_modes_off ""

// Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.
l4d_heartbeat_modes_tog "0"

// 0=Off. 1=Set black and white status when someone is incapped, not after revive.
l4d_heartbeat_incap "0"

// How many revives are allowed before a player is killed (wrapper to survivor_max_incapacitated_count cvar).
l4d_heartbeat_revives "2"

// How many revives until the black and white screen overlay starts.
l4d_heartbeat_screen "2"

// How many revives until the heartbeat sound starts playing.
l4d_heartbeat_sound "2"

// How many revives until the player starts vocalizing that they're about to die.
l4d_heartbeat_vocalize "2"

// Heartbeat plugin version.
l4d_heartbeat_version 



Changes:
Code:

1.16 (21-Apr-2024)
    - Fixed revive count increasing by 2 instead of 1 under certain circumstances. Thanks to "S.A.S" for reporting.

1.15 (16-Apr-2024)
    - Removed gamedata method patching the game which created a health bug. Thanks to "S.A.S" for reporting.
    - Fixed issues with "m_isGoingToDie" being set to 0 not damaging the player.

1.14a (26-Mar-2024)
    - Fixed the GameData file for Linux servers. Thanks to "S.A.S" for reporting.

1.14 (12-Mar-2024)
    - Fixed native "Heartbeat_SetRevives" not setting the correct revive count if "reviveLogic" bool was set to false. Thanks to "little_froy" for reporting and testing.
    - Fixed clients not receiving damage from behind when on Easy difficulty, due to "m_isGoingToDie" being est to 0. Thanks to "little_froy" for reporting and testing.
    - Fixed client not in game error. Thanks to "HarryPotter" for reporting.
    - New GameData file required for the plugin to operate.

1.13 (10-Mar-2023)
    - Delayed revive logic by 1 frame to fix settings sometimes not being applied due to self revive plugins. Thanks to "Shao" for reporting.

1.12 (19-Feb-2023)
    - Added cvar "l4d_heartbeat_incap" to set black and white status when someone is incapped, not after revive. Requested by "Jestery".
    - Fixed heartbeat sound being stopped when other players respawn.

1.11 (03-Dec-2022)
    - Plugin now resets the heartbeat sound for spectators.

1.10 (15-Nov-2022)
    - Fixed the revive count not carrying over when switching to/from idle state. Thanks to "NoroHime" for reporting.

1.9 (02-Nov-2022)
    - Fixed screen turning black and white when they're not read to die. Thanks to "Iciaria" for reporting and lots of help testing.
    - Various changes to simplify the code.

1.8 (25-Aug-2022)
    - Changes to fix warnings when compiling on SM 1.11.
    - Fixed native "Heartbeat_GetRevives" return type wrongfully set as void instead of int.

1.7 (31-Mar-2021)
    - Added command "sm_heartbeat" to toggle or specify someone as black and white health status.

1.6 (15-Feb-2021)
    - Fixed heartbeat sound playing when replacing a bot. Thanks to "Endoyurei Shirokuro" for reporting.

1.5 (15-Jul-2020)
    - Added more StopSound calls on player spawn. Thanks to "Endoyurei Shirokuro" for reporting.

1.4 (10-May-2020)
    - Various changes to tidy up code.

1.3 (26-Apr-2020)
    - Added native "Heartbeat_GetRevives" for 3rd party plugins to get a players current incap count.
    - Added native "Heartbeat_SetRevives" for 3rd party plugins to set a players current incap count.
    - Changes to prevent duplicate heartbeat sounds playing.
    - Extra checks to prevent "IsAllowedGameMode" throwing errors.

1.2 (11-Apr-2020)
    - Fixed not resetting the heartbeat sound on player death.

1.1 (01-Apr-2020)
    - Fixed "IsAllowedGameMode" from throwing errors when the "_tog" cvar was changed before MapStart.

1.0 (17-Mar-2020)
    - Initial release.


Installation:
  1. Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.

Explait 03-17-2020 10:13

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.0) [17-Mar-2020]
 
Pretty good plugin!

Dragokas 03-31-2020 17:10

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.0) [17-Mar-2020]
 
Nice, works for me well, thanks for fixing that!

Silvers 04-26-2020 12:34

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.3) [26-Apr-2020]
 
Code:

1.3 (26-Apr-2020)
    - Added native "Heartbeat_GetRevives" for 3rd party plugins to get a players current incap count.
    - Added native "Heartbeat_SetRevives" for 3rd party plugins to set a players current incap count.
    - Changes to prevent duplicate heartbeat sounds playing.
    - Extra checks to prevent "IsAllowedGameMode" throwing errors.


login101 04-27-2020 20:48

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.3) [26-Apr-2020]
 
good!

Endoyurei Shirokuro 06-13-2020 06:41

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.4) [10-May-2020]
 
Hello?

I've encountered an issue with your plugin. If I set survivor_max_incapacitated_count to 0 (you know, for a hardcore server), then if someone goes AFK, then goes back, the heartbeat sound starts playing to this player. The same goes to switching to another bot using the Survivor Bot Select plugin.
Also if I do the same in server config file, nothing changes.

Any chances you could look for a possible solution please? Honestly, I was hoping that with your plugin I'll be able to solve this problem…

Silvers 06-16-2020 00:40

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.4) [10-May-2020]
 
I can't duplicate the issue. Can you provide some details on the steps required to cause this bug? I tried going AFK and using Survivor Bot Select plugin.

Are you changing "survivor_max_incapacitated_count" cvar itself or are you setting "l4d_heartbeat_revives" to 0 which is what you should be doing because the latter overrides the former and required for the plugin to function correctly. Also send me your cvars config for this plugin so I can test with the same values. Thanks.

Endoyurei Shirokuro 06-16-2020 07:48

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.4) [10-May-2020]
 
1 Attachment(s)
Well, I'm going AFK. When I press LMB to take control over bot, the heartbeat sound starts playing.
When I type !pickbot in chat and take control over another bot, I hear the heartbeat sound.
The sound doesn't start playing to a player who just connected to the server, though.

I've tried changing those cvars separately (I mean, before changing «survivor_max_incapacitated_count» I remove your plugin). If I don't change the default cvar (or even remove it from the server config), but change the cvar in plugin's config, I hear the heartbeat sound.

Just changed «l4d_heartbeat_revives» to 0. Nothing else.
Attachment 182054

ZBzibing 12-28-2020 03:48

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.5) [15-Jul-2020]
 
Only give the survivor a chance to fall down, can appear black and white and heartbeat

Silvers 02-15-2021 21:25

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.6) [15-Feb-2021]
 
Quote:

Originally Posted by Endoyurei Shirokuro (Post 2705998)
Well, I'm going AFK. When I press LMB to take control over bot, the heartbeat sound starts playing.
When I type !pickbot in chat and take control over another bot, I hear the heartbeat sound.
The sound doesn't start playing to a player who just connected to the server, though.

I've tried changing those cvars separately (I mean, before changing «survivor_max_incapacitated_count» I remove your plugin). If I don't change the default cvar (or even remove it from the server config), but change the cvar in plugin's config, I hear the heartbeat sound.

Just changed «l4d_heartbeat_revives» to 0. Nothing else.
Attachment 182054

Thanks, fixed.
Code:

1.6 (15-Feb-2021)
    - Fixed heartbeat sound playing when replacing a bot. Thanks to "Endoyurei Shirokuro" for reporting.


Quote:

Originally Posted by ZBzibing (Post 2730406)
Only give the survivor a chance to fall down, can appear black and white and heartbeat

Sorry I don't know what you mean.

SpannerV2 02-18-2021 21:36

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.6) [15-Feb-2021]
 
Plugin does not seem to be working for me, i have set the revives to 6 and removed the ingame cvar to allow this to work but still no.

Silvers 02-20-2021 09:06

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.6) [15-Feb-2021]
 
Quote:

Originally Posted by SpannerV2 (Post 2737447)
Plugin does not seem to be working for me, i have set the revives to 6 and removed the ingame cvar to allow this to work but still no.

Can you post the cvars you're using for this plugin and maybe mention the steps to replicate the issue? I'm guessing just attempt to incap myself 6 times.. When you say removed ingame cvar, what exactly do you mean, how have you done that?


Edit: simply change "l4d_heartbeat_revives" value to "6" and don't change the games cvar. This works for me.

Tonblader 03-29-2021 15:25

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.6) [15-Feb-2021]
 
Can you add two new commands?
Mainly to test with the current gnome/cola plugin when they go into black and white state and because I don't know of any command that does this directly.

sm_bnws / sm_bnw_state - define <target> and <survivor_max_incapacitated_count number>

sm_bnw - define <target> to change status to black and white directly

I don't know if this affects the special infected in any way.

Silvers 03-31-2021 04:27

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
Code:

1.7 (31-Mar-2021)
    - Added command "sm_heartbeat" to toggle or specify someone as black and white health status.


jeremyvillanueva 04-01-2021 12:47

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
Hi Silver, thanks to Ton I have found this plugin
May you please add a B&W or BnW or BW [Post Revive / "BW" Options] to the plugin post name,
because I was looking for this plugin like for 2 months and I didn't now how to find it
until today

Best wishes (BW xd)

Dragokas 01-27-2022 08:32

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
Hi, Silvers.

Just let you know that such way of setting max incap in pre-hook to kill the survivor is only work in L4D1:
Code:

OnTakeDamageMain
...
if( damage >= health )
        {
...
                        // Allow to die
                        if( g_bLeft4Dead2 )
                                SetEntProp(client, Prop_Send, "m_bIsOnThirdStrike", 1);
                        else
                                SetEntProp(client, Prop_Send, "m_currentReviveCount", g_iCvarRevives);

SetEntProp + m_currentReviveCount is also doesn't help in L4D2.

ZBzibing 01-27-2022 22:16

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
If teammates are black and white, it would be nice to add an external expression. Instead of prompting teammates to be black and white. For example, a morbid display of a character, or a debilitating color, etc.
Because sometimes teammates don't notice your black and white state, all external performance will be taken care of by teammates

Gold Fish 01-28-2022 03:16

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
Most plugins associated with the player's health have one drawback. They do not see the intentional healing of the players (from the admin menu, Give CMD, or just through the code in another plugin)Someone has seen a solution to complete tracking the player's healing ? Or is it easier to make a timer which will check the health of players for the whole game?

Dragokas 01-28-2022 03:23

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
Not correct. This plugin listen for "give" command.
As about SetClientHealth(), it has no relation to B&W state.

If you need to listen for health status, you'll have to hook appropriate game function.

ZBzibing 02-03-2022 09:19

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
Quote:

Originally Posted by ZBzibing (Post 2769644)
If teammates are black and white, it would be nice to add an external expression. Instead of prompting teammates to be black and white. For example, a morbid display of a character, or a debilitating color, etc.
Because sometimes teammates don't notice your black and white state, all external performance will be taken care of by teammates

The black and white player in L4D1 pretends to use a medical kit to heal, but cancels the healing process, and the black and white screen disappears.
My settings l4d_heartbeat_screen","1"

Silvers 02-03-2022 12:16

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
Quote:

Originally Posted by ZBzibing (Post 2770404)
The black and white player in L4D1 pretends to use a medical kit to heal, but cancels the healing process, and the black and white screen disappears.
My settings l4d_heartbeat_screen","1"

Can't replicate the issue, works fine here. Can you explain more steps? Maybe try removing all plugins except Heartbeat and test, maybe some conflict?

NoroHime 04-25-2022 23:28

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.7) [31-Mar-2021]
 
when my third-party plugin changed the revive netprop, how i notify heartbeat work properly? just Heartbeat_SetRevives() again?
----
solved, i follow the example step then well done

Iciaria 10-26-2022 12:26

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.8) [25-Aug-2022]
 
The black and white screen will reappear when the blood volume is low. I suspect it is related to l4d_ Healing.smx. It seems that this problem is caused by pills that slowly restore HP
Can you fix it?

Sorry, my English is not good

Silvers 10-26-2022 13:30

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.8) [25-Aug-2022]
 
Quote:

Originally Posted by Iciaria (Post 2791635)
The black and white screen will reappear when the blood volume is low. I suspect it is related to l4d_ Healing.smx. It seems that this problem is caused by pills that slowly restore HP
Can you fix it?

Sorry, my English is not good

Which game? Can you give me more of an example how to replicate the issue?

Iciaria 10-27-2022 15:47

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.8) [25-Aug-2022]
 
3 Attachment(s)
Left 4 dead 2 Linux Server

I set the attack damage of CI to a random floating point number between 2.9 and 5.9 to facilitate the recurrence of this problem,This problem has occurred even if the attack damage of CI is not changed

During the test, I found that when trying to evade attacks from multiple CIs, the recurrence success rate of the problem will be higher

Plugins that cause problems:
[L4D & L4D2] Regenerative Healing 1.11
https://forums.alliedmods.net/showthread.php?p=2669423


step1:
Ensure player status is :If you fall down again, you will die
step2:
spawn some CI
step3:
eat pill and Let CI attack you
step4:
Try to evade CI attacks by moving and jumping

When hp is low, black and white screen is likely to appear

I noticed that * * debug information shows that I have been injured many times, but in a short time, I have only been injured once. Is this possibly related to the problem?

Sorry my English is not good

add:
I noticed that if the player suffers other attack damage when falling from a high place, the problem may also occur

Silvers 10-28-2022 09:00

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.8) [25-Aug-2022]
 
I've sent you a PM with a new version if you could test and let me know if that fixes it. Thanks.

Iciaria 10-29-2022 07:55

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.8) [25-Aug-2022]
 
Quote:

Originally Posted by Silvers (Post 2791735)
I've sent you a PM with a new version if you could test and let me know if that fixes it. Thanks.

I'm new to this forum
I replied to your private message, but it didn't show any content. Can you see it?

Sorry, my English is not good

TQH 10-31-2022 20:00

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.8) [25-Aug-2022]
 
1 Attachment(s)
PHP Code:

l4d_heartbeat_revives "2"
l4d_heartbeat_screen "4"
l4d_heartbeat_sound "4" 

Sometimes it doesn't work perfectly. :shock:
I think I have used !revive (https://forums.alliedmods.net/showpo...&postcount=483) and !autodefib (https://forums.alliedmods.net/showpo...04&postcount=1) many times and this is causing the problem.

Silvers 10-31-2022 21:56

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.8) [25-Aug-2022]
 
Quote:

Originally Posted by TQH (Post 2791930)
PHP Code:

l4d_heartbeat_revives "2"
l4d_heartbeat_screen "4"
l4d_heartbeat_sound "4" 

Sometimes it doesn't work perfectly. :shock:
I think I have used !revive (https://forums.alliedmods.net/showpo...&postcount=483) and !autodefib (https://forums.alliedmods.net/showpo...04&postcount=1) many times and this is causing the problem.

Hmm sm_revive is triggering the event. Will look into it.

Silvers 11-02-2022 09:12

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.9) [02-Nov-2022]
 
Code:

1.9 (02-Nov-2022)
    - Fixed screen turning black and white when they're not read to die. Thanks to "Iciaria" for reporting and lots of help testing.
    - Various changes to simplify the code.


Silvers 12-03-2022 10:24

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.11) [03-Dec-2022]
 
Code:

1.11 (03-Dec-2022)
    - Plugin now resets the heartbeat sound for spectators.


Silvers 02-19-2023 02:58

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.12) [19-Feb-2023]
 
Code:

1.12 (19-Feb-2023)
    - Added cvar "l4d_heartbeat_incap" to set black and white status when someone is incapped, not after revive. Requested by "Jestery".
    - Fixed heartbeat sound being stopped when other players respawn.


Shao 02-21-2023 19:12

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.12) [19-Feb-2023]
 
Would this plugin be why incap counts get out of sync? Or this one? I seem the get the occasional bug in between where people get to be black and white but aren't really before going down another time. I use default values outside the BW Defib plugin which when survivors are revived they go BW after 1 down rather than 2.

Hawkins 02-21-2023 19:15

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.12) [19-Feb-2023]
 
Quote:

Originally Posted by Shao (Post 2800001)
Would this plugin be why incap counts get out of sync? Or this one? I seem the get the occasional bug in between where people get to be black and white but aren't really before going down another time. I use default values outside the BW Defib plugin which when survivors are revived they go BW after 1 down rather than 2.

Must be incapped pills pop, since i use it too and get the same bug as well.

Silvers 02-22-2023 02:30

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.12) [19-Feb-2023]
 
3rd party plugins that revive people need to be modified to use this plugin if detected. See the "Natives: (for 3rd party revive/respawn style plugins)" part. Some of my plugins are demonstrating this, for example Incapped Weapons. - or maybe not, should be automatic.

Maybe I can require Left4DHooks and automatically set revive counts/screen state etc instead of plugins setting it themselves, or delay from revive event by 1 frame. When I get time I'll look into it.

little_froy 02-24-2024 19:25

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.13) [10-Mar-2023]
 
2 Attachment(s)
call native Heartbeat_SetRevives, causing player instantly die when incapacitated if the revive count has not reached the max.

-keep taking damage till down, wait for revive. repeat again.
-use command "sm_revive", and keep taking damage, instantly die, the revive count has not reached the max.

little_froy 03-03-2024 15:32

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.13) [10-Mar-2023]
 
sorry Silvers, I found another issue
if's not good to always set "m_isGoingToDie" to 0
if the prop is 0, and next hurt damage equal or higher than real health, "m_isGoingToDie" will becomes 1, and reduce 1.0 damge(or get extra 1.0 health buffer)
always set "m_isGoingToDie" to 0, means always reduce 1.0 damage, for example, normal difficulty horde hit from front damage will reduce to 1
I have another method to block vocalize https://forums.alliedmods.net/showthread.php?p=2818615

Silvers 03-12-2024 06:01

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.14) [12-Mar-2024]
 
Code:

1.14 (12-Mar-2024)
    - Fixed native "Heartbeat_SetRevives" not setting the correct revive count if "reviveLogic" bool was set to false. Thanks to "little_froy" for reporting and testing.
    - Fixed clients not receiving damage from behind when on Easy difficulty, due to "m_isGoingToDie" being est to 0. Thanks to "little_froy" for reporting and testing.
    - Fixed client not in game error. Thanks to "HarryPotter" for reporting.
    - New GameData file required for the plugin to operate.


Silvers 03-26-2024 18:38

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.14) [12-Mar-2024]
 
Quote:

Originally Posted by S.A.S (Post 2820135)
-

Which game, which os?

S.A.S 03-26-2024 18:42

Re: [L4D & L4D2] Heartbeat (Revive Fix - Post Revive Options) (1.14) [12-Mar-2024]
 
Quote:

Originally Posted by Silvers (Post 2820148)
Which game, which os?

LD2 Linux


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

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