You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SetFailState("[OSdb] bhoptimer version <4 detected, use the v3 build (offstyledb_v3.smx)");
163
-
}
164
-
elseif (smv>=5)
165
-
{
166
-
// probably needless but future proofing is nice ig
167
-
DebugPrint("bhoptimer version >4 detected, there may be compatibility issues, check for update here https://github.com/offstyles/offstyle-plugins/releases");
168
-
}
169
-
170
151
EnsureTempReplayDir();
171
152
#endif
172
153
}
173
154
155
+
// Which shavit major version this .smx was compiled for. Compile-time constant,
156
+
// not a runtime query.
157
+
intShavitCompat_BuildVersion()
158
+
{
159
+
#if defined SHAVIT_V3
160
+
return3;
161
+
#else
162
+
return4;
163
+
#endif
164
+
}
165
+
166
+
// Runtime detection of the shavit major version actually loaded on the server.
167
+
// Keyed on Shavit_AlsoSaveReplayTo, which is a v4-only native.
168
+
intShavitCompat_DetectRunningVersion()
169
+
{
170
+
if (GetFeatureStatus(FeatureType_Native, "Shavit_AlsoSaveReplayTo") ==FeatureStatus_Available)
171
+
{
172
+
return4;
173
+
}
174
+
return3;
175
+
}
176
+
174
177
// --- Shavit forwards: thin adapters delegating to the records layer ---
Copy file name to clipboardExpand all lines: addons/sourcemod/scripting/include/offstyledb_updater.inc
+179Lines changed: 179 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -249,3 +249,182 @@ public Action Command_ApplyUpdate(int client, int args)
249
249
returnPlugin_Handled;
250
250
}
251
251
252
+
// Called from OnAllPluginsLoaded once shavit natives have been resolved.
253
+
// Detects mismatch between this build and the running shavit version, and
254
+
// triggers a build switch when OSdb_autoupdate is 2.
255
+
voidUpdater_CheckBuildMatch()
256
+
{
257
+
intrunning=ShavitCompat_DetectRunningVersion();
258
+
intbuilt=ShavitCompat_BuildVersion();
259
+
260
+
if (running==built)
261
+
{
262
+
return;
263
+
}
264
+
265
+
gB_BuildMismatch=true;
266
+
LogError("[OSdb] This is the shavit v%d build but the server is running shavit v%d. Records will not submit until the correct build is installed.", built, running);
267
+
268
+
intmode=gCV_AutoUpdate.IntValue;
269
+
if (mode==0)
270
+
{
271
+
PrintToServer("[OSdb] OSdb_autoupdate is 0 - install offstyledb%s.smx manually, or set OSdb_autoupdate 2 to auto-correct.", running==3?"_v3":"");
272
+
return;
273
+
}
274
+
if (mode<2)
275
+
{
276
+
PrintToServer("[OSdb] Set OSdb_autoupdate 2 to auto-download the correct build, or manually install offstyledb%s.smx.", running==3?"_v3":"");
277
+
return;
278
+
}
279
+
280
+
PrintToServer("[OSdb] Auto-switching to offstyledb%s.smx...", running==3?"_v3":"");
281
+
Updater_SwitchToBuild(running);
282
+
}
283
+
284
+
// Fetches the latest release and downloads the OTHER build's .smx asset, then
0 commit comments