[server] Update a few CGameMode and CFilterScripts functions

This commit is contained in:
RD42 2024-04-18 22:43:22 +08:00
parent 32f2bc4e94
commit 0eccd8405c
3 changed files with 9 additions and 0 deletions

View File

@ -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]);

View File

@ -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);

View File

@ -103,6 +103,7 @@ typedef unsigned short VEHICLEID;
extern CConsole* pConsole;
extern CNetGame* pNetGame;
extern CPlugins* pPlugins;
extern PLAYERID RconUser;