sourcemm/stub_mm/stub_mm.cpp
author Scott Ehlert <ds@alliedmods.net>
Sun May 22 04:33:58 2005 +0000 (2005-05-22)
changeset 66 ddefc8bfb9fa
parent 53 797ecc5394d6
child 140 800dc9ba92c5
permissions -rw-r--r--
Added macro so that ConCommands created with the SDK's CON_COMMAND and CON_COMMAND_F macros can be properly registered and unregisterd
     1 /* ======== stub_mm ========
     2 * Copyright (C) 2004-2005 Metamod:Source Development Team
     3 * No warranties of any kind
     4 *
     5 * License: zlib/libpng
     6 *
     7 * Author(s): David "BAILOPAN" Anderson
     8 * ============================
     9 */
    10 
    11 #include <oslink.h>
    12 #include "stub_mm.h"
    13 
    14 StubPlugin g_StubPlugin;
    15 
    16 PLUGIN_EXPOSE(SamplePlugin, g_StubPlugin);
    17 
    18 //This has all of the necessary hook declarations.  Read it!
    19 #include "meta_hooks.h"
    20 
    21 void ServerActivate_handler(edict_t *pEdictList, int edictCount, int clientMax)
    22 {
    23 	META_LOG(g_PLAPI, "ServerActivate() called: edictCount=%d, clientMax=%d", edictCount, clientMax);
    24 	RETURN_META(MRES_IGNORED);
    25 }
    26 
    27 bool StubPlugin::Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen)
    28 {
    29 	PLUGIN_SAVEVARS();
    30 
    31 	m_ServerDll = (IServerGameDLL *)((ismm->serverFactory())(INTERFACEVERSION_SERVERGAMEDLL, NULL));
    32 
    33 	if (!m_ServerDll)
    34 	{
    35 		snprintf(error, maxlen, "Could not find interface %s", INTERFACEVERSION_SERVERGAMEDLL);
    36 		return false;
    37 	}
    38 
    39 	SH_ADD_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, m_ServerDll, ServerActivate_handler, true);
    40 
    41 	return true;
    42 }
    43 
    44 bool StubPlugin::Unload(char *error, size_t maxlen)
    45 {
    46 	SH_REMOVE_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, m_ServerDll, ServerActivate_handler, true);
    47 
    48 	return true;
    49 }
    50 
    51 bool StubPlugin::Pause(char *error, size_t maxlen)
    52 {
    53 	return true;
    54 }
    55 
    56 bool StubPlugin::Unpause(char *error, size_t maxlen)
    57 {
    58 	return true;
    59 }
    60 
    61 void StubPlugin::AllPluginsLoaded()
    62 {
    63 
    64 }
    65 
    66 const char *StubPlugin::GetAuthor()
    67 {
    68 	return "AUTHOR";
    69 }
    70 
    71 const char *StubPlugin::GetName()
    72 {
    73 	return "Stub Plugin";
    74 }
    75 
    76 const char *StubPlugin::GetDescription()
    77 {
    78 	return "Stub Plugin";
    79 }
    80 
    81 const char *StubPlugin::GetURL()
    82 {
    83 	return "http://www.mysite.com/";
    84 }
    85 
    86 const char *StubPlugin::GetLicense()
    87 {
    88 	return "zlib/libpng";
    89 }
    90 
    91 const char *StubPlugin::GetVersion()
    92 {
    93 	return "1.00";
    94 }
    95 
    96 const char *StubPlugin::GetDate()
    97 {
    98 	return __DATE__;
    99 }
   100 
   101 const char *StubPlugin::GetLogTag()
   102 {
   103 	return "STUB";
   104 }