1 /* ======== sample_mm ========
2 * Copyright (C) 2004-2005 Metamod:Source Development Team
3 * No warranties of any kind
7 * Author(s): David "BAILOPAN" Anderson
8 * ============================
11 #ifndef _INCLUDE_SAMPLEPLUGIN_H
12 #define _INCLUDE_SAMPLEPLUGIN_H
14 #include <ISmmPlugin.h>
15 #include <sourcehook/sourcehook.h>
16 #include <igameevents.h>
18 #define SAMPLE_VERSION "1.10"
20 class SamplePlugin : public ISmmPlugin
23 bool Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen);
24 bool Unload(char *error, size_t maxlen);
25 void AllPluginsLoaded();
26 bool Pause(char *error, size_t maxlen)
30 bool Unpause(char *error, size_t maxlen)
35 int GetApiVersion() { return PLAPI_VERSION; }
37 const char *GetAuthor()
43 return "Sample Plugin";
45 const char *GetDescription()
47 return "Sample plugin that hooks basic things";
51 return "http://www.sourcemm.net/";
53 const char *GetLicense()
57 const char *GetVersion()
59 return SAMPLE_VERSION;
65 const char *GetLogTag()
70 //These functions are from IServerPluginCallbacks
71 //Note, the parameters might be a little different to match the actual calls!
73 //Called on LevelInit. Server plugins only have pMapName
74 bool LevelInit(const char *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
76 //Called on ServerActivate. Same definition as server plugins
77 void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
79 //Called on a game tick. Same definition as server plugins
80 void GameFrame(bool simulating);
82 //Called on level shutdown. Same definition as server plugins
83 void LevelShutdown(void);
85 //Client is activate (whatever that means). We get an extra parameter...
86 // "If bLoadGame is true, don't spawn the player because its state is already setup."
87 void ClientActive(edict_t *pEntity, bool bLoadGame);
89 //Client disconnects - same as server plugins
90 void ClientDisconnect(edict_t *pEntity);
92 //Client is put in server - same as server plugins
93 void ClientPutInServer(edict_t *pEntity, char const *playername);
95 //Sets the client index - same as server plugins
96 void SetCommandClient(int index);
98 //Called on client settings changed (duh) - same as server plugins
99 void ClientSettingsChanged(edict_t *pEdict);
101 //Called on client connect. Unlike server plugins, we return whether the
102 // connection is allowed rather than set it through a pointer in the first parameter.
103 // You can still supercede the GameDLL through RETURN_META_VALUE(MRES_SUPERCEDE, true/false)
104 bool ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
106 //Called when a client uses a command. Unlike server plugins, it's void.
107 // You can still supercede the gamedll through RETURN_META(MRES_SUPERCEDE).
108 void ClientCommand(edict_t *pEntity);
111 IGameEventManager2 *m_GameEventManager;
112 IVEngineServer *m_Engine;
113 IServerGameDLL *m_ServerDll;
114 IServerGameClients *m_ServerClients;
115 SourceHook::CallClass<IVEngineServer> *m_Engine_CC;
118 extern SamplePlugin g_SamplePlugin;
121 bool FireEvent_Handler(IGameEvent *event, bool bDontBroadcast);
123 #endif //_INCLUDE_SAMPLEPLUGIN_H