Skip to content

Commit

Permalink
Merge pull request #379 from zer0k-z/hud-menu-zone-fix
Browse files Browse the repository at this point in the history
Fix unresponsive client menu when players use start timer button zone, fix errors showing up if players try to pause in start timer button zone
  • Loading branch information
zealain authored Oct 7, 2022
2 parents 3fb2f7f + b555ab6 commit d6d9b6e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions addons/sourcemod/scripting/gokz-core/timer/pause.sp
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ bool CanPause(int client, bool showError = false)
return true;
}

void Resume(int client)
void Resume(int client, bool force = false)
{
if (!paused[client])
{
return;
}
if (!CanResume(client, true))
if (!force && !CanResume(client, true))
{
return;
}
Expand Down Expand Up @@ -193,7 +193,7 @@ void OnTimerStart_Pause(int client)
{
hasPausedInThisRun[client] = false;
hasResumedInThisRun[client] = false;
GOKZ_Resume(client);
Resume(client, true);
}

void OnChangeMovetype_Pause(int client, MoveType newMovetype)
Expand Down
6 changes: 0 additions & 6 deletions addons/sourcemod/scripting/gokz-core/timer/timer.sp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ bool TimerStart(int client, int course, bool allowMidair = false, bool playSound
return false;
}

// Unpause the player, if they're paused
if (GOKZ_GetPaused(client))
{
GOKZ_Resume(client);
}

// Prevent noclip exploit
SetEntProp(client, Prop_Send, "m_CollisionGroup", GOKZ_COLLISION_GROUP_STANDARD);

Expand Down
12 changes: 10 additions & 2 deletions addons/sourcemod/scripting/gokz-hud/menu.sp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ void OnOptionChanged_Menu(int client, HUDOption option)

void OnTimerStart_Menu(int client)
{
CancelGOKZHUDMenu(client);
// Prevent the menu from getting cancelled every tick if player use start timer button zone.
if (GOKZ_GetTime(client) > 0.0)
{
CancelGOKZHUDMenu(client);
}
}

void OnTimerEnd_Menu(int client)
Expand Down Expand Up @@ -73,5 +77,9 @@ void OnJoinTeam_Menu(int client)

void OnStartPositionSet_Menu(int client)
{
CancelGOKZHUDMenu(client);
// Prevent the menu from getting cancelled every tick if player use start timer button zone.
if (GOKZ_GetTime(client) > 0.0)
{
CancelGOKZHUDMenu(client);
}
}

0 comments on commit d6d9b6e

Please sign in to comment.