From 0eccd8405cdab1a2a9b998bc2ce4372824c1de2b Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Thu, 18 Apr 2024 22:43:22 +0800 Subject: [PATCH] [server] Update a few CGameMode and CFilterScripts functions --- server/filterscripts.cpp | 5 +++++ server/gamemodes.cpp | 3 +++ server/main.h | 1 + 3 files changed, 9 insertions(+) diff --git a/server/filterscripts.cpp b/server/filterscripts.cpp index c0b68d0..0350dfa 100644 --- a/server/filterscripts.cpp +++ b/server/filterscripts.cpp @@ -76,6 +76,8 @@ bool CFilterScripts::LoadFilterScript(char* pFileName) amx_CustomInit(amx); amx_sampDbInit(amx); + pPlugins->DoAmxLoad(amx); + int tmp; if (!amx_FindPublic(amx, "OnFilterScriptInit", &tmp)) amx_Exec(amx, (cell*)&tmp, tmp); @@ -121,6 +123,8 @@ bool CFilterScripts::LoadFilterScriptFromMemory(char* pFileName, char* pFileData amx_CustomInit(amx); amx_sampDbInit(amx); + pPlugins->DoAmxLoad(amx); + int tmp; if (!amx_FindPublic(amx, "OnFilterScriptInit", &tmp)) amx_Exec(amx, (cell*)&tmp, tmp); @@ -181,6 +185,7 @@ void CFilterScripts::RemoveFilterScript(int iIndex) // Do the other stuff from before aux_FreeProgram(m_pFilterScripts[iIndex]); + pPlugins->DoAmxUnload(m_pFilterScripts[iIndex]); amx_TimeCleanup(m_pFilterScripts[iIndex]); amx_FileCleanup(m_pFilterScripts[iIndex]); diff --git a/server/gamemodes.cpp b/server/gamemodes.cpp index c9881eb..160cedf 100644 --- a/server/gamemodes.cpp +++ b/server/gamemodes.cpp @@ -71,6 +71,8 @@ bool CGameMode::Load(char* pFileName) amx_CustomInit(&m_amx); amx_sampDbInit(&m_amx); + pPlugins->DoAmxLoad(&m_amx); + m_bInitialised = true; // Execute OnGameModeInit callback, if it exists! @@ -117,6 +119,7 @@ void CGameMode::Unload() if (m_bInitialised) { aux_FreeProgram(&m_amx); + pPlugins->DoAmxUnload(&m_amx); amx_sampDbCleanup(&m_amx); amx_TimeCleanup(&m_amx); amx_FileCleanup(&m_amx); diff --git a/server/main.h b/server/main.h index 7432b19..c41e8ff 100644 --- a/server/main.h +++ b/server/main.h @@ -103,6 +103,7 @@ typedef unsigned short VEHICLEID; extern CConsole* pConsole; extern CNetGame* pNetGame; +extern CPlugins* pPlugins; extern PLAYERID RconUser;