Skip to content

Commit

Permalink
Merge pull request #331 from zer0k-z/noclip-start-fix
Browse files Browse the repository at this point in the history
No longer validate jump if it was invalidated in the same tick
  • Loading branch information
zealain committed May 30, 2022
2 parents 07bbae4 + 2e0dffc commit efef123
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions addons/sourcemod/scripting/gokz-core/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,15 @@ void JoinTeam(int client, int newTeam, bool restorePos)

static bool validJump[MAXPLAYERS + 1];
static float validJumpTeleportOrigin[MAXPLAYERS + 1][3];

static int lastInvalidatedTick[MAXPLAYERS + 1];
bool GetValidJump(int client)
{
return validJump[client];
}

static void InvalidateJump(int client)
{
lastInvalidatedTick[client] = GetGameTickCount();
if (validJump[client])
{
validJump[client] = false;
Expand All @@ -329,7 +330,7 @@ static void InvalidateJump(int client)

void OnStopTouchGround_ValidJump(int client, bool jumped, bool ladderJump, bool jumpbug)
{
if (Movement_GetMovetype(client) == MOVETYPE_WALK)
if (Movement_GetMovetype(client) == MOVETYPE_WALK && lastInvalidatedTick[client] != GetGameTickCount())
{
validJump[client] = true;
Call_GOKZ_OnJumpValidated(client, jumped, ladderJump, jumpbug);
Expand All @@ -350,7 +351,7 @@ void OnPlayerRunCmdPost_ValidJump(int client)

void OnChangeMovetype_ValidJump(int client, MoveType oldMovetype, MoveType newMovetype)
{
if (oldMovetype == MOVETYPE_LADDER && newMovetype == MOVETYPE_WALK) // Ladderjump
if (oldMovetype == MOVETYPE_LADDER && newMovetype == MOVETYPE_WALK && lastInvalidatedTick[client] != GetGameTickCount()) // Ladderjump
{
validJump[client] = true;
Call_GOKZ_OnJumpValidated(client, false, true, false);
Expand Down

0 comments on commit efef123

Please sign in to comment.