Added PlayerRunCmd hook to sdktools (bug 3289, r=dvander)
authorMatt Woodrow <pred@alliedmods.net>
Tue May 12 13:54:06 2009 +1200 (2009-05-12)
changeset 2711858723415154
parent 2701 d1b1494bb260
child 2712 e139d6c20349
Added PlayerRunCmd hook to sdktools (bug 3289, r=dvander)
extensions/sdktools/Makefile
extensions/sdktools/extension.cpp
extensions/sdktools/extension.h
extensions/sdktools/hooks.cpp
extensions/sdktools/hooks.h
extensions/sdktools/msvc9/sdktools.vcproj
extensions/sdktools/sdk/smsdk_config.h
extensions/sdktools/voice.cpp
gamedata/sdktools.games/engine.l4d.txt
gamedata/sdktools.games/game.cstrike.txt
gamedata/sdktools.games/game.tf.txt
plugins/include/sdktools.inc
plugins/include/sdktools_hooks.inc
     1.1 --- a/extensions/sdktools/Makefile	Fri Apr 24 18:20:55 2009 +1200
     1.2 +++ b/extensions/sdktools/Makefile	Tue May 12 13:54:06 2009 +1200
     1.3 @@ -20,7 +20,7 @@
     1.4  OBJECTS = sdk/smsdk_ext.cpp extension.cpp vdecoder.cpp vcallbuilder.cpp vcaller.cpp \
     1.5  	vnatives.cpp vsound.cpp tenatives.cpp trnatives.cpp tempents.cpp vstringtable.cpp \
     1.6  	vhelpers.cpp vglobals.cpp voice.cpp inputnatives.cpp teamnatives.cpp output.cpp \
     1.7 -	outputnatives.cpp
     1.8 +	outputnatives.cpp hooks.cpp
     1.9  
    1.10  ##############################################
    1.11  ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
    1.12 @@ -39,7 +39,7 @@
    1.13  	HL2LIB = $(HL2SDK)/linux_sdk
    1.14  	CFLAGS += -DSOURCE_ENGINE=1
    1.15  	METAMOD = $(MMSOURCE17)/core-legacy
    1.16 -	INCLUDE += -I$(HL2SDK)/public/dlls
    1.17 +	INCLUDE += -I$(HL2SDK)/public/dlls -I$(HL2SDK)/game_shared
    1.18  	SRCDS = $(SRCDS_BASE)
    1.19  	override ENGSET = true
    1.20  endif
    1.21 @@ -49,7 +49,7 @@
    1.22  	HL2LIB = $(HL2SDK)/lib/linux
    1.23  	CFLAGS += -DSOURCE_ENGINE=3
    1.24  	METAMOD = $(MMSOURCE17)/core
    1.25 -	INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
    1.26 +	INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared
    1.27  	SRCDS = $(SRCDS_BASE)/orangebox
    1.28  	override ENGSET = true
    1.29  endif
    1.30 @@ -59,7 +59,7 @@
    1.31  	HL2LIB = $(HL2SDK)/lib/linux
    1.32  	CFLAGS += -DSOURCE_ENGINE=4
    1.33  	METAMOD = $(MMSOURCE17)/core
    1.34 -	INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
    1.35 +	INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared
    1.36  	SRCDS = $(SRCDS_BASE)/l4d
    1.37  	override ENGSET = true
    1.38  endif
     2.1 --- a/extensions/sdktools/extension.cpp	Fri Apr 24 18:20:55 2009 +1200
     2.2 +++ b/extensions/sdktools/extension.cpp	Tue May 12 13:54:06 2009 +1200
     2.3 @@ -38,6 +38,7 @@
     2.4  #include "tempents.h"
     2.5  #include "vsound.h"
     2.6  #include "output.h"
     2.7 +#include "hooks.h"
     2.8  #include <ISDKTools.h>
     2.9  
    2.10  /**
    2.11 @@ -186,6 +187,7 @@
    2.12  	g_TEManager.Shutdown();
    2.13  	s_TempEntHooks.Shutdown();
    2.14  	s_SoundHooks.Shutdown();
    2.15 +	g_Hooks.Shutdown();
    2.16  
    2.17  	gameconfs->CloseGameConfigFile(g_pGameConf);
    2.18  	playerhelpers->RemoveClientListener(&g_SdkTools);
    2.19 @@ -254,6 +256,7 @@
    2.20  	g_TEManager.Initialize();
    2.21  	s_TempEntHooks.Initialize();
    2.22  	s_SoundHooks.Initialize();
    2.23 +	g_Hooks.Initialize();
    2.24  	InitializeValveGlobals();
    2.25  }
    2.26  
    2.27 @@ -379,6 +382,11 @@
    2.28  	return true;
    2.29  }
    2.30  
    2.31 +void SDKTools::OnClientPutInServer(int client)
    2.32 +{
    2.33 +	g_Hooks.OnClientPutInServer(client);
    2.34 +}
    2.35 +
    2.36  class SDKTools_API : public ISDKTools
    2.37  {
    2.38  public:
     3.1 --- a/extensions/sdktools/extension.h	Fri Apr 24 18:20:55 2009 +1200
     3.2 +++ b/extensions/sdktools/extension.h	Tue May 12 13:54:06 2009 +1200
     3.3 @@ -82,6 +82,7 @@
     3.4  public: //IConCommandBaseAccessor
     3.5  	bool RegisterConCommandBase(ConCommandBase *pVar);
     3.6  public: //IClientListner
     3.7 +	void OnClientPutInServer(int client);
     3.8  	void OnClientDisconnecting(int client);
     3.9  public: // IVoiceServer
    3.10  	bool OnSetClientListening(int iReceiver, int iSender, bool bListen);
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/extensions/sdktools/hooks.cpp	Tue May 12 13:54:06 2009 +1200
     4.3 @@ -0,0 +1,153 @@
     4.4 +/**
     4.5 +* vim: set ts=4 :
     4.6 +* =============================================================================
     4.7 +* SourceMod SDKTools Extension
     4.8 +* Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     4.9 +* =============================================================================
    4.10 +*
    4.11 +* This program is free software; you can redistribute it and/or modify it under
    4.12 +* the terms of the GNU General Public License, version 3.0, as published by the
    4.13 +* Free Software Foundation.
    4.14 +*
    4.15 +* This program is distributed in the hope that it will be useful, but WITHOUT
    4.16 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    4.17 +* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    4.18 +* details.
    4.19 +*
    4.20 +* You should have received a copy of the GNU General Public License along with
    4.21 +* this program.  If not, see <http://www.gnu.org/licenses/>.
    4.22 +*
    4.23 +* As a special exception, AlliedModders LLC gives you permission to link the
    4.24 +* code of this program (as well as its derivative works) to "Half-Life 2," the
    4.25 +* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    4.26 +* by the Valve Corporation.  You must obey the GNU General Public License in
    4.27 +* all respects for all other code used.  Additionally, AlliedModders LLC grants
    4.28 +* this exception to all derivative works.  AlliedModders LLC defines further
    4.29 +* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    4.30 +* or <http://www.sourcemod.net/license.php>.
    4.31 +*
    4.32 +* Version: $Id$
    4.33 +*/
    4.34 +
    4.35 +#include "hooks.h"
    4.36 +#include "extension.h"
    4.37 +
    4.38 +CHookManager g_Hooks;
    4.39 +
    4.40 +SH_DECL_MANUALHOOK2_void(PlayerRunCmdHook, 0, 0, 0, CUserCmd *, IMoveHelper *);
    4.41 +
    4.42 +CHookManager::CHookManager()
    4.43 +{
    4.44 +	m_usercmdsFwd = NULL;
    4.45 +}
    4.46 +
    4.47 +void CHookManager::Initialize()
    4.48 +{
    4.49 +	int offset;
    4.50 +	if (g_pGameConf->GetOffset("PlayerRunCmd", &offset))
    4.51 +	{
    4.52 +		SH_MANUALHOOK_RECONFIGURE(PlayerRunCmdHook, offset, 0, 0);
    4.53 +	}
    4.54 +
    4.55 +	m_usercmdsFwd = forwards->CreateForward("OnPlayerRunCmd", ET_Event, 6, NULL, Param_Cell, Param_CellByRef, Param_CellByRef, Param_Array, Param_Array, Param_CellByRef);
    4.56 +}
    4.57 +
    4.58 +void CHookManager::Shutdown()
    4.59 +{
    4.60 +	forwards->ReleaseForward(m_usercmdsFwd);
    4.61 +}
    4.62 +
    4.63 +void CHookManager::OnClientPutInServer(int client)
    4.64 +{
    4.65 +	edict_t *pEdict = PEntityOfEntIndex(client);
    4.66 +	if (!pEdict)
    4.67 +	{
    4.68 +		return;
    4.69 +	}
    4.70 +
    4.71 +	IServerUnknown *pUnknown = pEdict->GetUnknown();
    4.72 +	if (!pUnknown)
    4.73 +	{
    4.74 +		return;
    4.75 +	}
    4.76 +
    4.77 +	CBaseEntity *pEntity = pUnknown->GetBaseEntity();
    4.78 +	if (!pEntity)
    4.79 +	{
    4.80 +		return;
    4.81 +	}
    4.82 +
    4.83 +	SH_ADD_MANUALHOOK_MEMFUNC(PlayerRunCmdHook, pEntity, this, &CHookManager::PlayerRunCmd, false);
    4.84 +}
    4.85 +
    4.86 +void CHookManager::OnClientDisconnecting(int client)
    4.87 +{
    4.88 +	edict_t *pEdict = PEntityOfEntIndex(client);
    4.89 +	if (!pEdict)
    4.90 +	{
    4.91 +		return;
    4.92 +	}
    4.93 +
    4.94 +	CBaseEntity *pEntity = pEdict->GetUnknown()->GetBaseEntity();
    4.95 +	if (!pEntity)
    4.96 +	{
    4.97 +		return;
    4.98 +	}
    4.99 +
   4.100 +	SH_REMOVE_MANUALHOOK_MEMFUNC(PlayerRunCmdHook, pEntity, this, &CHookManager::PlayerRunCmd, false);
   4.101 +}
   4.102 +
   4.103 +void CHookManager::PlayerRunCmd(CUserCmd *ucmd, IMoveHelper *moveHelper)
   4.104 +{
   4.105 +	if (m_usercmdsFwd->GetFunctionCount() == 0)
   4.106 +	{
   4.107 +		RETURN_META(MRES_IGNORED);
   4.108 +	}
   4.109 +
   4.110 +	CBaseEntity *pEntity = META_IFACEPTR(CBaseEntity);
   4.111 +
   4.112 +	if (!pEntity)
   4.113 +	{
   4.114 +		RETURN_META(MRES_IGNORED);
   4.115 +	}
   4.116 +
   4.117 +	edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
   4.118 +
   4.119 +	if (!pEdict)
   4.120 +	{
   4.121 +		RETURN_META(MRES_IGNORED);
   4.122 +	}
   4.123 +
   4.124 +	int client = IndexOfEdict(pEdict);
   4.125 +
   4.126 +
   4.127 +	cell_t result = 0;
   4.128 +	/* Impulse is a byte so we copy it back manually */
   4.129 +	cell_t impulse = ucmd->impulse;
   4.130 +	cell_t vel[3] = {sp_ftoc(ucmd->forwardmove), sp_ftoc(ucmd->sidemove), sp_ftoc(ucmd->upmove)};
   4.131 +	cell_t angles[3] = {sp_ftoc(ucmd->viewangles.x), sp_ftoc(ucmd->viewangles.y), sp_ftoc(ucmd->viewangles.z)};
   4.132 +
   4.133 +	m_usercmdsFwd->PushCell(client);
   4.134 +	m_usercmdsFwd->PushCellByRef(&ucmd->buttons);
   4.135 +	m_usercmdsFwd->PushCellByRef(&impulse);
   4.136 +	m_usercmdsFwd->PushArray(vel, 3, SM_PARAM_COPYBACK);
   4.137 +	m_usercmdsFwd->PushArray(angles, 3, SM_PARAM_COPYBACK);
   4.138 +	m_usercmdsFwd->PushCellByRef(&ucmd->weaponselect);
   4.139 +	m_usercmdsFwd->Execute(&result);
   4.140 +
   4.141 +	ucmd->impulse = impulse;
   4.142 +	ucmd->forwardmove = sp_ctof(vel[0]);
   4.143 +	ucmd->sidemove = sp_ctof(vel[1]);
   4.144 +	ucmd->upmove = sp_ctof(vel[2]);
   4.145 +	ucmd->viewangles.x = sp_ctof(angles[0]);
   4.146 +	ucmd->viewangles.y = sp_ctof(angles[1]);
   4.147 +	ucmd->viewangles.z = sp_ctof(angles[2]);
   4.148 +
   4.149 +
   4.150 +	if (result == Pl_Handled)
   4.151 +	{
   4.152 +		RETURN_META(MRES_SUPERCEDE);
   4.153 +	}
   4.154 +
   4.155 +	RETURN_META(MRES_IGNORED);
   4.156 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/extensions/sdktools/hooks.h	Tue May 12 13:54:06 2009 +1200
     5.3 @@ -0,0 +1,56 @@
     5.4 +/**
     5.5 +* vim: set ts=4 :
     5.6 +* =============================================================================
     5.7 +* SourceMod SDKTools Extension
     5.8 +* Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     5.9 +* =============================================================================
    5.10 +*
    5.11 +* This program is free software; you can redistribute it and/or modify it under
    5.12 +* the terms of the GNU General Public License, version 3.0, as published by the
    5.13 +* Free Software Foundation.
    5.14 +*
    5.15 +* This program is distributed in the hope that it will be useful, but WITHOUT
    5.16 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    5.17 +* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    5.18 +* details.
    5.19 +*
    5.20 +* You should have received a copy of the GNU General Public License along with
    5.21 +* this program.  If not, see <http://www.gnu.org/licenses/>.
    5.22 +*
    5.23 +* As a special exception, AlliedModders LLC gives you permission to link the
    5.24 +* code of this program (as well as its derivative works) to "Half-Life 2," the
    5.25 +* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    5.26 +* by the Valve Corporation.  You must obey the GNU General Public License in
    5.27 +* all respects for all other code used.  Additionally, AlliedModders LLC grants
    5.28 +* this exception to all derivative works.  AlliedModders LLC defines further
    5.29 +* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    5.30 +* or <http://www.sourcemod.net/license.php>.
    5.31 +*
    5.32 +* Version: $Id$
    5.33 +*/
    5.34 +
    5.35 +#ifndef _INCLUDE_HOOKS_H_
    5.36 +#define _INCLUDE_HOOKS_H_
    5.37 +
    5.38 +#include "basehandle.h"
    5.39 +#undef ARRAYSIZE
    5.40 +#include "usercmd.h"
    5.41 +#include "extension.h"
    5.42 +
    5.43 +class CHookManager
    5.44 +{
    5.45 +public:
    5.46 +	CHookManager();
    5.47 +	void Initialize();
    5.48 +	void Shutdown();
    5.49 +	void OnClientPutInServer(int client);
    5.50 +	void OnClientDisconnecting(int client);
    5.51 +	void PlayerRunCmd(CUserCmd *ucmd, IMoveHelper *moveHelper);
    5.52 +
    5.53 +private:
    5.54 +	IForward *m_usercmdsFwd;
    5.55 +};
    5.56 +
    5.57 +extern CHookManager g_Hooks;
    5.58 +
    5.59 +#endif // _INCLUDE_HOOKS_H_
     6.1 --- a/extensions/sdktools/msvc9/sdktools.vcproj	Fri Apr 24 18:20:55 2009 +1200
     6.2 +++ b/extensions/sdktools/msvc9/sdktools.vcproj	Tue May 12 13:54:06 2009 +1200
     6.3 @@ -42,7 +42,7 @@
     6.4  				Name="VCCLCompilerTool"
     6.5  				AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
     6.6  				Optimization="0"
     6.7 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core-legacy&quot;;&quot;$(MMSOURCE17)\core-legacy\sourcehook&quot;"
     6.8 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\game_shared&quot;;&quot;$(MMSOURCE17)\core-legacy&quot;;&quot;$(MMSOURCE17)\core-legacy\sourcehook&quot;"
     6.9  				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
    6.10  				MinimalRebuild="true"
    6.11  				BasicRuntimeChecks="3"
    6.12 @@ -124,7 +124,7 @@
    6.13  				Name="VCCLCompilerTool"
    6.14  				AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.15  				FavorSizeOrSpeed="1"
    6.16 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core-legacy&quot;;&quot;$(MMSOURCE17)\core-legacy\sourcehook&quot;"
    6.17 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\game_shared&quot;;&quot;$(MMSOURCE17)\core-legacy&quot;;&quot;$(MMSOURCE17)\core-legacy\sourcehook&quot;"
    6.18  				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
    6.19  				RuntimeLibrary="0"
    6.20  				EnableEnhancedInstructionSet="0"
    6.21 @@ -205,7 +205,7 @@
    6.22  				Name="VCCLCompilerTool"
    6.23  				AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.24  				Optimization="0"
    6.25 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\common&quot;;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.26 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\common&quot;;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(HL2SDKOB)\game\shared&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.27  				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=3"
    6.28  				MinimalRebuild="true"
    6.29  				BasicRuntimeChecks="3"
    6.30 @@ -287,7 +287,7 @@
    6.31  				Name="VCCLCompilerTool"
    6.32  				AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.33  				FavorSizeOrSpeed="1"
    6.34 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\common&quot;;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.35 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\common&quot;;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(HL2SDKOB)\game\shared&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.36  				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=3"
    6.37  				RuntimeLibrary="0"
    6.38  				EnableEnhancedInstructionSet="0"
    6.39 @@ -368,7 +368,7 @@
    6.40  				Name="VCCLCompilerTool"
    6.41  				AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.42  				Optimization="0"
    6.43 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.44 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\game_shared&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.45  				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
    6.46  				MinimalRebuild="true"
    6.47  				BasicRuntimeChecks="3"
    6.48 @@ -450,7 +450,7 @@
    6.49  				Name="VCCLCompilerTool"
    6.50  				AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.51  				FavorSizeOrSpeed="1"
    6.52 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.53 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\game_shared&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.54  				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
    6.55  				RuntimeLibrary="0"
    6.56  				EnableEnhancedInstructionSet="0"
    6.57 @@ -531,7 +531,7 @@
    6.58  				Name="VCCLCompilerTool"
    6.59  				AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.60  				Optimization="0"
    6.61 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\common&quot;;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.62 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\common&quot;;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(HL2SDKL4D)\game\shared&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.63  				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=4"
    6.64  				MinimalRebuild="true"
    6.65  				BasicRuntimeChecks="3"
    6.66 @@ -613,7 +613,7 @@
    6.67  				Name="VCCLCompilerTool"
    6.68  				AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.69  				FavorSizeOrSpeed="1"
    6.70 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\common&quot;;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.71 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\common&quot;;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(HL2SDKL4D)\game\shared&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.72  				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=4"
    6.73  				RuntimeLibrary="0"
    6.74  				EnableEnhancedInstructionSet="0"
    6.75 @@ -694,7 +694,7 @@
    6.76  				Name="VCCLCompilerTool"
    6.77  				AdditionalOptions="/D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.78  				Optimization="0"
    6.79 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK-DARKM)\public&quot;;&quot;$(HL2SDK-DARKM)\public\dlls&quot;;&quot;$(HL2SDK-DARKM)\public\engine&quot;;&quot;$(HL2SDK-DARKM)\public\mathlib&quot;;&quot;$(HL2SDK-DARKM)\public\tier0&quot;;&quot;$(HL2SDK-DARKM)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.80 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK-DARKM)\public&quot;;&quot;$(HL2SDK-DARKM)\public\dlls&quot;;&quot;$(HL2SDK-DARKM)\public\engine&quot;;&quot;$(HL2SDK-DARKM)\public\mathlib&quot;;&quot;$(HL2SDK-DARKM)\public\tier0&quot;;&quot;$(HL2SDK-DARKM)\public\tier1&quot;;&quot;$(HL2SDK-DARKM\game_shared&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.81  				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
    6.82  				MinimalRebuild="true"
    6.83  				BasicRuntimeChecks="3"
    6.84 @@ -776,7 +776,7 @@
    6.85  				Name="VCCLCompilerTool"
    6.86  				AdditionalOptions="/MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_LEFT4DEAD=4"
    6.87  				FavorSizeOrSpeed="1"
    6.88 -				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK-DARKM)\public&quot;;&quot;$(HL2SDK-DARKM)\public\dlls&quot;;&quot;$(HL2SDK-DARKM)\public\engine&quot;;&quot;$(HL2SDK-DARKM)\public\mathlib&quot;;&quot;$(HL2SDK-DARKM)\public\tier0&quot;;&quot;$(HL2SDK-DARKM)\public\tier1&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.89 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK-DARKM)\public&quot;;&quot;$(HL2SDK-DARKM)\public\dlls&quot;;&quot;$(HL2SDK-DARKM)\public\engine&quot;;&quot;$(HL2SDK-DARKM)\public\mathlib&quot;;&quot;$(HL2SDK-DARKM)\public\tier0&quot;;&quot;$(HL2SDK-DARKM)\public\tier1&quot;;&quot;$(HL2SDK-DARKM)\game_shared&quot;;&quot;$(MMSOURCE17)\core&quot;;&quot;$(MMSOURCE17)\core\sourcehook&quot;"
    6.90  				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2"
    6.91  				RuntimeLibrary="0"
    6.92  				EnableEnhancedInstructionSet="0"
    6.93 @@ -845,6 +845,10 @@
    6.94  				>
    6.95  			</File>
    6.96  			<File
    6.97 +				RelativePath="..\hooks.cpp"
    6.98 +				>
    6.99 +			</File>
   6.100 +			<File
   6.101  				RelativePath="..\inputnatives.cpp"
   6.102  				>
   6.103  			</File>
   6.104 @@ -927,6 +931,10 @@
   6.105  				>
   6.106  			</File>
   6.107  			<File
   6.108 +				RelativePath="..\hooks.h"
   6.109 +				>
   6.110 +			</File>
   6.111 +			<File
   6.112  				RelativePath="..\..\..\public\extensions\ISDKTools.h"
   6.113  				>
   6.114  			</File>
     7.1 --- a/extensions/sdktools/sdk/smsdk_config.h	Fri Apr 24 18:20:55 2009 +1200
     7.2 +++ b/extensions/sdktools/sdk/smsdk_config.h	Tue May 12 13:54:06 2009 +1200
     7.3 @@ -61,7 +61,7 @@
     7.4  #define SMEXT_CONF_METAMOD		
     7.5  
     7.6  /** Enable interfaces you want to use here by uncommenting lines */
     7.7 -//#define SMEXT_ENABLE_FORWARDSYS
     7.8 +#define SMEXT_ENABLE_FORWARDSYS
     7.9  #define SMEXT_ENABLE_HANDLESYS
    7.10  #define SMEXT_ENABLE_PLAYERHELPERS
    7.11  //#define SMEXT_ENABLE_DBMANAGER
     8.1 --- a/extensions/sdktools/voice.cpp	Fri Apr 24 18:20:55 2009 +1200
     8.2 +++ b/extensions/sdktools/voice.cpp	Tue May 12 13:54:06 2009 +1200
     8.3 @@ -30,6 +30,7 @@
     8.4   */
     8.5  
     8.6  #include <extension.h>
     8.7 +#include <hooks.h>
     8.8  
     8.9  #define SPEAK_NORMAL		0
    8.10  #define SPEAK_MUTED			1
    8.11 @@ -116,6 +117,8 @@
    8.12  
    8.13  void SDKTools::OnClientDisconnecting(int client)
    8.14  {
    8.15 +	g_Hooks.OnClientDisconnecting(client);
    8.16 +
    8.17  	int max_clients = playerhelpers->GetMaxClients();
    8.18  
    8.19  	if (g_VoiceHookCount == 0)
     9.1 --- a/gamedata/sdktools.games/engine.l4d.txt	Fri Apr 24 18:20:55 2009 +1200
     9.2 +++ b/gamedata/sdktools.games/engine.l4d.txt	Tue May 12 13:54:06 2009 +1200
     9.3 @@ -365,6 +365,11 @@
     9.4  				"windows"	"31"
     9.5  				"linux"		"32"
     9.6  			}
     9.7 +			"PlayerRunCmd"
     9.8 +			{
     9.9 +				"windows"	"427"
    9.10 +				"linux"		"428"
    9.11 +			}
    9.12  		}
    9.13  	}
    9.14  }
    10.1 --- a/gamedata/sdktools.games/game.cstrike.txt	Fri Apr 24 18:20:55 2009 +1200
    10.2 +++ b/gamedata/sdktools.games/game.cstrike.txt	Tue May 12 13:54:06 2009 +1200
    10.3 @@ -104,6 +104,11 @@
    10.4  				"windows"	"32"
    10.5  				"linux"		"33"
    10.6  			}
    10.7 +			"PlayerRunCmd"
    10.8 +			{
    10.9 +				"windows"	"347"
   10.10 +				"linux"		"348"
   10.11 +			}
   10.12  		}
   10.13  	}
   10.14  }
   10.15 \ No newline at end of file
    11.1 --- a/gamedata/sdktools.games/game.tf.txt	Fri Apr 24 18:20:55 2009 +1200
    11.2 +++ b/gamedata/sdktools.games/game.tf.txt	Tue May 12 13:54:06 2009 +1200
    11.3 @@ -96,6 +96,11 @@
    11.4  				"windows"	"31"
    11.5  				"linux"		"32"
    11.6  			}
    11.7 +			"PlayerRunCmd"
    11.8 +			{
    11.9 +				"windows"	"368"
   11.10 +				"linux"		"369"
   11.11 +			}
   11.12  		}
   11.13  	}
   11.14  }
   11.15 \ No newline at end of file
    12.1 --- a/plugins/include/sdktools.inc	Fri Apr 24 18:20:55 2009 +1200
    12.2 +++ b/plugins/include/sdktools.inc	Tue May 12 13:54:06 2009 +1200
    12.3 @@ -48,6 +48,7 @@
    12.4  #include <sdktools_voice>
    12.5  #include <sdktools_entinput>
    12.6  #include <sdktools_entoutput>
    12.7 +#include <sdktools_hooks>
    12.8  
    12.9  enum SDKCallType
   12.10  {
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/plugins/include/sdktools_hooks.inc	Tue May 12 13:54:06 2009 +1200
    13.3 @@ -0,0 +1,49 @@
    13.4 +/**
    13.5 + * vim: set ts=4 :
    13.6 + * =============================================================================
    13.7 + * SourceMod (C)2004-2009 AlliedModders LLC.  All rights reserved.
    13.8 + * =============================================================================
    13.9 + *
   13.10 + * This file is part of the SourceMod/SourcePawn SDK.
   13.11 + *
   13.12 + * This program is free software; you can redistribute it and/or modify it under
   13.13 + * the terms of the GNU General Public License, version 3.0, as published by the
   13.14 + * Free Software Foundation.
   13.15 + * 
   13.16 + * This program is distributed in the hope that it will be useful, but WITHOUT
   13.17 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   13.18 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   13.19 + * details.
   13.20 + *
   13.21 + * You should have received a copy of the GNU General Public License along with
   13.22 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   13.23 + *
   13.24 + * As a special exception, AlliedModders LLC gives you permission to link the
   13.25 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   13.26 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   13.27 + * by the Valve Corporation.  You must obey the GNU General Public License in
   13.28 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   13.29 + * this exception to all derivative works.  AlliedModders LLC defines further
   13.30 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   13.31 + * or <http://www.sourcemod.net/license.php>.
   13.32 + *
   13.33 + * Version: $Id$
   13.34 + */
   13.35 +
   13.36 +#if defined _sdktools_hooks_included
   13.37 +  #endinput
   13.38 +#endif
   13.39 +#define _sdktools_hooks_included
   13.40 +
   13.41 +/**
   13.42 + * @brief Called when a clients movement buttons are being processed
   13.43 + *
   13.44 + * @param client	Index of the client.
   13.45 + * @param buttons	Copyback buffer containing the current commands (as bitflags - see entity_prop_stocks.inc).
   13.46 + * @param impulse	Copyback buffer containing the current impulse command.
   13.47 + * @param vel		Players desired velocity.
   13.48 + * @param angles	Players desired view angles.
   13.49 + * @param weapon	Entity index of the new weapon if player switches weapon, 0 otherwise.
   13.50 + * @return 			Plugin_Handled to block the commands from being processed, Plugin_Continue otherwise.
   13.51 + */
   13.52 +forward Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon);
   13.53 \ No newline at end of file