From b46d96bda3cbabab35cab8041f3af2a3819e7820 Mon Sep 17 00:00:00 2001 From: "zer0.k" Date: Thu, 4 May 2023 02:01:57 +0200 Subject: [PATCH] Fix tpanglefix crashing servers on linux --- addons/sourcemod/gamedata/gokz-tpanglefix.games.txt | 2 +- addons/sourcemod/scripting/gokz-tpanglefix.sp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/gamedata/gokz-tpanglefix.games.txt b/addons/sourcemod/gamedata/gokz-tpanglefix.games.txt index 0aef1863..62f903d7 100644 --- a/addons/sourcemod/gamedata/gokz-tpanglefix.games.txt +++ b/addons/sourcemod/gamedata/gokz-tpanglefix.games.txt @@ -32,7 +32,7 @@ "WriteViewAngleUpdateReliableOffset" { "windows" "363" - "linux" "290" + "linux" "294" } "ClientIndexOffset" { diff --git a/addons/sourcemod/scripting/gokz-tpanglefix.sp b/addons/sourcemod/scripting/gokz-tpanglefix.sp index 6c3d392a..62977958 100644 --- a/addons/sourcemod/scripting/gokz-tpanglefix.sp +++ b/addons/sourcemod/scripting/gokz-tpanglefix.sp @@ -96,12 +96,23 @@ void HookEvents() } // Prevent the server from crashing. FindConVar("sv_parallel_sendsnapshot").SetBool(false); + FindConVar("sv_parallel_sendsnapshot").AddChangeHook(OnParallelSendSnapshotCvarChanged); + gI_ClientOffset = gamedataConf.GetOffset("ClientIndexOffset"); if (gI_ClientOffset == -1) { SetFailState("Failed to get ClientIndexOffset offset."); } } + +void OnParallelSendSnapshotCvarChanged(ConVar convar, const char[] oldValue, const char[] newValue) +{ + if (convar.BoolValue) + { + convar.BoolValue = false; + } +} + public MRESReturn DHooks_OnWriteViewAngleUpdate_Pre(Address pThis) { int client = LoadFromAddress(pThis + view_as
(gI_ClientOffset), NumberType_Int32);