Raised This Month: $ Target: $400
 0% 

Solved [L4D2] Survivors can't jump after being hit


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-01-2023 , 12:43   [L4D2] Survivors can't jump after being hit
Reply With Quote #1

Hi.
If this is the wrong place, please let me know.

In short,
I want to make a plugin or change a ConVar to turn off the thing where you can't jump for a couple seconds after being hit by somebody on the Infected team.
But I have absolutely no clue where to start.

In long,
I'm looking for a way turn off the thing where Survivors can't jump for a couple seconds after being hit by somebody on the Infected team.
You know exactly what this is if you're familiar with Left 4 Dead 2.

I have absolutely despised this ever since I started playing this game, and I can't find anything about it online.
Can someone please point me into the right direction so I can make a plugin or change a ConVar so I can turn this thing off?

And no, I'm not talking about the slowdown. I've already solved that.
I mean the effect where you can't jump after you're hit.

Edit: I didn't post this on the L4D2 Steam forums because, the last time I posted anything on any Steam forum, I nearly got my account banned for "spamming".
Which I never did.
I don't like breaking the rules on any site. It's not fun.


Thanks,
TotalChaos.

Last edited by TotalChaos SourcePawner; 04-17-2023 at 16:21.
TotalChaos SourcePawner is offline
Forgetest
Member
Join Date: Aug 2020
Old 04-14-2023 , 13:22   Re: [L4D2] Survivors can't jump after being hit
Reply With Quote #2

m_flVelocityModifier is maybe what you want.

I'm not sure what the values are when hit by commons. The following should do the trick after damaged.
PHP Code:
SetEntPropFloat(clientProp_Send"m_flVelocityModifier"1.0
A plugin that does kinda reversed thing.
https://github.com/Target5150/MoYu_S...own_protect.sp
Forgetest is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-14-2023 , 14:57   Re: [L4D2] Survivors can't jump after being hit
Reply With Quote #3

Quote:
Originally Posted by Forgetest View Post
m_flVelocityModifier is maybe what you want.

I'm not sure what the values are when hit by commons. The following should do the trick after damaged.
PHP Code:
SetEntPropFloat(clientProp_Send"m_flVelocityModifier"1.0
A plugin that does kinda reversed thing.
https://github.com/Target5150/MoYu_S...own_protect.sp
Well you're a bit late. I already gave up on this.
Thanks anyway, I'll be sure to give those a try.

Also, where do people get those internal variables from?
I've seen a few here and there with both SourceMod plugins and VScript, but I don't actually know where people get them from.
I know for a fact that nobody's looking at source code because Left 4 Dead 1/2's source code never leaked (to my knowledge). Unless there's a decompilation project or two that I'm completely unaware of.
Spoiler
TotalChaos SourcePawner is offline
Forgetest
Member
Join Date: Aug 2020
Old 04-15-2023 , 11:58   Re: [L4D2] Survivors can't jump after being hit
Reply With Quote #4

Code:
sm_dump_netprops netprops.txt
sm_dump_datamaps datamaps.txt
The above commands would generate lists of class properties provided internally, as long as SM is installed.
Valve is kind enough to provide L4D binaries with symbols, kinda readable with disassembly tools, i.e. IDA.
Forgetest is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-15-2023 , 17:00   Re: [L4D2] Survivors can't jump after being hit
Reply With Quote #5

Quote:
Originally Posted by Forgetest View Post
Code:
sm_dump_netprops netprops.txt
sm_dump_datamaps datamaps.txt
The above commands would generate lists of class properties provided internally, as long as SM is installed.
Valve is kind enough to provide L4D binaries with symbols, kinda readable with disassembly tools, i.e. IDA.
Thanks for that. I'll be sure to try those out.
TotalChaos SourcePawner is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-16-2023 , 11:49   Re: [L4D2] Survivors can't jump after being hit
Reply With Quote #6

So I tried some of the sm_dump_* commands, and the majority of them seem to work.
But sm_dump_classes seems to crash Left 4 Dead 2 with an "ED_Alloc no free edicts" error.
Any idea why it does that, and if there are any ways around it?

Spoiler



EDIT: Ok, so I tried sm_dump_datamaps on Team Fortress 2, and the game immediately crashed with this error:
Code:
Engine Error
Cannot load corrupted map
This was on cp_dustbowl.
With that being said, I'll be creating a new post about this eventually, because this is not the place to be talking about that error.

Last edited by TotalChaos SourcePawner; 04-16-2023 at 11:58.
TotalChaos SourcePawner is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-16-2023 , 16:56   Re: [L4D2] Survivors can't jump after being hit
Reply With Quote #7

Ok, so I tried using m_flVelocityModifier. That didn't change anything.
I still can't jump after being hit.

I am not an expert coder by any means, so there is a really good chance that I did everything wrong.
I am absolutely out of ideas, so can somebody take a look at this plugin and tell me what I'm doing wrong?

Edit: I removed some extra comments from the plugin that didn't need to be there.
Attached Files
File Type: sp Get Plugin or Get Source (JumpAfterHit.sp - 51 views - 2.8 KB)
TotalChaos SourcePawner is offline
Forgetest
Member
Join Date: Aug 2020
Old 04-17-2023 , 03:53   Re: [L4D2] Survivors can't jump after being hit
Reply With Quote #8

Seems messed up with the wrong prop, should be m_jumpSupressedUntil.

Code:
SetEntPropFloat(client, Prop_Send, "m_jumpSupressedUntil", -1.0);
And there's no reason to use a repeat timer. Attached below is a sample plugin, hope it helps for your scripting.

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdkhooks> // SDKHook_OnTakeDamagePost

bool g_bLateLoad// whether map has started when this plugin is loaded

public APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    switch (
GetEngineVersion())
    {
    case 
Engine_Left4DeadEngine_Left4Dead2// L4D & 2 only
        
{
            
g_bLateLoad late;
            return 
APLRes_Success;
        }
    }
    
    
strcopy(errorerr_max"Plugin supports L4D & 2 only.");
    return 
APLRes_Failure;
}

public 
void OnPluginStart()
{
    if (
g_bLateLoad)
    {
        
// find all clients in game and hook them all since we're late here
        
for (int i 1<= MaxClients; ++i)
        {
            if (
IsClientInGame(i)) OnClientPutInServer(i);
        }
    }
}

// calls whenever a client joins, bot or human
public void OnClientPutInServer(int client
{
    
SDKHook(clientSDKHook_OnTakeDamagePostSDK_OnTakeDamage_Post);
}

// a sdkhook that calls whenever a player takes any damage, like punched by CI
void SDK_OnTakeDamage_Post(int victimint attackerint inflictorfloat damageint damagetype)
{
    if (!
IsClientInGame(victim)) // who cares
        
return;
    
    
// Generally incapped and dead players are immovable so we just ignore here
    
if (IsIncapacitated(victim) || !IsPlayerAlive(victim))
        return;
    
    
// If the player cannot jump after hit,
    
if (GetGameTime() < GetEntPropFloat(victimProp_Send"m_jumpSupressedUntil"))
    {
        
// invalidates the timestamp so the player can jump again.
        
SetEntPropFloat(victimProp_Send"m_jumpSupressedUntil", -1.0);
    }
}

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


Last edited by Forgetest; 04-17-2023 at 03:56.
Forgetest is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-17-2023 , 16:20   Re: [L4D2] Survivors can't jump after being hit
Reply With Quote #9

Thank you very much Forgetest. The plugin works perfectly.

Hopefully this can help other people out, too.
Surely I'm not the only one that hated the slowdown and no jumping thing.
TotalChaos SourcePawner 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 02:40.


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