2005-04-17 05:37:50 +02:00
|
|
|
#include <oslink.h>
|
2005-04-16 21:59:26 +02:00
|
|
|
#include "SamplePlugin.h"
|
|
|
|
|
|
|
|
SamplePlugin g_SamplePlugin;
|
|
|
|
|
|
|
|
PLUGIN_EXPOSE(SamplePlugin, g_SamplePlugin);
|
|
|
|
|
2005-04-18 21:33:44 +02:00
|
|
|
SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, char const *, char const *, char const *, char const *, bool, bool);
|
2005-04-17 05:37:50 +02:00
|
|
|
|
2005-04-18 21:33:44 +02:00
|
|
|
bool LevelInit_handler( char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background );
|
2005-04-17 05:37:50 +02:00
|
|
|
|
2005-04-16 21:59:26 +02:00
|
|
|
bool SamplePlugin::Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen)
|
|
|
|
{
|
|
|
|
PLUGIN_SAVEVARS();
|
|
|
|
|
2005-04-17 05:37:50 +02:00
|
|
|
IServerGameDLL *isgd = (IServerGameDLL *)((ismm->serverFactory())(INTERFACEVERSION_SERVERGAMEDLL, NULL));
|
|
|
|
|
|
|
|
if (!isgd)
|
|
|
|
{
|
|
|
|
snprintf(error, maxlen, "Could not find interface %s", INTERFACEVERSION_SERVERGAMEDLL);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-04-18 21:33:44 +02:00
|
|
|
SH_ADD_HOOK_STATICFUNC(IServerGameDLL, LevelInit, isgd, LevelInit_handler, false);
|
2005-04-17 05:37:50 +02:00
|
|
|
|
2005-04-16 21:59:26 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SamplePlugin::Unload(char *error, size_t maxlen)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2005-04-17 05:37:50 +02:00
|
|
|
|
2005-04-18 21:33:44 +02:00
|
|
|
void SamplePlugin::AllPluginsLoaded()
|
|
|
|
{
|
|
|
|
//we don't really care
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LevelInit_handler( char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background )
|
2005-04-17 05:37:50 +02:00
|
|
|
{
|
|
|
|
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);
|
2005-04-18 21:33:44 +02:00
|
|
|
}
|