From d7892b7aadbbde5a4d8f6802471f7be5791c12a7 Mon Sep 17 00:00:00 2001 From: Riccardo H Date: Tue, 23 Apr 2019 21:45:52 +0200 Subject: [PATCH] stage 2 bug fix --- addons/sourcemod/scripting/SurfTimer.sp | 14 ++++++++++++++ .../sourcemod/scripting/surftimer/buttonpress.sp | 8 ++++++++ addons/sourcemod/scripting/surftimer/hooks.sp | 7 ++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/addons/sourcemod/scripting/SurfTimer.sp b/addons/sourcemod/scripting/SurfTimer.sp index 1bfd619..efb253c 100644 --- a/addons/sourcemod/scripting/SurfTimer.sp +++ b/addons/sourcemod/scripting/SurfTimer.sp @@ -1061,6 +1061,9 @@ char g_BlockedChatText[256][256]; // Last time an overlay was displayed float g_fLastOverlay[MAXPLAYERS + 1]; +// Stage 2 Bug Fixer +bool g_wrcpStage2Fix[MAXPLAYERS + 1]; + /*---------- Player location restoring ----------*/ // Clients location was restored this run @@ -1921,6 +1924,17 @@ public void OnAutoConfigsBuffered() SetFailState(" %s not found.", szPath2); } +public void OnClientConnected(int client) +{ + g_Stage[g_iClientInZone[client][2]][client] = 1; + g_WrcpStage[client] = 1; + g_Stage[0][client] = 1; + g_bWrcpTimeractivated[client] = false; + g_CurrentStage[client] = 1; + g_VEmax = 1; + g_wrcpStage2Fix[client] = true; +} + public void OnClientPutInServer(int client) { if (!IsValidClient(client)) diff --git a/addons/sourcemod/scripting/surftimer/buttonpress.sp b/addons/sourcemod/scripting/surftimer/buttonpress.sp index 7e69feb..0c569c8 100644 --- a/addons/sourcemod/scripting/surftimer/buttonpress.sp +++ b/addons/sourcemod/scripting/surftimer/buttonpress.sp @@ -815,6 +815,14 @@ public void CL_OnEndWrcpTimerPress(int client, float time2) CPrintToChat(client, "%t", "ErrorStageTime", g_szChatPrefix, stage); return; } + //Stage 1 to stage 2 glitch stopper. + if(g_wrcpStage2Fix[client] && stage == 2){ + g_wrcpStage2Fix[client] = false; + CPrintToChat(client, "Potential S1 to S2 glitch stopped. Stage time was not recorded"); // add to trans. file and add prefix! + return; + } + + g_wrcpStage2Fix[client] = false; char sz_srDiff[128]; float time = g_fFinalWrcpTime[client]; diff --git a/addons/sourcemod/scripting/surftimer/hooks.sp b/addons/sourcemod/scripting/surftimer/hooks.sp index 7e61e9b..7aed8d1 100644 --- a/addons/sourcemod/scripting/surftimer/hooks.sp +++ b/addons/sourcemod/scripting/surftimer/hooks.sp @@ -94,6 +94,9 @@ public Action Event_OnPlayerSpawn(Handle event, const char[] name, bool dontBroa { g_WrcpStage[client] = 1; g_Stage[0][client] = 1; + g_CurrentStage[client] = 1; + g_Stage[g_iClientInZone[client][2]][client] = 1; + g_bWrcpTimeractivated[client] = false; } if (g_iCurrentStyle[client] == 4) // 4 low gravity @@ -491,9 +494,7 @@ public Action Say_Hook(int client, const char[] command, int argc) char szStyle[128]; Format(szStyle, sizeof(szStyle), g_szStyleAcronyms[g_iCurrentStyle[client]]); StringToUpper(szStyle); - Format(szStyle, sizeof(szStyle), "%s-", szStyle); - ReplaceString(szChatRank2, sizeof(szChatRank2), "{style}", szStyle); - Format(szChatRank, sizeof(szChatRank), "%s", szChatRank2); + Format(szChatRank, 154, "[%s] %s", szStyle, szChatRank2); } else ReplaceString(szChatRank, sizeof(szChatRank), "{style}", "");