sample_mm/sample_mm.h
changeset 379 e8a3f2617a3e
child 497 e6abd02a6a95
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sample_mm/sample_mm.h	Sun Oct 07 03:12:19 2007 +0000
     1.3 @@ -0,0 +1,78 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * ======================================================
     1.7 + * Metamod:Source Sample 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 sample plugin is public domain.
    1.16 + *
    1.17 + * Version: $Id$
    1.18 + */
    1.19 +
    1.20 +#ifndef _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
    1.21 +#define _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
    1.22 +
    1.23 +#include <ISmmPlugin.h>
    1.24 +#include <igameevents.h>
    1.25 +#include <iplayerinfo.h>
    1.26 +#include <sh_vector.h>
    1.27 +#include "engine_wrappers.h"
    1.28 +
    1.29 +class StubPlugin : public ISmmPlugin, public IMetamodListener
    1.30 +{
    1.31 +public:
    1.32 +	bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
    1.33 +	bool Unload(char *error, size_t maxlen);
    1.34 +	bool Pause(char *error, size_t maxlen);
    1.35 +	bool Unpause(char *error, size_t maxlen);
    1.36 +	void AllPluginsLoaded();
    1.37 +public: //IMetamodListener stuff
    1.38 +	void OnVSPListening(IServerPluginCallbacks *iface);
    1.39 +public: //hooks
    1.40 +	void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
    1.41 +	bool Hook_LevelInit(const char *pMapName,
    1.42 +		char const *pMapEntities,
    1.43 +		char const *pOldLevel,
    1.44 +		char const *pLandmarkName,
    1.45 +		bool loadGame,
    1.46 +		bool background);
    1.47 +	void Hook_GameFrame(bool simulating);
    1.48 +	void Hook_LevelShutdown(void);
    1.49 +	void Hook_ClientActive(edict_t *pEntity, bool bLoadGame);
    1.50 +	void Hook_ClientDisconnect(edict_t *pEntity);
    1.51 +	void Hook_ClientPutInServer(edict_t *pEntity, char const *playername);
    1.52 +	void Hook_SetCommandClient(int index);
    1.53 +	void Hook_ClientSettingsChanged(edict_t *pEdict);
    1.54 +	bool Hook_ClientConnect(edict_t *pEntity, 
    1.55 +		const char *pszName,
    1.56 +		const char *pszAddress,
    1.57 +		char *reject,
    1.58 +		int maxrejectlen);
    1.59 +#if defined ORANGEBOX_BUILD
    1.60 +	void Hook_ClientCommand(edict_t *pEntity, const CCommand &args);
    1.61 +#else
    1.62 +	void Hook_ClientCommand(edict_t *pEntity);
    1.63 +#endif
    1.64 +public:
    1.65 +	const char *GetAuthor();
    1.66 +	const char *GetName();
    1.67 +	const char *GetDescription();
    1.68 +	const char *GetURL();
    1.69 +	const char *GetLicense();
    1.70 +	const char *GetVersion();
    1.71 +	const char *GetDate();
    1.72 +	const char *GetLogTag();
    1.73 +private:
    1.74 +	SourceHook::CVector<int> m_hooks;
    1.75 +};
    1.76 +
    1.77 +extern StubPlugin g_StubPlugin;
    1.78 +
    1.79 +PLUGIN_GLOBALVARS();
    1.80 +
    1.81 +#endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_