1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-03-22 13:19:40 +01:00

Sample usage of new listener API

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40143
This commit is contained in:
David Anderson 2005-10-21 07:22:37 +00:00
parent e24876a8cd
commit b520145da6
2 changed files with 11 additions and 1 deletions

View File

@ -25,6 +25,11 @@ bool SamplePlugin::LevelInit(const char *pMapName, const char *pMapEntities, con
RETURN_META_VALUE(MRES_IGNORED, true);
}
void SamplePlugin::OnLevelShutdown()
{
META_LOG(g_PLAPI, "OnLevelShutdown() called from listener");
}
void SamplePlugin::ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
META_LOG(g_PLAPI, "ServerActivate() called: edictCount=%d, clientMax=%d", edictCount, clientMax);
@ -173,6 +178,8 @@ bool SamplePlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
SH_CALL(m_Engine_CC, &IVEngineServer::LogPrint)("All hooks started!\n");
g_SMAPI->AddListener(g_PLAPI, this);
return true;
}

View File

@ -17,7 +17,7 @@
#define SAMPLE_VERSION "1.10"
class SamplePlugin : public ISmmPlugin
class SamplePlugin : public ISmmPlugin, public IMetamodListener
{
public:
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
@ -107,6 +107,9 @@ public:
// You can still supercede the gamedll through RETURN_META(MRES_SUPERCEDE).
void ClientCommand(edict_t *pEntity);
//From IMetamodListener
virtual void OnLevelShutdown();
private:
IGameEventManager2 *m_GameEventManager;
IVEngineServer *m_Engine;