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

[L4D2] "give health" bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
noto3
Member
Join Date: Jan 2021
Old 08-01-2022 , 10:25   [L4D2] "give health" bug
Reply With Quote #1

A bug that allows survivors to gain more than the maximum hp (100)

If you revive an incapacitated survivor, they have a temporary hp of 20 (this can be changed with sm_cvar survivor_revive_health). Now reviving yourself while you're incapacitated with the command "give health" adds that temporary health (sm_cvar survivor_revive_health) to your new maximum hp -> 100(max) + 20(temp) give health = 120 new hp. This bug also affects plugins such as the points system. Any help would be appreciated.
noto3 is offline
moschinovac
Member
Join Date: Mar 2019
Location: Vietnam
Old 08-01-2022 , 10:40   Re: [L4D2] "give health" bug
Reply With Quote #2

Revive by use "native void L4D_ReviveSurvivor(int client)" of L4Dhooks instead "give health". Work fine for me

Last edited by moschinovac; 08-01-2022 at 10:42.
moschinovac is offline
noto3
Member
Join Date: Jan 2021
Old 08-01-2022 , 15:43   Re: [L4D2] "give health" bug
Reply With Quote #3

Any alternative solution to this?
noto3 is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 08-01-2022 , 21:39   Re: [L4D2] "give health" bug
Reply With Quote #4

PHP Code:
void CheatCommand(int client)
{
    
int give_flags GetCommandFlags("give");
    
SetCommandFlags("give"give_flags & ~FCVAR_CHEAT);
    if (
GetEntProp(clientProp_Send"m_isHangingFromLedge"))//懸掛
    
{
        
FakeClientCommand(client"give health");
    }
    else if (
IsIncapacitated(client))//倒地
    
{
        if(
GetInfectedAttacker(client) < 0)
        {
            
FakeClientCommand(client"give health");
            
SetEntPropFloat(clientProp_Send"m_healthBufferTime"GetGameTime());
            
SetEntPropFloat(clientProp_Send"m_healthBuffer"0.0);
        }
    }
    else if(
GetClientHealth(client)<100//血量低於100
    
{
        
FakeClientCommand(client"give health");
        
SetEntPropFloat(clientProp_Send"m_healthBufferTime"GetGameTime());
        
SetEntPropFloat(clientProp_Send"m_healthBuffer"0.0);
    }
    
    
SetCommandFlags("give"give_flags);
}

bool IsIncapacitated(int client)
{
    return 
view_as<bool>(GetEntProp(clientProp_Send"m_isIncapacitated"));
}

int GetInfectedAttacker(int client)
{
    
int attacker;

        
/* Charger */
        
attacker GetEntPropEnt(clientProp_Send"m_pummelAttacker");
        if (
attacker 0)
        {
            return 
attacker;
        }

        
attacker GetEntPropEnt(clientProp_Send"m_carryAttacker");
        if (
attacker 0)
        {
            return 
attacker;
        }
        
/* Jockey */
        
attacker GetEntPropEnt(clientProp_Send"m_jockeyAttacker");
        if (
attacker 0)
        {
            return 
attacker;
        }

    
/* Hunter */
    
attacker GetEntPropEnt(clientProp_Send"m_pounceAttacker");
    if (
attacker 0)
    {
        return 
attacker;
    }

    
/* Smoker */
    
attacker GetEntPropEnt(clientProp_Send"m_tongueOwner");
    if (
attacker 0)
    {
        return 
attacker;
    }

    return -
1;

__________________

Last edited by HarryPotter; 08-01-2022 at 21:39.
HarryPotter 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 15:00.


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