Skip to content

Commit

Permalink
Fix tpanglefix crashing servers on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
zer0k-z committed May 4, 2023
1 parent 11a078b commit b46d96b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addons/sourcemod/gamedata/gokz-tpanglefix.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"WriteViewAngleUpdateReliableOffset"
{
"windows" "363"
"linux" "290"
"linux" "294"
}
"ClientIndexOffset"
{
Expand Down
11 changes: 11 additions & 0 deletions addons/sourcemod/scripting/gokz-tpanglefix.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Address>(gI_ClientOffset), NumberType_Int32);
Expand Down

0 comments on commit b46d96b

Please sign in to comment.