extensions/sdktools/hooks.cpp
changeset 2910 e8f6e9f3401a
parent 2732 dbe9e8ed3703
child 3084 db8d1162e9cf
     1.1 --- a/extensions/sdktools/hooks.cpp	Wed Jan 20 04:01:39 2010 -0800
     1.2 +++ b/extensions/sdktools/hooks.cpp	Wed Jan 20 04:03:46 2010 -0800
     1.3 @@ -33,6 +33,7 @@
     1.4  #include "extension.h"
     1.5  
     1.6  CHookManager g_Hooks;
     1.7 +static bool PRCH_enabled = false;
     1.8  
     1.9  SH_DECL_MANUALHOOK2_void(PlayerRunCmdHook, 0, 0, 0, CUserCmd *, IMoveHelper *);
    1.10  
    1.11 @@ -47,6 +48,7 @@
    1.12  	if (g_pGameConf->GetOffset("PlayerRunCmd", &offset))
    1.13  	{
    1.14  		SH_MANUALHOOK_RECONFIGURE(PlayerRunCmdHook, offset, 0, 0);
    1.15 +		PRCH_enabled = true;
    1.16  	}
    1.17  
    1.18  	m_usercmdsFwd = forwards->CreateForward("OnPlayerRunCmd", ET_Event, 6, NULL, Param_Cell, Param_CellByRef, Param_CellByRef, Param_Array, Param_Array, Param_CellByRef);
    1.19 @@ -59,6 +61,9 @@
    1.20  
    1.21  void CHookManager::OnClientPutInServer(int client)
    1.22  {
    1.23 +	if (!PRCH_enabled)
    1.24 +		return;
    1.25 +
    1.26  	edict_t *pEdict = PEntityOfEntIndex(client);
    1.27  	if (!pEdict)
    1.28  	{
    1.29 @@ -82,6 +87,9 @@
    1.30  
    1.31  void CHookManager::OnClientDisconnecting(int client)
    1.32  {
    1.33 +	if (!PRCH_enabled)
    1.34 +		return;
    1.35 +
    1.36  	edict_t *pEdict = PEntityOfEntIndex(client);
    1.37  	if (!pEdict)
    1.38  	{