1 /* ======== SourceMM ========
2 * Copyright (C) 2004-2007 Metamod:Source Development Team
3 * No warranties of any kind
7 * Author(s): David "BAILOPAN" Anderson
8 * ============================
11 #include "vsp_listener.h"
14 using namespace SourceMM;
16 VSPListener g_VspListener;
18 VSPListener::VSPListener()
24 void VSPListener::ClientActive(edict_t *pEntity)
28 PLUGIN_RESULT VSPListener::ClientCommand(edict_t *pEntity)
30 return PLUGIN_CONTINUE;
33 PLUGIN_RESULT VSPListener::ClientConnect(bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
35 return PLUGIN_CONTINUE;
38 void VSPListener::ClientDisconnect(edict_t *pEntity)
42 void VSPListener::ClientPutInServer(edict_t *pEntity, char const *playername)
46 void VSPListener::ClientSettingsChanged(edict_t *pEdict)
50 void VSPListener::SetCommandClient(int index)
54 void VSPListener::GameFrame(bool simulating)
58 const char *VSPListener::GetPluginDescription()
60 return "Metamod:Source Interface v" SOURCEMM_VERSION;
63 bool VSPListener::IsLoaded()
68 void VSPListener::LevelInit(char const *pMapName)
72 void VSPListener::LevelShutdown()
76 PLUGIN_RESULT VSPListener::NetworkIDValidated(const char *pszUserName, const char *pszNetworkID)
78 return PLUGIN_CONTINUE;
81 void VSPListener::Pause()
85 void VSPListener::UnPause()
89 void VSPListener::ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
93 void VSPListener::Unload()
97 void VSPListener::SetLoadable(bool set)
102 bool VSPListener::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gameServerFactory)
104 if (!g_GameDll.loaded)
106 Error("Metamod:Source is not a Valve Server Plugin\n");
113 Warning("Do not manually load Metamod:Source as a Valve Server Plugin\n");
127 CPluginManager::CPlugin *pPlugin;
128 SourceHook::List<IMetamodListener *>::iterator event;
129 IMetamodListener *pML;
130 for (iter=g_PluginMngr._begin(); iter!=g_PluginMngr._end(); iter++)
133 if (pPlugin->m_Status < Pl_Paused)
137 /* Only valid for plugins >= 10 (v1:5, SourceMM 1.4) */
138 if (pPlugin->m_API->GetApiVersion() < 10)
142 for (event=pPlugin->m_Events.begin();
143 event!=pPlugin->m_Events.end();
147 pML->OnVSPListening(this);