Fix server crash when unloading CSSFixes

This commit is contained in:
BotoX 2019-11-28 15:15:32 +01:00
parent 7af4170c00
commit 3b2ec55fb5
2 changed files with 22 additions and 4 deletions

View File

@ -19,6 +19,7 @@ public Plugin myinfo =
}; };
bool g_bLateLoad = false; bool g_bLateLoad = false;
bool g_bHasCSSFixes = true;
Handle g_hFireBulletDetour; Handle g_hFireBulletDetour;
int g_hVelocityModifier; int g_hVelocityModifier;
@ -62,8 +63,15 @@ public void OnPluginStart()
PhysboxToClientMap(g_iPhysboxToClient, true); PhysboxToClientMap(g_iPhysboxToClient, true);
} }
public void OnLibraryRemoved(const char[] name)
{
if(StrEqual(name, "CSSFixes"))
g_bHasCSSFixes = false;
}
public void OnPluginEnd() public void OnPluginEnd()
{ {
if(g_bHasCSSFixes)
PhysboxToClientMap(g_iPhysboxToClient, false); PhysboxToClientMap(g_iPhysboxToClient, false);
} }

View File

@ -21,6 +21,7 @@ public Plugin myinfo =
}; };
bool g_bLateLoad = false; bool g_bLateLoad = false;
bool g_bHasCSSFixes = true;
// Don't change this. // Don't change this.
#define MAX_EDICTS 2048 #define MAX_EDICTS 2048
@ -280,12 +281,21 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
return APLRes_Success; return APLRes_Success;
} }
public void OnLibraryRemoved(const char[] name)
{
if(StrEqual(name, "CSSFixes"))
g_bHasCSSFixes = false;
}
public void OnPluginEnd() public void OnPluginEnd()
{ {
g_bCleaningUp = true; g_bCleaningUp = true;
if(g_bHasCSSFixes)
{
FilterClientEntityMap(g_aaFilterClientEntity, false); FilterClientEntityMap(g_aaFilterClientEntity, false);
BlockTriggerMoved(g_aBlockTriggerMoved, false); BlockTriggerMoved(g_aBlockTriggerMoved, false);
FilterTriggerTouchPlayers(g_aFilterTriggerTouch, false); FilterTriggerTouchPlayers(g_aFilterTriggerTouch, false);
}
DHookDisableDetour(g_hUTIL_Remove, false, Detour_OnUTIL_Remove); DHookDisableDetour(g_hUTIL_Remove, false, Detour_OnUTIL_Remove);