From 3b2ec55fb52d8c46791c81c03a6b0643b2459f01 Mon Sep 17 00:00:00 2001 From: BotoX Date: Thu, 28 Nov 2019 15:15:32 +0100 Subject: [PATCH] Fix server crash when unloading CSSFixes --- DamageProxy/scripting/DamageProxy.sp | 10 +++++++++- LagCompensation/scripting/LagCompensation.sp | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/DamageProxy/scripting/DamageProxy.sp b/DamageProxy/scripting/DamageProxy.sp index 2c0f0262..1e761f7c 100644 --- a/DamageProxy/scripting/DamageProxy.sp +++ b/DamageProxy/scripting/DamageProxy.sp @@ -19,6 +19,7 @@ public Plugin myinfo = }; bool g_bLateLoad = false; +bool g_bHasCSSFixes = true; Handle g_hFireBulletDetour; int g_hVelocityModifier; @@ -62,9 +63,16 @@ public void OnPluginStart() PhysboxToClientMap(g_iPhysboxToClient, true); } +public void OnLibraryRemoved(const char[] name) +{ + if(StrEqual(name, "CSSFixes")) + g_bHasCSSFixes = false; +} + public void OnPluginEnd() { - PhysboxToClientMap(g_iPhysboxToClient, false); + if(g_bHasCSSFixes) + PhysboxToClientMap(g_iPhysboxToClient, false); } public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) diff --git a/LagCompensation/scripting/LagCompensation.sp b/LagCompensation/scripting/LagCompensation.sp index e1d6c821..f20d648e 100644 --- a/LagCompensation/scripting/LagCompensation.sp +++ b/LagCompensation/scripting/LagCompensation.sp @@ -21,6 +21,7 @@ public Plugin myinfo = }; bool g_bLateLoad = false; +bool g_bHasCSSFixes = true; // Don't change this. #define MAX_EDICTS 2048 @@ -280,12 +281,21 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max return APLRes_Success; } +public void OnLibraryRemoved(const char[] name) +{ + if(StrEqual(name, "CSSFixes")) + g_bHasCSSFixes = false; +} + public void OnPluginEnd() { g_bCleaningUp = true; - FilterClientEntityMap(g_aaFilterClientEntity, false); - BlockTriggerMoved(g_aBlockTriggerMoved, false); - FilterTriggerTouchPlayers(g_aFilterTriggerTouch, false); + if(g_bHasCSSFixes) + { + FilterClientEntityMap(g_aaFilterClientEntity, false); + BlockTriggerMoved(g_aBlockTriggerMoved, false); + FilterTriggerTouchPlayers(g_aFilterTriggerTouch, false); + } DHookDisableDetour(g_hUTIL_Remove, false, Detour_OnUTIL_Remove);