Skip to content

Commit 3902532

Browse files
authored
rocketjump: clamp velocity instead of hardcode to 0 (#898)
1 parent c991e8a commit 3902532

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

-4 Bytes
Binary file not shown.

addons/sourcemod/scripting/l4d2_fix_rocketjump.sp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <sdktools>
66
#include <sdkhooks>
77

8-
#define PLUGIN_VERSION "1.4"
8+
#define PLUGIN_VERSION "1.5"
99
#define MAXENTITY 2048
1010

1111
public Plugin myinfo =
@@ -106,11 +106,22 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
106106
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", flVel);
107107
//PrintToChatAll("%N m_vecAbsVelocity - %.2f %.2f %.2f", client, flVel[0], flVel[1], flVel[2]);
108108

109-
flVel[2] = 0.0; //velocity height zero
109+
// velocity height zero - prevents getting "squished"
110+
if (flVel[2] < 0.0)
111+
{
112+
flVel[2] = 0.0;
113+
}
114+
115+
// normal jump velocity - prevents getting launched
116+
if (flVel[2] > 242.29)
117+
{
118+
flVel[2] = 242.29;
119+
}
120+
110121
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, flVel);
111122
}
112123
}
113124

114125
g_bStepOnEntitiy[client] = false;
115126
return Plugin_Continue;
116-
}
127+
}

0 commit comments

Comments
 (0)