From 00feb624c2c78c94d2780ce694eff0226379f5d2 Mon Sep 17 00:00:00 2001 From: rtldg Date: Wed, 23 Jul 2025 23:06:24 +0000 Subject: [PATCH] Fix the on-ground 0.5s start-timer check from 89e97dfd3d5710ec5c25bafa78f0ded2c05d15a9 --- addons/sourcemod/scripting/shavit-core.sp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index cd91bb1e..98aad5f1 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -2569,10 +2569,15 @@ bool CanStartTimer(int client, int track, bool skipGroundCheck) if (skipGroundTimer) return true; - int halfSecOfTicks = RoundFloat(0.5 / GetTickInterval()); - int onGroundTicks = gI_LastTickcount[client] - gI_FirstTouchedGround[client]; + if (gI_FirstTouchedGround[client] > 0) + { + int halfSecOfTicks = RoundFloat(0.5 / GetTickInterval()); + int onGroundTicks = gI_LastTickcount[client] - gI_FirstTouchedGround[client]; - return onGroundTicks >= halfSecOfTicks; + return onGroundTicks >= halfSecOfTicks; + } + + return false; } void StartTimer(int client, int track, bool skipGroundCheck) @@ -3672,6 +3677,11 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3 } } + if (!bOnGround) + { + gI_FirstTouchedGround[client] = 0; + } + // This can be bypassed by spamming +duck on CSS which causes `iGroundEntity` to be `-1` here... // (e.g. an autobhop + velocity_limit style...) // m_hGroundEntity changes from 0 -> -1 same tick which causes problems and I'm not sure what the best way / place to handle that is...