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

[L4D1 & L4D2] Health Preserve Fix & Give Start Health (optional)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Plugin ID:
7920
Plugin Version:
1.2
Plugin Category:
Technical/Development
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Correctly preserves the player's health on map transition & optionally gives start health
    Old 01-14-2022 , 13:26   [L4D1 & L4D2] Health Preserve Fix & Give Start Health (optional)
    Reply With Quote #1

    Description:

    Features:
    • Fixes game bug when health is mixed between players after map transition.
    • (optional) Ability to set round start health for all human & bot survivors (if you wish so).

    Settings (ConVars):
    cfg/sourcemod/l4d_health_preserve.cfg:
    PHP Code:
    // Enable this plugin? (1 - Yes, 0 - No)
    l4d_health_preserve_enable "1"

    // Health of all survivors on round start (-1 - to preserve, > 0 - to set concrete health)
    l4d_health_preserve_start_health "-1"

    // Temp Health of all survivors on round start (-1.0 - to preserve, >= 0.0 - to set concrete temp health)
    l4d_health_preserve_start_temphealth "-1.0"

    // Revive count of all survivors on round start (-1 - to preserve, 0 - to erase, > 0 is also allowed)
    l4d_health_preserve_start_revive_count "-1"

    // Health of all bot survivors on round start (-1 - to preserve, > 0 - to set concrete health)
    l4d_health_preserve_start_health_bot "-1"

    // Temp Health of all bot survivors on round start (-1.0 - to preserve, >= 0.0 - to set concrete temp health)
    l4d_health_preserve_start_temphealth_bot "-1.0"

    // Revive count of all bot survivors on round start (-1 - to preserve, 0 - to erase, > 0 is also allowed)
    l4d_health_preserve_start_revive_count_bot "-1"

    // Set health from configs even if it is < less than preserved on the previous map? (1 - Yes, 0 - No)
    l4d_health_preserve_start_force "1" 
    Commands:
    PHP Code:
    // Only available when recompile with #DEBUG 1

    // display saved health at last round end
    sm_health 
    Installation
    - Compile and put l4d_health_preserve.smx in addons/sourcemod/plugins/
    Donate
    Donates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
    - Patreon (Paypal)
    - BitCoin
    - Ю.Money
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d_health_preserve.sp - 315 views - 10.9 KB)
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

    Last edited by Dragokas; 07-03-2022 at 04:24.
    Dragokas is offline
    sorallll
    Senior Member
    Join Date: Oct 2018
    Old 01-14-2022 , 15:52   Re: [L4D] Health Preserve
    Reply With Quote #2

    This bug also exists on L4D2, and the heartbeat may disappear after the transition
    sorallll is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 01-14-2022 , 16:31   Re: [L4D] Health Preserve
    Reply With Quote #3

    sorallll, ok, thanks for info.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 07-02-2022 , 07:39   Re: [L4D1 & L4D2] Health Preserve Fix & Give Start Health
    Reply With Quote #4

    Updated.

    Quote:
    1.1 (02-Jul-2022)
    - Fixed lot of stupid mistakes.
    - Added separate ConVars for bots.
    - Added ConVar "l4d_health_preserve_start_force" - Set health from configs even if it is < (less) than preserved on the previous map? (1 - Yes, 0 - No)
    - Compatibility with SM 1.11.
    - Plugin renamed.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

    Last edited by Dragokas; 07-02-2022 at 07:40.
    Dragokas is offline
    Toranks
    Senior Member
    Join Date: Dec 2021
    Location: Spain
    Old 07-02-2022 , 13:17   Re: [L4D1 & L4D2] Health Preserve Fix & Give Start Health (optional)
    Reply With Quote #5

    This solves the bug when survivors starts with 100% health on the next round, which is a rare occurrence? It also happens sometimes with dead survivors, which start with 100 instead of 50
    Toranks is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 07-02-2022 , 14:43   Re: [L4D1 & L4D2] Health Preserve Fix & Give Start Health (optional)
    Reply With Quote #6

    Quote:
    Originally Posted by Toranks View Post
    This solves the bug when survivors starts with 100% health on the next round, which is a rare occurrence?
    Plugin saves health when round end and restore it when map transitioned.

    Quote:
    Originally Posted by Toranks View Post
    It also happens sometimes with dead survivors, which start with 100 instead of 50
    I didn't met such bug. Perhaps, same as above:
    Quote:
    Originally Posted by Dragokas View Post
    ... health is mixed between players after map transition.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 07-03-2022 , 04:22   Re: [L4D1 & L4D2] Health Preserve Fix & Give Start Health (optional)
    Reply With Quote #7

    Updated.

    Quote:
    1.2 (03-Jul-2022)
    - Follow z_survivor_respawn_health ConVar when survivor dead on the round end (thanks Toranks for reporting).
    - Code simplified.
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Mr. Man
    Veteran Member
    Join Date: Mar 2011
    Location: Huh?
    Old 07-04-2022 , 02:37   Re: [L4D1 & L4D2] Health Preserve Fix & Give Start Health (optional)
    Reply With Quote #8

    Found a bug on round start for people who are about to die going to the next chapter: downs are reset but the grey view isn't removed.
    __________________
    Mr. Man is offline
    Dragokas
    Veteran Member
    Join Date: Nov 2017
    Location: Ukraine on fire
    Old 07-04-2022 , 06:29   Re: [L4D1 & L4D2] Health Preserve Fix & Give Start Health (optional)
    Reply With Quote #9

    Mr. Man, looks correct:

    PHP Code:
    public void Event_MapTransition(Event event, const char[] namebool dontBroadcast// Saving health state
    {
        for( 
    int i 1<= MaxClientsi++ )
        {
            if( 
    IsClientInGame(i) && GetClientTeam(i) == )
            {
                if( 
    IsPlayerAlive(i) )
                {
                    
    GetHealthInfo(ig_player[i].Healthg_player[i].TempHealthg_player[i].ReviveCountg_player[i].GoingToDie);
                }
                else {
                    
    g_player[i].Health g_hCvarDeadRespawnHealth.IntValue;
                    
    g_player[i].TempHealth 0.0;
                    
    g_player[i].ReviveCount 0;
                    
    g_player[i].GoingToDie 0;
                }
            }
        }

    When player alive, all parameters are saved.
    When not, health retrieved from game cvar, all other parameters saved as zero.

    Then, on Event_PlayerTransitioned values are restore (maybe, L4D2 require some delay (?))

    Download provided version. When described case happen with you, enter command !health and tell me the values and what's happen. Under "grey view" you mean Black/White?
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d_health_preserve.sp - 100 views - 11.0 KB)
    __________________
    Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
    [My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
    Dragokas is offline
    Mr. Man
    Veteran Member
    Join Date: Mar 2011
    Location: Huh?
    Old 07-04-2022 , 12:26   Re: [L4D1 & L4D2] Health Preserve Fix & Give Start Health (optional)
    Reply With Quote #10

    Hi, yes B/W is what I meant. Code below on round start when I am on last down:

    Code:
    Saved health of Mr. Man! is: 100. Temp: 0.000000. Incaps: 0. GoingToDie: 0
    Saved health of Rochelle is: 100. Temp: 0.000000. Incaps: 0. GoingToDie: 0
    Saved health of Coach is: 100. Temp: 0.000000. Incaps: 0. GoingToDie: 0
    Saved health of Ellis is: 100. Temp: 0.000000. Incaps: 0. GoingToDie: 0
    The B/W view isn't removed but the heartbeat sound is.
    __________________
    Mr. Man 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 07:17.


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