stub_mm/stub_mm.cpp
changeset 378 771bb7db49de
child 394 ba7a29343ea1
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/stub_mm/stub_mm.cpp	Sat Oct 06 17:01:51 2007 +0000
     1.3 @@ -0,0 +1,108 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * ======================================================
     1.7 + * Metamod:Source Stub Plugin
     1.8 + * Written by AlliedModders LLC.
     1.9 + * ======================================================
    1.10 + *
    1.11 + * This software is provided 'as-is', without any express or implied warranty.
    1.12 + * In no event will the authors be held liable for any damages arising from 
    1.13 + * the use of this software.
    1.14 + *
    1.15 + * This stub plugin is public domain.
    1.16 + *
    1.17 + * Version: $Id$
    1.18 + */
    1.19 +
    1.20 +#include <stdio.h>
    1.21 +#include "stub_mm.h"
    1.22 +
    1.23 +SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
    1.24 +
    1.25 +StubPlugin g_StubPlugin;
    1.26 +IServerGameDLL *server = NULL;
    1.27 +int hidServerActivate = 0;
    1.28 +
    1.29 +PLUGIN_EXPOSE(StubPlugin, g_StubPlugin);
    1.30 +bool StubPlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
    1.31 +{
    1.32 +	PLUGIN_SAVEVARS();
    1.33 +
    1.34 +	GET_V_IFACE_ANY(GetServerFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
    1.35 +
    1.36 +	hidServerActivate = SH_ADD_HOOK(IServerGameDLL, ServerActivate, server, SH_STATIC(Hook_ServerActivate), true);
    1.37 +
    1.38 +	return true;
    1.39 +}
    1.40 +
    1.41 +bool StubPlugin::Unload(char *error, size_t maxlen)
    1.42 +{
    1.43 +	if (hidServerActivate != 0)
    1.44 +	{
    1.45 +		SH_REMOVE_HOOK_ID(hidServerActivate);
    1.46 +	}
    1.47 +
    1.48 +	return true;
    1.49 +}
    1.50 +
    1.51 +void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
    1.52 +{
    1.53 +	META_LOG(g_PLAPI, "ServerActivate() called: edictCount = %d, clientMax = %d", edictCount, clientMax);
    1.54 +}
    1.55 +
    1.56 +void StubPlugin::AllPluginsLoaded()
    1.57 +{
    1.58 +	/* This is where we'd do stuff that relies on the mod or other plugins 
    1.59 +	 * being initialized (for example, cvars added and events registered).
    1.60 +	 */
    1.61 +}
    1.62 +
    1.63 +bool StubPlugin::Pause(char *error, size_t maxlen)
    1.64 +{
    1.65 +	return true;
    1.66 +}
    1.67 +
    1.68 +bool StubPlugin::Unpause(char *error, size_t maxlen)
    1.69 +{
    1.70 +	return true;
    1.71 +}
    1.72 +
    1.73 +const char *StubPlugin::GetLicense()
    1.74 +{
    1.75 +	return "Public Domain";
    1.76 +}
    1.77 +
    1.78 +const char *StubPlugin::GetVersion()
    1.79 +{
    1.80 +	return "1.0.0.0";
    1.81 +}
    1.82 +
    1.83 +const char *StubPlugin::GetDate()
    1.84 +{
    1.85 +	return __DATE__;
    1.86 +}
    1.87 +
    1.88 +const char *StubPlugin::GetLogTag()
    1.89 +{
    1.90 +	return "STUB";
    1.91 +}
    1.92 +
    1.93 +const char *StubPlugin::GetAuthor()
    1.94 +{
    1.95 +	return "AlliedModders LLC";
    1.96 +}
    1.97 +
    1.98 +const char *StubPlugin::GetDescription()
    1.99 +{
   1.100 +	return "Sample empty plugin";
   1.101 +}
   1.102 +
   1.103 +const char *StubPlugin::GetName()
   1.104 +{
   1.105 +	return "Stub Plugin";
   1.106 +}
   1.107 +
   1.108 +const char *StubPlugin::GetURL()
   1.109 +{
   1.110 +	return "http://www.sourcemm.net/";
   1.111 +}