1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-12-01 13:24:25 +01:00
HLMetaModOfficial/sourcemm/sample_mm/SamplePlugin.cpp
David Anderson e2100056f4 Fixed a few bugs in console commands
Added hooking of shutdown commands
Warning - Crashes on SH_ADD_HOOK_STATICFUNC?

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4013
2005-04-17 03:37:50 +00:00

46 lines
1.3 KiB
C++

#include <oslink.h>
#include "SamplePlugin.h"
SamplePlugin g_SamplePlugin;
PLUGIN_EXPOSE(SamplePlugin, g_SamplePlugin);
//SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, char const *, char const *, char const *, char const *, bool, bool);
//bool LevelInit_handler( char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background );
bool SamplePlugin::Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen)
{
PLUGIN_SAVEVARS();
IServerGameDLL *isgd = (IServerGameDLL *)((ismm->serverFactory())(INTERFACEVERSION_SERVERGAMEDLL, NULL));
if (!isgd)
{
snprintf(error, maxlen, "Could not find interface %s", INTERFACEVERSION_SERVERGAMEDLL);
return false;
}
//SH_ADD_HOOK_STATICFUNC(IServerGameDLL, LevelInit, isgd, LevelInit_handler, false);
return true;
}
bool SamplePlugin::Unload(char *error, size_t maxlen)
{
return true;
}
/*bool LevelInit_handler( char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background )
{
FILE *fp = fopen("c:\\dump.txt", "at");
if (!fp)
RETURN_META_VALUE(MRES_IGNORED, false);
fprintf(fp, "Map name: %s (old level: %s)\n", pMapName?pMapName:"", pOldLevel?pOldLevel:"");
fclose(fp);
RETURN_META_VALUE(MRES_IGNORED, false);
}*/