00001 /** 00002 * vim: set ts=4 : 00003 * ============================================================================= 00004 * SourceMod Sample Extension 00005 * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. 00006 * ============================================================================= 00007 * 00008 * This program is free software; you can redistribute it and/or modify it under 00009 * the terms of the GNU General Public License, version 3.0, as published by the 00010 * Free Software Foundation. 00011 * 00012 * This program is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00014 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00015 * details. 00016 * 00017 * You should have received a copy of the GNU General Public License along with 00018 * this program. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 * As a special exception, AlliedModders LLC gives you permission to link the 00021 * code of this program (as well as its derivative works) to "Half-Life 2," the 00022 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software 00023 * by the Valve Corporation. You must obey the GNU General Public License in 00024 * all respects for all other code used. Additionally, AlliedModders LLC grants 00025 * this exception to all derivative works. AlliedModders LLC defines further 00026 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), 00027 * or <http://www.sourcemod.net/license.php>. 00028 * 00029 * Version: $Id$ 00030 */ 00031 00032 #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ 00033 #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ 00034 00035 /** 00036 * @file extension.h 00037 * @brief Sample extension code header. 00038 */ 00039 00040 #include "smsdk_ext.h" 00041 00042 00043 /** 00044 * @brief Sample implementation of the SDK Extension. 00045 * Note: Uncomment one of the pre-defined virtual functions in order to use it. 00046 */ 00047 class Sample : public SDKExtension 00048 { 00049 public: 00050 /** 00051 * @brief This is called after the initial loading sequence has been processed. 00052 * 00053 * @param error Error message buffer. 00054 * @param maxlength Size of error message buffer. 00055 * @param late Whether or not the module was loaded after map load. 00056 * @return True to succeed loading, false to fail. 00057 */ 00058 //virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); 00059 00060 /** 00061 * @brief This is called right before the extension is unloaded. 00062 */ 00063 //virtual void SDK_OnUnload(); 00064 00065 /** 00066 * @brief This is called once all known extensions have been loaded. 00067 * Note: It is is a good idea to add natives here, if any are provided. 00068 */ 00069 //virtual void SDK_OnAllLoaded(); 00070 00071 /** 00072 * @brief Called when the pause state is changed. 00073 */ 00074 //virtual void SDK_OnPauseChange(bool paused); 00075 00076 /** 00077 * @brief this is called when Core wants to know if your extension is working. 00078 * 00079 * @param error Error message buffer. 00080 * @param maxlength Size of error message buffer. 00081 * @return True if working, false otherwise. 00082 */ 00083 //virtual bool QueryRunning(char *error, size_t maxlength); 00084 public: 00085 #if defined SMEXT_CONF_METAMOD 00086 /** 00087 * @brief Called when Metamod is attached, before the extension version is called. 00088 * 00089 * @param error Error buffer. 00090 * @param maxlength Maximum size of error buffer. 00091 * @param late Whether or not Metamod considers this a late load. 00092 * @return True to succeed, false to fail. 00093 */ 00094 //virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late); 00095 00096 /** 00097 * @brief Called when Metamod is detaching, after the extension version is called. 00098 * NOTE: By default this is blocked unless sent from SourceMod. 00099 * 00100 * @param error Error buffer. 00101 * @param maxlength Maximum size of error buffer. 00102 * @return True to succeed, false to fail. 00103 */ 00104 //virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength); 00105 00106 /** 00107 * @brief Called when Metamod's pause state is changing. 00108 * NOTE: By default this is blocked unless sent from SourceMod. 00109 * 00110 * @param paused Pause state being set. 00111 * @param error Error buffer. 00112 * @param maxlength Maximum size of error buffer. 00113 * @return True to succeed, false to fail. 00114 */ 00115 //virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength); 00116 #endif 00117 }; 00118 00119 #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
1.7.1