From 1ca1c020e95b9a129fe36902f79ff5305f7d8328 Mon Sep 17 00:00:00 2001 From: mariokeks <82907647+mariokeks@users.noreply.github.com> Date: Sun, 21 Jun 2026 20:59:58 +0200 Subject: [PATCH] Fix always reading from index 0 in the paths ArrayList --- .../scripting/include/offstyledb_shavit.inc | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/addons/sourcemod/scripting/include/offstyledb_shavit.inc b/addons/sourcemod/scripting/include/offstyledb_shavit.inc index 42a2b8c..86cce16 100644 --- a/addons/sourcemod/scripting/include/offstyledb_shavit.inc +++ b/addons/sourcemod/scripting/include/offstyledb_shavit.inc @@ -242,20 +242,37 @@ public void Shavit_AddAdditionalReplayPathsHere(int client, int style, float tim public void Shavit_OnReplaySaved(int client, int style, float time, int jumps, int strafes, float sync, int track, float oldtime, float perfs, float avgvel, float maxvel, int timestamp, bool isbestreplay, bool istoolong, ArrayList replaypaths, ArrayList frames, int preframes, int postframes, const char[] name) { - char replayPath[PLATFORM_MAX_PATH]; - if (replaypaths != null && replaypaths.Length > 0) - { - replaypaths.GetString(0, replayPath, sizeof(replayPath)); - } - - // A non-canonical save (isbestreplay=false) is ours only if the path lives in - // our temp dir - other plugins may register their own extra replay paths too. - bool isOurCopy = !isbestreplay && replayPath[0] != '\0' && IsTempReplayPath(replayPath); + if(istoolong) + { + return; + } - if (!isbestreplay && !isOurCopy) - { - return; - } + char replayPath[PLATFORM_MAX_PATH]; + // A non-canonical save (isbestreplay=false) is ours only if the path lives in + // our temp dir - other plugins may register their own extra replay paths too. + bool isOurCopy = false; + + if(isbestreplay) + { + replaypaths.GetString(0, replayPath, sizeof(replayPath)); + } + else + { + for(int i = 0; i < replaypaths.Length; i++) + { + replaypaths.GetString(i, replayPath, sizeof(replayPath)); + if(IsTempReplayPath(replayPath)) + { + isOurCopy = true; + break; + } + } + + if(!isOurCopy) + { + return; + } + } Records_HandleReplaySaved(client, isbestreplay, replayPath, isOurCopy); }