sample_mm/sample_mm.h
author David Anderson <dvander@alliedmods.net>
Sun Feb 17 23:48:56 2008 +0000 (2008-02-17)
changeset 508 7281e18fdff6
parent 497 e6abd02a6a95
child 605 131878209276
permissions -rw-r--r--
removed linker warnings in debug mode
     1 /**
     2  * vim: set ts=4 :
     3  * ======================================================
     4  * Metamod:Source Sample Plugin
     5  * Written by AlliedModders LLC.
     6  * ======================================================
     7  *
     8  * This software is provided 'as-is', without any express or implied warranty.
     9  * In no event will the authors be held liable for any damages arising from 
    10  * the use of this software.
    11  *
    12  * This sample plugin is public domain.
    13  *
    14  * Version: $Id$
    15  */
    16 
    17 #ifndef _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
    18 #define _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
    19 
    20 #include <ISmmPlugin.h>
    21 #include <igameevents.h>
    22 #include <iplayerinfo.h>
    23 #include <sh_vector.h>
    24 #include "engine_wrappers.h"
    25 
    26 #if defined WIN32 && !defined snprintf
    27 #define snprintf _snprintf
    28 #endif
    29 
    30 class StubPlugin : public ISmmPlugin, public IMetamodListener
    31 {
    32 public:
    33 	bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
    34 	bool Unload(char *error, size_t maxlen);
    35 	bool Pause(char *error, size_t maxlen);
    36 	bool Unpause(char *error, size_t maxlen);
    37 	void AllPluginsLoaded();
    38 public: //IMetamodListener stuff
    39 	void OnVSPListening(IServerPluginCallbacks *iface);
    40 public: //hooks
    41 	void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
    42 	bool Hook_LevelInit(const char *pMapName,
    43 		char const *pMapEntities,
    44 		char const *pOldLevel,
    45 		char const *pLandmarkName,
    46 		bool loadGame,
    47 		bool background);
    48 	void Hook_GameFrame(bool simulating);
    49 	void Hook_LevelShutdown(void);
    50 	void Hook_ClientActive(edict_t *pEntity, bool bLoadGame);
    51 	void Hook_ClientDisconnect(edict_t *pEntity);
    52 	void Hook_ClientPutInServer(edict_t *pEntity, char const *playername);
    53 	void Hook_SetCommandClient(int index);
    54 	void Hook_ClientSettingsChanged(edict_t *pEdict);
    55 	bool Hook_ClientConnect(edict_t *pEntity, 
    56 		const char *pszName,
    57 		const char *pszAddress,
    58 		char *reject,
    59 		int maxrejectlen);
    60 #if defined ENGINE_ORANGEBOX
    61 	void Hook_ClientCommand(edict_t *pEntity, const CCommand &args);
    62 #elif defined ENGINE_ORIGINAL
    63 	void Hook_ClientCommand(edict_t *pEntity);
    64 #endif
    65 public:
    66 	const char *GetAuthor();
    67 	const char *GetName();
    68 	const char *GetDescription();
    69 	const char *GetURL();
    70 	const char *GetLicense();
    71 	const char *GetVersion();
    72 	const char *GetDate();
    73 	const char *GetLogTag();
    74 private:
    75 #if defined ENGINE_ORIGINAL
    76 	SourceHook::CallClass<IVEngineServer> *m_EngineCC;
    77 #endif
    78 };
    79 
    80 extern StubPlugin g_StubPlugin;
    81 
    82 PLUGIN_GLOBALVARS();
    83 
    84 #endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_