diff --git a/extensions/cstrike/Makefile b/extensions/cstrike/Makefile
new file mode 100644
index 00000000..1262cd63
--- /dev/null
+++ b/extensions/cstrike/Makefile
@@ -0,0 +1,86 @@
+#(C)2004-2006 SourceMM Development Team
+# Makefile written by David "BAILOPAN" Anderson
+
+SMSDK = ../..
+SRCDS = ~/srcds
+SOURCEMM = ../../../sourcemm
+HL2SDK = ../../../hl2sdk
+
+#####################################
+### EDIT BELOW FOR OTHER PROJECTS ###
+#####################################
+
+PROJECT = sample
+
+#Uncomment for SourceMM-enabled extensions
+#LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
+
+OBJECTS = sdk/smsdk_ext.cpp extension.cpp
+
+##############################################
+### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
+##############################################
+
+C_OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing
+C_DEBUG_FLAGS = -g -ggdb3
+CPP_GCC4_FLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
+CPP = gcc-4.1
+
+HL2PUB = $(HL2SDK)/public
+HL2LIB = $(HL2SDK)/linux_sdk
+
+LINK = $(LINK_HL2) -static-libgcc
+
+INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
+ -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SOURCEMM) -I$(SOURCEMM)/sourcehook -I$(SOURCEMM)/sourcemm \
+ -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
+
+CFLAGS = -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -fPIC -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H
+CPPFLAGS = -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
+
+################################################
+### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
+################################################
+
+ifeq "$(DEBUG)" "true"
+ BIN_DIR = Debug
+ CFLAGS += $(C_DEBUG_FLAGS)
+else
+ BIN_DIR = Release
+ CFLAGS += $(C_OPT_FLAGS)
+endif
+
+
+GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
+ifeq "$(GCC_VERSION)" "4"
+ CPPFLAGS += $(CPP_GCC4_FLAGS)
+endif
+
+BINARY = $(PROJECT).ext.so
+
+OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
+
+$(BIN_DIR)/%.o: %.cpp
+ $(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
+
+all:
+ mkdir -p $(BIN_DIR)/sdk
+ ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so
+ ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so
+ $(MAKE) extension
+
+extension: $(OBJ_LINUX)
+ $(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
+
+debug:
+ $(MAKE) all DEBUG=true
+
+default: all
+
+clean:
+ rm -rf Release/*.o
+ rm -rf Release/sdk/*.o
+ rm -rf Release/$(BINARY)
+ rm -rf Debug/*.o
+ rm -rf Debug/sdk/*.o
+ rm -rf Debug/$(BINARY)
diff --git a/extensions/cstrike/RegNatives.cpp b/extensions/cstrike/RegNatives.cpp
new file mode 100644
index 00000000..9dc014e0
--- /dev/null
+++ b/extensions/cstrike/RegNatives.cpp
@@ -0,0 +1,50 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Counter-Strike:Source Extension
+ * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#include "extension.h"
+#include "RegNatives.h"
+
+RegNatives g_RegNatives;
+
+void RegNatives::Register(ICallWrapper *pWrapper)
+{
+ m_List.push_back(pWrapper);
+}
+
+void RegNatives::UnregisterAll()
+{
+ List::iterator iter;
+
+ for (iter=m_List.begin(); iter!=m_List.end(); iter++)
+ {
+ (*iter)->Destroy();
+ }
+}
diff --git a/extensions/cstrike/RegNatives.h b/extensions/cstrike/RegNatives.h
new file mode 100644
index 00000000..b66455dd
--- /dev/null
+++ b/extensions/cstrike/RegNatives.h
@@ -0,0 +1,50 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Counter-Strike:Source Extension
+ * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#ifndef _INCLUDE_CSTRIKE_REGNATIVES_H_
+#define _INCLUDE_CSTRIKE_REGNATIVES_H_
+
+#include
+
+using namespace SourceHook;
+
+class RegNatives
+{
+public:
+ void Register(ICallWrapper *pWrapper);
+ void UnregisterAll();
+private:
+ List m_List;
+};
+
+extern RegNatives g_RegNatives;
+
+#endif //_INCLUDE_CSTRIKE_REGNATIVES_H_
diff --git a/extensions/cstrike/extension.cpp b/extensions/cstrike/extension.cpp
new file mode 100644
index 00000000..e2787094
--- /dev/null
+++ b/extensions/cstrike/extension.cpp
@@ -0,0 +1,93 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Counter-Strike:Source Extension
+ * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#include "extension.h"
+#include "RegNatives.h"
+
+/**
+ * @file extension.cpp
+ * @brief Implement extension code here.
+ */
+
+CStrike g_CStrike; /**< Global singleton for extension's main interface */
+IBinTools *g_pBinTools = NULL;
+IGameConfig *g_pGameConf = NULL;
+
+SMEXT_LINK(&g_CStrike);
+
+extern sp_nativeinfo_t g_CSNatives[];
+
+bool CStrike::SDK_OnLoad(char *error, size_t maxlength, bool late)
+{
+ sharesys->AddDependency(myself, "bintools.ext", true, true);
+
+ if (!gameconfs->LoadGameConfigFile("sm-cstrike.games", &g_pGameConf, error, maxlength))
+ {
+ return false;
+ }
+
+ sharesys->AddNatives(myself, g_CSNatives);
+
+ return true;
+}
+
+void CStrike::SDK_OnUnload()
+{
+ g_RegNatives.UnregisterAll();
+ gameconfs->CloseGameConfigFile(g_pGameConf);
+}
+
+void CStrike::SDK_OnAllLoaded()
+{
+ SM_GET_LATE_IFACE(BINTOOLS, g_pBinTools);
+}
+
+bool CStrike::QueryRunning(char *error, size_t maxlength)
+{
+ SM_CHECK_IFACE(BINTOOLS, g_pBinTools);
+
+ return true;
+}
+
+bool CStrike::QueryInterfaceDrop(SMInterface *pInterface)
+{
+ if (pInterface == g_pBinTools)
+ {
+ return false;
+ }
+
+ return IExtensionInterface::QueryInterfaceDrop(pInterface);
+}
+
+void CStrike::NotifyInterfaceDrop(SMInterface *pInterface)
+{
+ g_RegNatives.UnregisterAll();
+}
diff --git a/extensions/cstrike/extension.h b/extensions/cstrike/extension.h
new file mode 100644
index 00000000..0f2b87f1
--- /dev/null
+++ b/extensions/cstrike/extension.h
@@ -0,0 +1,126 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Counter-Strike:Source Extension
+ * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
+#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
+
+/**
+ * @file extension.h
+ * @brief Sample extension code header.
+ */
+
+#include "smsdk_ext.h"
+#include
+
+/**
+ * @brief Sample implementation of the SDK Extension.
+ * Note: Uncomment one of the pre-defined virtual functions in order to use it.
+ */
+class CStrike : public SDKExtension
+{
+public:
+ /**
+ * @brief This is called after the initial loading sequence has been processed.
+ *
+ * @param error Error message buffer.
+ * @param maxlength Size of error message buffer.
+ * @param late Whether or not the module was loaded after map load.
+ * @return True to succeed loading, false to fail.
+ */
+ virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
+
+ /**
+ * @brief This is called right before the extension is unloaded.
+ */
+ virtual void SDK_OnUnload();
+
+ /**
+ * @brief This is called once all known extensions have been loaded.
+ * Note: It is is a good idea to add natives here, if any are provided.
+ */
+ virtual void SDK_OnAllLoaded();
+
+ /**
+ * @brief Called when the pause state is changed.
+ */
+ //virtual void SDK_OnPauseChange(bool paused);
+
+ /**
+ * @brief this is called when Core wants to know if your extension is working.
+ *
+ * @param error Error message buffer.
+ * @param maxlength Size of error message buffer.
+ * @return True if working, false otherwise.
+ */
+ virtual bool QueryRunning(char *error, size_t maxlength);
+
+ void NotifyInterfaceDrop(SMInterface *pInterface);
+ bool QueryInterfaceDrop(SMInterface *pInterface);
+public:
+#if defined SMEXT_CONF_METAMOD
+ /**
+ * @brief Called when Metamod is attached, before the extension version is called.
+ *
+ * @param error Error buffer.
+ * @param maxlength Maximum size of error buffer.
+ * @param late Whether or not Metamod considers this a late load.
+ * @return True to succeed, false to fail.
+ */
+ //virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
+
+ /**
+ * @brief Called when Metamod is detaching, after the extension version is called.
+ * NOTE: By default this is blocked unless sent from SourceMod.
+ *
+ * @param error Error buffer.
+ * @param maxlength Maximum size of error buffer.
+ * @return True to succeed, false to fail.
+ */
+ //virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
+
+ /**
+ * @brief Called when Metamod's pause state is changing.
+ * NOTE: By default this is blocked unless sent from SourceMod.
+ *
+ * @param paused Pause state being set.
+ * @param error Error buffer.
+ * @param maxlength Maximum size of error buffer.
+ * @return True to succeed, false to fail.
+ */
+ //virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
+#endif
+};
+
+/* Interfaces from SourceMod */
+extern IBinTools *g_pBinTools;
+extern IGameConfig *g_pGameConf;
+
+#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
diff --git a/extensions/cstrike/msvc8/cstrike.sln b/extensions/cstrike/msvc8/cstrike.sln
new file mode 100644
index 00000000..7459a11a
--- /dev/null
+++ b/extensions/cstrike/msvc8/cstrike.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cstrike", "cstrike.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.Build.0 = Debug|Win32
+ {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.ActiveCfg = Release|Win32
+ {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/extensions/cstrike/msvc8/cstrike.vcproj b/extensions/cstrike/msvc8/cstrike.vcproj
new file mode 100644
index 00000000..6394bcf6
--- /dev/null
+++ b/extensions/cstrike/msvc8/cstrike.vcproj
@@ -0,0 +1,240 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/cstrike/natives.cpp b/extensions/cstrike/natives.cpp
new file mode 100644
index 00000000..e5f085c4
--- /dev/null
+++ b/extensions/cstrike/natives.cpp
@@ -0,0 +1,126 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Counter-Strike:Source Extension
+ * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#include "extension.h"
+#include "RegNatives.h"
+
+#define REGISTER_NATIVE_ADDR(name, code) \
+ void *addr; \
+ if (!g_pGameConf->GetMemSig(name, &addr)) \
+ { \
+ return pContext->ThrowNativeError("Failed to locate function"); \
+ } \
+ code; \
+ g_RegNatives.Register(pWrapper);
+
+inline CBaseEntity *GetCBaseEntity(int num, bool isplayer)
+{
+ edict_t *pEdict = engine->PEntityOfEntIndex(num);
+ if (!pEdict || pEdict->IsFree())
+ {
+ return NULL;
+ }
+
+ if (num > 0 && num < playerhelpers->GetMaxClients())
+ {
+ IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(pEdict);
+ if (!pPlayer || !pPlayer->IsConnected())
+ {
+ return NULL;
+ }
+ } else if (isplayer) {
+ return NULL;
+ }
+
+ IServerUnknown *pUnk;
+ if ((pUnk=pEdict->GetUnknown()) == NULL)
+ {
+ return NULL;
+ }
+
+ return pUnk->GetBaseEntity();
+}
+
+static cell_t CS_RespawnPlayer(IPluginContext *pContext, const cell_t *params)
+{
+ static ICallWrapper *pWrapper = NULL;
+ if (!pWrapper)
+ {
+ REGISTER_NATIVE_ADDR("RoundRespawn",
+ pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, NULL, 0));
+ }
+
+ CBaseEntity *pEntity;
+ if (!(pEntity=GetCBaseEntity(params[1], true)))
+ {
+ return pContext->ThrowNativeError("Client index %d is not valid", params[1]);
+ }
+ pWrapper->Execute(&pEntity, NULL);
+
+ return 1;
+}
+
+static cell_t CS_SwitchTeam(IPluginContext *pContext, const cell_t *params)
+{
+ static ICallWrapper *pWrapper = NULL;
+ if (!pWrapper)
+ {
+ REGISTER_NATIVE_ADDR("SwitchTeam",
+ PassInfo pass[1]; \
+ pass[0].flags = PASSFLAG_BYVAL; \
+ pass[0].size = sizeof(int); \
+ pass[0].type = PassType_Basic; \
+ pWrapper = g_pBinTools->CreateCall(addr, CallConv_ThisCall, NULL, pass, 1))
+ }
+
+ CBaseEntity *pEntity;
+ if (!(pEntity=GetCBaseEntity(params[1], true)))
+ {
+ return pContext->ThrowNativeError("Client index %d is not valid", params[1]);
+ }
+
+ unsigned char vstk[sizeof(CBaseEntity *) + sizeof(int)];
+ unsigned char *vptr = vstk;
+
+ *(CBaseEntity **)vptr = pEntity;
+ vptr += sizeof(CBaseEntity *);
+ *(int *)vptr = params[2];
+ pWrapper->Execute(vstk, NULL);
+
+ return 1;
+}
+
+sp_nativeinfo_t g_CSNatives[] =
+{
+ {"CS_RespawnPlayer", CS_RespawnPlayer},
+ {"CS_SwitchTeam", CS_SwitchTeam},
+ {NULL, NULL}
+};
diff --git a/extensions/cstrike/sdk/smsdk_config.h b/extensions/cstrike/sdk/smsdk_config.h
new file mode 100644
index 00000000..d46ff0a0
--- /dev/null
+++ b/extensions/cstrike/sdk/smsdk_config.h
@@ -0,0 +1,73 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Counter-Strike:Source Extension
+ * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
+#define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
+
+/**
+ * @file smsdk_config.h
+ * @brief Contains macros for configuring basic extension information.
+ */
+
+/* Basic information exposed publicly */
+#define SMEXT_CONF_NAME "CS:S Tools"
+#define SMEXT_CONF_DESCRIPTION "CS:S extended functionality"
+#define SMEXT_CONF_VERSION "99.0.0.0" //:TODO:
+#define SMEXT_CONF_AUTHOR "AlliedModders"
+#define SMEXT_CONF_URL "http://www.sourcemod.net/"
+#define SMEXT_CONF_LOGTAG "CSTRIKE"
+#define SMEXT_CONF_LICENSE "GPL"
+#define SMEXT_CONF_DATESTRING __DATE__
+
+/**
+ * @brief Exposes plugin's main interface.
+ */
+#define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name;
+
+/**
+ * @brief Sets whether or not this plugin required Metamod.
+ * NOTE: Uncomment to enable, comment to disable.
+ */
+#define SMEXT_CONF_METAMOD
+
+/** Enable interfaces you want to use here by uncommenting lines */
+//#define SMEXT_ENABLE_FORWARDSYS
+//#define SMEXT_ENABLE_HANDLESYS
+#define SMEXT_ENABLE_PLAYERHELPERS
+//#define SMEXT_ENABLE_DBMANAGER
+#define SMEXT_ENABLE_GAMECONF
+//#define SMEXT_ENABLE_MEMUTILS
+//#define SMEXT_ENABLE_GAMEHELPERS
+//#define SMEXT_ENABLE_TIMERSYS
+//#define SMEXT_ENABLE_THREADER
+//#define SMEXT_ENABLE_LIBSYS
+
+#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
diff --git a/extensions/cstrike/sdk/smsdk_ext.cpp b/extensions/cstrike/sdk/smsdk_ext.cpp
new file mode 100644
index 00000000..a4b80a10
--- /dev/null
+++ b/extensions/cstrike/sdk/smsdk_ext.cpp
@@ -0,0 +1,416 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Base Extension Code
+ * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#include
+#include
+#include "smsdk_ext.h"
+
+/**
+ * @file smsdk_ext.cpp
+ * @brief Contains wrappers for making Extensions easier to write.
+ */
+
+IExtension *myself = NULL; /**< Ourself */
+IShareSys *g_pShareSys = NULL; /**< Share system */
+IShareSys *sharesys = NULL; /**< Share system */
+ISourceMod *g_pSM = NULL; /**< SourceMod helpers */
+ISourceMod *smutils = NULL; /**< SourceMod helpers */
+
+#if defined SMEXT_ENABLE_FORWARDSYS
+IForwardManager *g_pForwards = NULL; /**< Forward system */
+IForwardManager *forwards = NULL; /**< Forward system */
+#endif
+#if defined SMEXT_ENABLE_HANDLESYS
+IHandleSys *g_pHandleSys = NULL; /**< Handle system */
+IHandleSys *handlesys = NULL; /**< Handle system */
+#endif
+#if defined SMEXT_ENABLE_PLAYERHELPERS
+IPlayerManager *playerhelpers = NULL; /**< Player helpers */
+#endif //SMEXT_ENABLE_PLAYERHELPERS
+#if defined SMEXT_ENABLE_DBMANAGER
+IDBManager *dbi = NULL; /**< DB Manager */
+#endif //SMEXT_ENABLE_DBMANAGER
+#if defined SMEXT_ENABLE_GAMECONF
+IGameConfigManager *gameconfs = NULL; /**< Game config manager */
+#endif //SMEXT_ENABLE_DBMANAGER
+#if defined SMEXT_ENABLE_MEMUTILS
+IMemoryUtils *memutils = NULL;
+#endif //SMEXT_ENABLE_DBMANAGER
+#if defined SMEXT_ENABLE_GAMEHELPERS
+IGameHelpers *gamehelpers = NULL;
+#endif
+#if defined SMEXT_ENABLE_TIMERSYS
+ITimerSystem *timersys = NULL;
+#endif
+#if defined SMEXT_ENABLE_ADTFACTORY
+IADTFactory *adtfactory = NULL;
+#endif
+#if defined SMEXT_ENABLE_THREADER
+IThreader *threader = NULL;
+#endif
+#if defined SMEXT_ENABLE_LIBSYS
+ILibrarySys *libsys = NULL;
+#endif
+
+/** Exports the main interface */
+PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
+{
+ return g_pExtensionIface;
+}
+
+SDKExtension::SDKExtension()
+{
+#if defined SMEXT_CONF_METAMOD
+ m_SourceMMLoaded = false;
+ m_WeAreUnloaded = false;
+ m_WeGotPauseChange = false;
+#endif
+}
+
+bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late)
+{
+ g_pShareSys = sharesys = sys;
+ myself = me;
+
+#if defined SMEXT_CONF_METAMOD
+ m_WeAreUnloaded = true;
+
+ if (!m_SourceMMLoaded)
+ {
+ if (error)
+ {
+ snprintf(error, maxlength, "Metamod attach failed");
+ }
+ return false;
+ }
+#endif
+ SM_GET_IFACE(SOURCEMOD, g_pSM);
+ smutils = g_pSM;
+#if defined SMEXT_ENABLE_HANDLESYS
+ SM_GET_IFACE(HANDLESYSTEM, g_pHandleSys);
+ handlesys = g_pHandleSys;
+#endif
+#if defined SMEXT_ENABLE_FORWARDSYS
+ SM_GET_IFACE(FORWARDMANAGER, g_pForwards);
+ forwards = g_pForwards;
+#endif
+#if defined SMEXT_ENABLE_PLAYERHELPERS
+ SM_GET_IFACE(PLAYERMANAGER, playerhelpers);
+#endif
+#if defined SMEXT_ENABLE_DBMANAGER
+ SM_GET_IFACE(DBI, dbi);
+#endif
+#if defined SMEXT_ENABLE_GAMECONF
+ SM_GET_IFACE(GAMECONFIG, gameconfs);
+#endif
+#if defined SMEXT_ENABLE_MEMUTILS
+ SM_GET_IFACE(MEMORYUTILS, memutils);
+#endif
+#if defined SMEXT_ENABLE_GAMEHELPERS
+ SM_GET_IFACE(GAMEHELPERS, gamehelpers);
+#endif
+#if defined SMEXT_ENABLE_TIMERSYS
+ SM_GET_IFACE(TIMERSYS, timersys);
+#endif
+#if defined SMEXT_ENABLE_ADTFACTORY
+ SM_GET_IFACE(ADTFACTORY, adtfactory);
+#endif
+#if defined SMEXT_ENABLE_THREADER
+ SM_GET_IFACE(THREADER, threader);
+#endif
+#if defined SMEXT_ENABLE_LIBSYS
+ SM_GET_IFACE(LIBRARYSYS, libsys);
+#endif
+
+ if (SDK_OnLoad(error, maxlength, late))
+ {
+#if defined SMEXT_CONF_METAMOD
+ m_WeAreUnloaded = true;
+#endif
+ return true;
+ }
+
+ return false;
+}
+
+bool SDKExtension::IsMetamodExtension()
+{
+#if defined SMEXT_CONF_METAMOD
+ return true;
+#else
+ return false;
+#endif
+}
+
+void SDKExtension::OnExtensionPauseChange(bool state)
+{
+#if defined SMEXT_CONF_METAMOD
+ m_WeGotPauseChange = true;
+#endif
+ SDK_OnPauseChange(state);
+}
+
+void SDKExtension::OnExtensionsAllLoaded()
+{
+ SDK_OnAllLoaded();
+}
+
+void SDKExtension::OnExtensionUnload()
+{
+#if defined SMEXT_CONF_METAMOD
+ m_WeAreUnloaded = true;
+#endif
+ SDK_OnUnload();
+}
+
+const char *SDKExtension::GetExtensionAuthor()
+{
+ return SMEXT_CONF_AUTHOR;
+}
+
+const char *SDKExtension::GetExtensionDateString()
+{
+ return SMEXT_CONF_DATESTRING;
+}
+
+const char *SDKExtension::GetExtensionDescription()
+{
+ return SMEXT_CONF_DESCRIPTION;
+}
+
+const char *SDKExtension::GetExtensionVerString()
+{
+ return SMEXT_CONF_VERSION;
+}
+
+const char *SDKExtension::GetExtensionName()
+{
+ return SMEXT_CONF_NAME;
+}
+
+const char *SDKExtension::GetExtensionTag()
+{
+ return SMEXT_CONF_LOGTAG;
+}
+
+const char *SDKExtension::GetExtensionURL()
+{
+ return SMEXT_CONF_URL;
+}
+
+bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late)
+{
+ return true;
+}
+
+void SDKExtension::SDK_OnUnload()
+{
+}
+
+void SDKExtension::SDK_OnPauseChange(bool paused)
+{
+}
+
+void SDKExtension::SDK_OnAllLoaded()
+{
+}
+
+#if defined SMEXT_CONF_METAMOD
+
+PluginId g_PLID = 0; /**< Metamod plugin ID */
+ISmmPlugin *g_PLAPI = NULL; /**< Metamod plugin API */
+SourceHook::ISourceHook *g_SHPtr = NULL; /**< SourceHook pointer */
+ISmmAPI *g_SMAPI = NULL; /**< SourceMM API pointer */
+
+IVEngineServer *engine = NULL; /**< IVEngineServer pointer */
+IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
+
+/** Exposes the extension to Metamod */
+SMM_API void *PL_EXPOSURE(const char *name, int *code)
+{
+ if (name && !strcmp(name, PLAPI_NAME))
+ {
+ if (code)
+ {
+ *code = IFACE_OK;
+ }
+ return static_cast(g_pExtensionIface);
+ }
+
+ if (code)
+ {
+ *code = IFACE_FAILED;
+ }
+
+ return NULL;
+}
+
+bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
+{
+ PLUGIN_SAVEVARS();
+
+ GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
+ GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
+
+ m_SourceMMLoaded = true;
+
+ return SDK_OnMetamodLoad(ismm, error, maxlen, late);
+}
+
+bool SDKExtension::Unload(char *error, size_t maxlen)
+{
+ if (!m_WeAreUnloaded)
+ {
+ if (error)
+ {
+ snprintf(error, maxlen, "This extension must be unloaded by SourceMod.");
+ }
+ return false;
+ }
+
+ return SDK_OnMetamodUnload(error, maxlen);
+}
+
+bool SDKExtension::Pause(char *error, size_t maxlen)
+{
+ if (!m_WeGotPauseChange)
+ {
+ if (error)
+ {
+ snprintf(error, maxlen, "This extension must be paused by SourceMod.");
+ }
+ return false;
+ }
+
+ m_WeGotPauseChange = false;
+
+ return SDK_OnMetamodPauseChange(true, error, maxlen);
+}
+
+bool SDKExtension::Unpause(char *error, size_t maxlen)
+{
+ if (!m_WeGotPauseChange)
+ {
+ if (error)
+ {
+ snprintf(error, maxlen, "This extension must be unpaused by SourceMod.");
+ }
+ return false;
+ }
+
+ m_WeGotPauseChange = false;
+
+ return SDK_OnMetamodPauseChange(false, error, maxlen);
+}
+
+const char *SDKExtension::GetAuthor()
+{
+ return GetExtensionAuthor();
+}
+
+const char *SDKExtension::GetDate()
+{
+ return GetExtensionDateString();
+}
+
+const char *SDKExtension::GetDescription()
+{
+ return GetExtensionDescription();
+}
+
+const char *SDKExtension::GetLicense()
+{
+ return SMEXT_CONF_LICENSE;
+}
+
+const char *SDKExtension::GetLogTag()
+{
+ return GetExtensionTag();
+}
+
+const char *SDKExtension::GetName()
+{
+ return GetExtensionName();
+}
+
+const char *SDKExtension::GetURL()
+{
+ return GetExtensionURL();
+}
+
+const char *SDKExtension::GetVersion()
+{
+ return GetExtensionVerString();
+}
+
+bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late)
+{
+ return true;
+}
+
+bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength)
+{
+ return true;
+}
+
+bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength)
+{
+ return true;
+}
+
+#endif
+
+/* Overload a few things to prevent libstdc++ linking */
+#if defined __linux__
+extern "C" void __cxa_pure_virtual(void)
+{
+}
+
+void *operator new(size_t size)
+{
+ return malloc(size);
+}
+
+void *operator new[](size_t size)
+{
+ return malloc(size);
+}
+
+void operator delete(void *ptr)
+{
+ free(ptr);
+}
+
+void operator delete[](void * ptr)
+{
+ free(ptr);
+}
+#endif
diff --git a/extensions/cstrike/sdk/smsdk_ext.h b/extensions/cstrike/sdk/smsdk_ext.h
new file mode 100644
index 00000000..f75071ac
--- /dev/null
+++ b/extensions/cstrike/sdk/smsdk_ext.h
@@ -0,0 +1,292 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod Base Extension Code
+ * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#ifndef _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
+#define _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
+
+/**
+ * @file smsdk_ext.h
+ * @brief Contains wrappers for making Extensions easier to write.
+ */
+
+#include "smsdk_config.h"
+#include
+#include
+#include
+#include
+#include
+#if defined SMEXT_ENABLE_FORWARDSYS
+#include
+#endif //SMEXT_ENABLE_FORWARDSYS
+#if defined SMEXT_ENABLE_PLAYERHELPERS
+#include
+#endif //SMEXT_ENABLE_PlAYERHELPERS
+#if defined SMEXT_ENABLE_DBMANAGER
+#include
+#endif //SMEXT_ENABLE_DBMANAGER
+#if defined SMEXT_ENABLE_GAMECONF
+#include
+#endif
+#if defined SMEXT_ENABLE_MEMUTILS
+#include
+#endif
+#if defined SMEXT_ENABLE_GAMEHELPERS
+#include
+#endif
+#if defined SMEXT_ENABLE_TIMERSYS
+#include
+#endif
+#if defined SMEXT_ENABLE_ADTFACTORY
+#include
+#endif
+#if defined SMEXT_ENABLE_THREADER
+#include
+#endif
+#if defined SMEXT_ENABLE_LIBSYS
+#include
+#endif
+
+#if defined SMEXT_CONF_METAMOD
+#include
+#include
+#endif
+
+using namespace SourceMod;
+using namespace SourcePawn;
+
+class SDKExtension :
+#if defined SMEXT_CONF_METAMOD
+ public ISmmPlugin,
+#endif
+ public IExtensionInterface
+{
+public:
+ /** Constructor */
+ SDKExtension();
+public:
+ /**
+ * @brief This is called after the initial loading sequence has been processed.
+ *
+ * @param error Error message buffer.
+ * @param maxlength Size of error message buffer.
+ * @param late Whether or not the module was loaded after map load.
+ * @return True to succeed loading, false to fail.
+ */
+ virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
+
+ /**
+ * @brief This is called right before the extension is unloaded.
+ */
+ virtual void SDK_OnUnload();
+
+ /**
+ * @brief This is called once all known extensions have been loaded.
+ */
+ virtual void SDK_OnAllLoaded();
+
+ /**
+ * @brief Called when the pause state is changed.
+ */
+ virtual void SDK_OnPauseChange(bool paused);
+
+#if defined SMEXT_CONF_METAMOD
+ /**
+ * @brief Called when Metamod is attached, before the extension version is called.
+ *
+ * @param error Error buffer.
+ * @param maxlength Maximum size of error buffer.
+ * @param late Whether or not Metamod considers this a late load.
+ * @return True to succeed, false to fail.
+ */
+ virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
+
+ /**
+ * @brief Called when Metamod is detaching, after the extension version is called.
+ * NOTE: By default this is blocked unless sent from SourceMod.
+ *
+ * @param error Error buffer.
+ * @param maxlength Maximum size of error buffer.
+ * @return True to succeed, false to fail.
+ */
+ virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
+
+ /**
+ * @brief Called when Metamod's pause state is changing.
+ * NOTE: By default this is blocked unless sent from SourceMod.
+ *
+ * @param paused Pause state being set.
+ * @param error Error buffer.
+ * @param maxlength Maximum size of error buffer.
+ * @return True to succeed, false to fail.
+ */
+ virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
+#endif
+
+public: //IExtensionInterface
+ virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late);
+ virtual void OnExtensionUnload();
+ virtual void OnExtensionsAllLoaded();
+
+ /** Returns whether or not this is a Metamod-based extension */
+ virtual bool IsMetamodExtension();
+
+ /**
+ * @brief Called when the pause state changes.
+ *
+ * @param state True if being paused, false if being unpaused.
+ */
+ virtual void OnExtensionPauseChange(bool state);
+
+ /** Returns name */
+ virtual const char *GetExtensionName();
+ /** Returns URL */
+ virtual const char *GetExtensionURL();
+ /** Returns log tag */
+ virtual const char *GetExtensionTag();
+ /** Returns author */
+ virtual const char *GetExtensionAuthor();
+ /** Returns version string */
+ virtual const char *GetExtensionVerString();
+ /** Returns description string */
+ virtual const char *GetExtensionDescription();
+ /** Returns date string */
+ virtual const char *GetExtensionDateString();
+#if defined SMEXT_CONF_METAMOD
+public: //ISmmPlugin
+ /** Called when the extension is attached to Metamod. */
+ virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late);
+ /** Returns the author to MM */
+ virtual const char *GetAuthor();
+ /** Returns the name to MM */
+ virtual const char *GetName();
+ /** Returns the description to MM */
+ virtual const char *GetDescription();
+ /** Returns the URL to MM */
+ virtual const char *GetURL();
+ /** Returns the license to MM */
+ virtual const char *GetLicense();
+ /** Returns the version string to MM */
+ virtual const char *GetVersion();
+ /** Returns the date string to MM */
+ virtual const char *GetDate();
+ /** Returns the logtag to MM */
+ virtual const char *GetLogTag();
+ /** Called on unload */
+ virtual bool Unload(char *error, size_t maxlength);
+ /** Called on pause */
+ virtual bool Pause(char *error, size_t maxlength);
+ /** Called on unpause */
+ virtual bool Unpause(char *error, size_t maxlength);
+private:
+ bool m_SourceMMLoaded;
+ bool m_WeAreUnloaded;
+ bool m_WeGotPauseChange;
+#endif
+};
+
+extern SDKExtension *g_pExtensionIface;
+extern IExtension *myself;
+
+extern IShareSys *g_pShareSys;
+extern IShareSys *sharesys; /* Note: Newer name */
+extern ISourceMod *g_pSM;
+extern ISourceMod *smutils; /* Note: Newer name */
+
+/* Optional interfaces are below */
+#if defined SMEXT_ENABLE_FORWARDSYS
+extern IForwardManager *g_pForwards;
+extern IForwardManager *forwards; /* Note: Newer name */
+#endif //SMEXT_ENABLE_FORWARDSYS
+#if defined SMEXT_ENABLE_HANDLESYS
+extern IHandleSys *g_pHandleSys;
+extern IHandleSys *handlesys; /* Note: Newer name */
+#endif //SMEXT_ENABLE_HANDLESYS
+#if defined SMEXT_ENABLE_PLAYERHELPERS
+extern IPlayerManager *playerhelpers;
+#endif //SMEXT_ENABLE_PLAYERHELPERS
+#if defined SMEXT_ENABLE_DBMANAGER
+extern IDBManager *dbi;
+#endif //SMEXT_ENABLE_DBMANAGER
+#if defined SMEXT_ENABLE_GAMECONF
+extern IGameConfigManager *gameconfs;
+#endif //SMEXT_ENABLE_DBMANAGER
+#if defined SMEXT_ENABLE_MEMUTILS
+extern IMemoryUtils *memutils;
+#endif
+#if defined SMEXT_ENABLE_GAMEHELPERS
+extern IGameHelpers *gamehelpers;
+#endif
+#if defined SMEXT_ENABLE_TIMERSYS
+extern ITimerSystem *timersys;
+#endif
+#if defined SMEXT_ENABLE_ADTFACTORY
+extern IADTFactory *adtfactory;
+#endif
+#if defined SMEXT_ENABLE_THREADER
+extern IThreader *threader;
+#endif
+#if defined SMEXT_ENABLE_LIBSYS
+extern ILibrarySys *libsys;
+#endif
+
+#if defined SMEXT_CONF_METAMOD
+PLUGIN_GLOBALVARS();
+extern IVEngineServer *engine;
+extern IServerGameDLL *gamedll;
+#endif
+
+/** Creates a SourceMod interface macro pair */
+#define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION
+/** Automates retrieving SourceMod interfaces */
+#define SM_GET_IFACE(prefix, addr) \
+ if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) \
+ { \
+ if (error) \
+ { \
+ snprintf(error, maxlength, "Could not find interface: %s (version: %d)", SMINTERFACE_##prefix##_NAME, SMINTERFACE_##prefix##_VERSION); \
+ return false; \
+ } \
+ }
+/** Automates retrieving SourceMod interfaces when needed outside of SDK_OnLoad() */
+#define SM_GET_LATE_IFACE(prefix, addr) \
+ g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)
+/** Validates a SourceMod interface pointer */
+#define SM_CHECK_IFACE(prefix, addr) \
+ if (!addr) \
+ { \
+ if (error) \
+ { \
+ snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
+ return false; \
+ } \
+ }
+
+#endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
diff --git a/gamedata/sm-cstrike.games.txt b/gamedata/sm-cstrike.games.txt
new file mode 100644
index 00000000..4712969d
--- /dev/null
+++ b/gamedata/sm-cstrike.games.txt
@@ -0,0 +1,21 @@
+"Games"
+{
+ "cstrike"
+ {
+ "Signatures"
+ {
+ "RoundRespawn"
+ {
+ "library" "server"
+ "windows" "\x56\x8B\xF1\x8B\x06\xFF\x90\x2A\x04\x00\x00\x8B\x86\x2A\x0D\x00"
+ "linux" "@_ZN9CCSPlayer12RoundRespawnEv"
+ }
+ "SwitchTeam"
+ {
+ "library" "server"
+ "windows" "\x83\xEC\x10\x56\x57\x8B\x7C\x24\x1C\x57\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\x85\xC0\x0F\x84\xEA\x00\x00\x00\x83\xFF\x03\x74\x09\x83\xFF\x02\x0F\x85\xDC\x00\x00\x00\x8B\xCE\xE8\x2A\x2A\x2A\x2A\x3B\xF8\x0F\x84\xDC\x00\x00\x00\x57\x8B\xCE\xC6\x86\x2A\x2A"
+ "linux" "@_ZN9CCSPlayer10SwitchTeamEi"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc
new file mode 100644
index 00000000..50c64658
--- /dev/null
+++ b/plugins/include/cstrike.inc
@@ -0,0 +1,81 @@
+/**
+ * vim: set ts=4 :
+ * =============================================================================
+ * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
+ * =============================================================================
+ *
+ * This file is part of the SourceMod/SourcePawn SDK.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+ * As a special exception, AlliedModders LLC gives you permission to link the
+ * code of this program (as well as its derivative works) to "Half-Life 2," the
+ * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
+ * by the Valve Corporation. You must obey the GNU General Public License in
+ * all respects for all other code used. Additionally, AlliedModders LLC grants
+ * this exception to all derivative works. AlliedModders LLC defines further
+ * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
+ * or .
+ *
+ * Version: $Id$
+ */
+
+#if defined _cstrike_included
+ #endinput
+#endif
+#define _cstrike_included
+
+#include
+
+#define CS_TEAM_NONE 0 /**< No team yet. */
+#define CS_TEAM_SPECTATOR 1 /**< Spectators. */
+#define CS_TEAM_T 2 /**< Terrorists. */
+#define CS_TEAM_CT 3 /**< Counter-Terrorists. */
+
+/**
+ * Respawns a player.
+ *
+ * @param client Player's index.
+ * @noreturn
+ * @error Invalid client index, client not in game.
+ */
+native CS_RespawnPlayer(client);
+
+/**
+ * Switches the player's team.
+ *
+ * @param client Player's index.
+ * @param team Team index.
+ * @noreturn
+ * @error Invalid client index, client not in game.
+ */
+native CS_SwitchTeam(client, team);
+
+/**
+ * Do not edit below this line!
+ */
+public Extension:__ext_cstrike =
+{
+ name = "CStrike",
+ file = "game.cstrike.ext",
+#if defined AUTOLOAD_EXTENSIONS
+ autoload = 1,
+#else
+ autoload = 0,
+#endif
+#if defined REQUIRE_EXTENSIONS
+ required = 1,
+#else
+ required = 0,
+#endif
+};
\ No newline at end of file