Implemented amb584 - CGlobalEntityList support in SDKTools
authorScott Ehlert <ds@alliedmods.net>
Wed Aug 01 07:18:58 2007 +0000 (2007-08-01)
changeset 124079eebacc9d02
parent 1239 eed86aca8fae
child 1241 2e8046793bc9
Implemented amb584 - CGlobalEntityList support in SDKTools
Also added FindEntityByClassname native to start this off
extensions/sdktools/Makefile
extensions/sdktools/extension.cpp
extensions/sdktools/gamerules.cpp
extensions/sdktools/gamerules.h
extensions/sdktools/msvc8/sdktools.vcproj
extensions/sdktools/vcallbuilder.cpp
extensions/sdktools/vcaller.cpp
extensions/sdktools/vdecoder.h
extensions/sdktools/vglobals.cpp
extensions/sdktools/vglobals.h
extensions/sdktools/vnatives.cpp
gamedata/sdktools.games.txt
plugins/include/sdktools.inc
plugins/include/sdktools_functions.inc
     1.1 --- a/extensions/sdktools/Makefile	Wed Aug 01 06:55:55 2007 +0000
     1.2 +++ b/extensions/sdktools/Makefile	Wed Aug 01 07:18:58 2007 +0000
     1.3 @@ -14,9 +14,9 @@
     1.4  #Uncomment for SourceMM-enabled extensions
     1.5  LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so tier0_i486.so
     1.6  
     1.7 -OBJECTS = sdk/smsdk_ext.cpp extension.cpp gamerules.cpp vdecoder.cpp vcallbuilder.cpp \
     1.8 -	vcaller.cpp vnatives.cpp vsound.cpp tenatives.cpp trnatives.cpp tempents.cpp vstringtable.cpp \
     1.9 -	vhelpers.cpp voice.cpp
    1.10 +OBJECTS = sdk/smsdk_ext.cpp extension.cpp vdecoder.cpp vcallbuilder.cpp vcaller.cpp \
    1.11 +	vnatives.cpp vsound.cpp tenatives.cpp trnatives.cpp tempents.cpp vstringtable.cpp \
    1.12 +	vhelpers.cpp vglobals.cpp voice.cpp
    1.13  
    1.14  ##############################################
    1.15  ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
     2.1 --- a/extensions/sdktools/extension.cpp	Wed Aug 01 06:55:55 2007 +0000
     2.2 +++ b/extensions/sdktools/extension.cpp	Wed Aug 01 07:18:58 2007 +0000
     2.3 @@ -34,8 +34,8 @@
     2.4  #include "vcallbuilder.h"
     2.5  #include "vnatives.h"
     2.6  #include "vhelpers.h"
     2.7 +#include "vglobals.h"
     2.8  #include "tempents.h"
     2.9 -#include "gamerules.h"
    2.10  
    2.11  /**
    2.12   * @file extension.cpp
    2.13 @@ -52,10 +52,10 @@
    2.14  IGameConfig *g_pGameConf = NULL;
    2.15  IGameHelpers *g_pGameHelpers = NULL;
    2.16  IServerGameClients *serverClients = NULL;
    2.17 +IVoiceServer *voiceserver = NULL;
    2.18  IPlayerInfoManager *playerinfomngr = NULL;
    2.19  HandleType_t g_CallHandle = 0;
    2.20  HandleType_t g_TraceHandle = 0;
    2.21 -IVoiceServer *voiceserver = NULL;
    2.22  
    2.23  SMEXT_LINK(&g_SdkTools);
    2.24  
    2.25 @@ -143,7 +143,7 @@
    2.26  	SM_GET_LATE_IFACE(BINTOOLS, g_pBinTools);
    2.27  
    2.28  	g_TEManager.Initialize();
    2.29 -	InitializeGameRules();
    2.30 +	InitializeValveGlobals();
    2.31  }
    2.32  
    2.33  bool SDKTools::QueryRunning(char *error, size_t maxlength)
     3.1 --- a/extensions/sdktools/gamerules.cpp	Wed Aug 01 06:55:55 2007 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,62 +0,0 @@
     3.4 -/**
     3.5 - * vim: set ts=4 :
     3.6 - * ================================================================
     3.7 - * SourceMod SDKTools Extension
     3.8 - * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
     3.9 - * ================================================================
    3.10 - *
    3.11 - * This program is free software; you can redistribute it and/or 
    3.12 - * modify it under the terms of the GNU General Public License, 
    3.13 - * version 3.0, as published by the Free Software Foundation.
    3.14 - * 
    3.15 - * This program is distributed in the hope that it will be useful,
    3.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.18 - * GNU General Public License for more details.
    3.19 - *
    3.20 - * You should have received a copy of the GNU General Public License
    3.21 - * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    3.22 - *
    3.23 - * As a special exception, AlliedModders LLC gives you permission to 
    3.24 - * link the code of this program (as well as its derivative works) to 
    3.25 - * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any 
    3.26 - * Game MODs that run on software by the Valve Corporation.  You must 
    3.27 - * obey the GNU General Public License in all respects for all other 
    3.28 - * code used. Additionally, AlliedModders LLC grants this exception 
    3.29 - * to all derivative works. AlliedModders LLC defines further 
    3.30 - * exceptions, found in LICENSE.txt (as of this writing, version 
    3.31 - * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
    3.32 - *
    3.33 - * Version: $Id$
    3.34 - */
    3.35 -
    3.36 -#include "extension.h"
    3.37 -
    3.38 -void **g_pGameRules = NULL;
    3.39 -
    3.40 -void InitializeGameRules()
    3.41 -{
    3.42 -	char *addr = NULL;
    3.43 -
    3.44 -#ifdef PLATFORM_WINDOWS
    3.45 -	int offset = 0;
    3.46 -
    3.47 -	if (!g_pGameConf->GetMemSig("CreateGameRulesObject", (void **)&addr) || !addr)
    3.48 -	{
    3.49 -		return;
    3.50 -	}
    3.51 -	if (!g_pGameConf->GetOffset("g_pGameRules", &offset) || !offset)
    3.52 -	{
    3.53 -		return;
    3.54 -	}
    3.55 -
    3.56 -	g_pGameRules = *reinterpret_cast<void ***>(addr + offset);
    3.57 -#elif defined PLATFORM_LINUX
    3.58 -	if (!g_pGameConf->GetMemSig("g_pGameRules", (void **)&addr) || !addr)
    3.59 -	{
    3.60 -		return;
    3.61 -	}
    3.62 -
    3.63 -	g_pGameRules = reinterpret_cast<void **>(addr);
    3.64 -#endif
    3.65 -}
     4.1 --- a/extensions/sdktools/gamerules.h	Wed Aug 01 06:55:55 2007 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,40 +0,0 @@
     4.4 -/**
     4.5 - * vim: set ts=4 :
     4.6 - * ================================================================
     4.7 - * SourceMod SDKTools Extension
     4.8 - * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
     4.9 - * ================================================================
    4.10 - *
    4.11 - * This program is free software; you can redistribute it and/or 
    4.12 - * modify it under the terms of the GNU General Public License, 
    4.13 - * version 3.0, as published by the Free Software Foundation.
    4.14 - * 
    4.15 - * This program is distributed in the hope that it will be useful,
    4.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.18 - * GNU General Public License for more details.
    4.19 - *
    4.20 - * You should have received a copy of the GNU General Public License
    4.21 - * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    4.22 - *
    4.23 - * As a special exception, AlliedModders LLC gives you permission to 
    4.24 - * link the code of this program (as well as its derivative works) to 
    4.25 - * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any 
    4.26 - * Game MODs that run on software by the Valve Corporation.  You must 
    4.27 - * obey the GNU General Public License in all respects for all other 
    4.28 - * code used. Additionally, AlliedModders LLC grants this exception 
    4.29 - * to all derivative works. AlliedModders LLC defines further 
    4.30 - * exceptions, found in LICENSE.txt (as of this writing, version 
    4.31 - * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
    4.32 - *
    4.33 - * Version: $Id$
    4.34 - */
    4.35 -
    4.36 -#ifndef _INCLUDE_SDKTOOLS_GAMERULES_H_
    4.37 -#define _INCLUDE_SDKTOOLS_GAMERULES_H_
    4.38 -
    4.39 -extern void **g_pGameRules;
    4.40 -
    4.41 -void InitializeGameRules();
    4.42 -
    4.43 -#endif // _INCLUDE_SDKTOOLS_GAMERULES_H_
     5.1 --- a/extensions/sdktools/msvc8/sdktools.vcproj	Wed Aug 01 06:55:55 2007 +0000
     5.2 +++ b/extensions/sdktools/msvc8/sdktools.vcproj	Wed Aug 01 07:18:58 2007 +0000
     5.3 @@ -188,10 +188,6 @@
     5.4  				>
     5.5  			</File>
     5.6  			<File
     5.7 -				RelativePath="..\gamerules.cpp"
     5.8 -				>
     5.9 -			</File>
    5.10 -			<File
    5.11  				RelativePath="..\tempents.cpp"
    5.12  				>
    5.13  			</File>
    5.14 @@ -216,6 +212,10 @@
    5.15  				>
    5.16  			</File>
    5.17  			<File
    5.18 +				RelativePath="..\vglobals.cpp"
    5.19 +				>
    5.20 +			</File>
    5.21 +			<File
    5.22  				RelativePath="..\vhelpers.cpp"
    5.23  				>
    5.24  			</File>
    5.25 @@ -250,10 +250,6 @@
    5.26  				>
    5.27  			</File>
    5.28  			<File
    5.29 -				RelativePath="..\gamerules.h"
    5.30 -				>
    5.31 -			</File>
    5.32 -			<File
    5.33  				RelativePath="..\tempents.h"
    5.34  				>
    5.35  			</File>
    5.36 @@ -266,6 +262,10 @@
    5.37  				>
    5.38  			</File>
    5.39  			<File
    5.40 +				RelativePath="..\vglobals.h"
    5.41 +				>
    5.42 +			</File>
    5.43 +			<File
    5.44  				RelativePath="..\vhelpers.h"
    5.45  				>
    5.46  			</File>
     6.1 --- a/extensions/sdktools/vcallbuilder.cpp	Wed Aug 01 06:55:55 2007 +0000
     6.2 +++ b/extensions/sdktools/vcallbuilder.cpp	Wed Aug 01 07:18:58 2007 +0000
     6.3 @@ -156,10 +156,11 @@
     6.4  			thisinfo->flags = PASSFLAG_BYVAL;
     6.5  			thisinfo->decflags = 0;
     6.6  			break;
     6.7 -		case ValveCall_GameRules:
     6.8 +		default:
     6.9  			thisinfo->vtype = Valve_POD;
    6.10  			thisinfo->flags = PASSFLAG_ASPOINTER;
    6.11  			thisinfo->decflags = 0;
    6.12 +			break;
    6.13  		}
    6.14  		thisinfo->encflags = 0;
    6.15  		thisinfo->offset = 0;
    6.16 @@ -340,7 +341,7 @@
    6.17  		vc->thisinfo->flags = PASSFLAG_BYVAL;
    6.18  		vc->thisinfo->decflags = 0;
    6.19  		break;
    6.20 -	case ValveCall_GameRules:
    6.21 +	default:
    6.22  		vc->thisinfo->vtype = Valve_POD;
    6.23  		vc->thisinfo->flags = PASSFLAG_ASPOINTER;
    6.24  		vc->thisinfo->decflags = 0;
     7.1 --- a/extensions/sdktools/vcaller.cpp	Wed Aug 01 06:55:55 2007 +0000
     7.2 +++ b/extensions/sdktools/vcaller.cpp	Wed Aug 01 07:18:58 2007 +0000
     7.3 @@ -32,7 +32,7 @@
     7.4  
     7.5  #include "extension.h"
     7.6  #include "vcallbuilder.h"
     7.7 -#include "gamerules.h"
     7.8 +#include "vglobals.h"
     7.9  
    7.10  enum SDKLibrary
    7.11  {
    7.12 @@ -296,6 +296,17 @@
    7.13  				*(void **)ptr = gamerules;
    7.14  			}
    7.15  			break;
    7.16 +		case ValveCall_EntityList:
    7.17 +			{
    7.18 +				if (g_EntList == NULL)
    7.19 +				{
    7.20 +					vc->stk_put(ptr);
    7.21 +					return pContext->ThrowNativeError("EntityList unsupported or not available; file a bug report");
    7.22 +				}
    7.23 +
    7.24 +				*(void **)ptr = g_EntList;
    7.25 +			}
    7.26 +			break;
    7.27  		}
    7.28  	}
    7.29  
     8.1 --- a/extensions/sdktools/vdecoder.h	Wed Aug 01 06:55:55 2007 +0000
     8.2 +++ b/extensions/sdktools/vdecoder.h	Wed Aug 01 07:18:58 2007 +0000
     8.3 @@ -80,6 +80,7 @@
     8.4  	ValveCall_Entity,		/**< Thiscall (CBaseEntity implicit first parameter) */
     8.5  	ValveCall_Player,		/**< Thiscall (CBasePlayer implicit first parameter) */
     8.6  	ValveCall_GameRules,	/**< Thiscall (CGameRules implicit first paramater) */
     8.7 +	ValveCall_EntityList,	/**< Thiscall (CGlobalEntityList implicit first paramater) */
     8.8  };
     8.9  
    8.10  /**
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/extensions/sdktools/vglobals.cpp	Wed Aug 01 07:18:58 2007 +0000
     9.3 @@ -0,0 +1,76 @@
     9.4 +/**
     9.5 + * vim: set ts=4 :
     9.6 + * ===============================================================
     9.7 + * SourceMod SDK Tools Extension
     9.8 + * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
     9.9 + * ===============================================================
    9.10 + *
    9.11 + * This program is free software; you can redistribute it and/or
    9.12 + * modify it under the terms of the GNU General Public License
    9.13 + * as published by the Free Software Foundation; either version 2
    9.14 + * of the License, or (at your option) any later version.
    9.15 + * This program is distributed in the hope that it will be useful,
    9.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9.18 + * GNU General Public License for more details.
    9.19 + * 
    9.20 + * You should have received a copy of the GNU General Public License
    9.21 + * along with this program; if not, write to the Free Software
    9.22 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    9.23 + *
    9.24 + * Version: $Id$
    9.25 + */
    9.26 +
    9.27 +#include "extension.h"
    9.28 +
    9.29 +void **g_pGameRules = NULL;
    9.30 +void *g_EntList = NULL;
    9.31 +
    9.32 +#ifdef PLATFORM_WINDOWS
    9.33 +void InitializeValveGlobals()
    9.34 +{
    9.35 +	char *addr = NULL;
    9.36 +	int offset;
    9.37 +
    9.38 +	/* g_pGameRules */
    9.39 +	if (!g_pGameConf->GetMemSig("CreateGameRulesObject", (void **)&addr) || !addr)
    9.40 +	{
    9.41 +		return;
    9.42 +	}
    9.43 +	if (!g_pGameConf->GetOffset("g_pGameRules", &offset) || !offset)
    9.44 +	{
    9.45 +		return;
    9.46 +	}
    9.47 +	g_pGameRules = *reinterpret_cast<void ***>(addr + offset);
    9.48 +
    9.49 +	/* gEntList and/or g_pEntityList */
    9.50 +	if (!g_pGameConf->GetMemSig("LevelShutdown", (void **)&addr) || !addr)
    9.51 +	{
    9.52 +		return;
    9.53 +	}
    9.54 +	if (!g_pGameConf->GetOffset("gEntList", &offset) || !offset)
    9.55 +	{
    9.56 +		return;
    9.57 +	}
    9.58 +	g_EntList = *reinterpret_cast<void **>(addr + offset);
    9.59 +}
    9.60 +#elif defined PLATFORM_LINUX
    9.61 +void InitializeValveGlobals()
    9.62 +{
    9.63 +	char *addr = NULL;
    9.64 +
    9.65 +	/* g_pGameRules */
    9.66 +	if (!g_pGameConf->GetMemSig("g_pGameRules", (void **)&addr) || !addr)
    9.67 +	{
    9.68 +		return;
    9.69 +	}
    9.70 +	g_pGameRules = reinterpret_cast<void **>(addr);
    9.71 +
    9.72 +	/* gEntList and/or g_pEntityList */
    9.73 +	if (!g_pGameConf->GetMemSig("gEntList", (void **)&addr) || !addr)
    9.74 +	{
    9.75 +		return;
    9.76 +	}
    9.77 +	g_EntList = reinterpret_cast<void *>(addr);
    9.78 +}
    9.79 +#endif
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/extensions/sdktools/vglobals.h	Wed Aug 01 07:18:58 2007 +0000
    10.3 @@ -0,0 +1,32 @@
    10.4 +/**
    10.5 + * vim: set ts=4 :
    10.6 + * ===============================================================
    10.7 + * SourceMod SDK Tools Extension
    10.8 + * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
    10.9 + * ===============================================================
   10.10 + *
   10.11 + * This program is free software; you can redistribute it and/or
   10.12 + * modify it under the terms of the GNU General Public License
   10.13 + * as published by the Free Software Foundation; either version 2
   10.14 + * of the License, or (at your option) any later version.
   10.15 + * This program is distributed in the hope that it will be useful,
   10.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   10.18 + * GNU General Public License for more details.
   10.19 + * 
   10.20 + * You should have received a copy of the GNU General Public License
   10.21 + * along with this program; if not, write to the Free Software
   10.22 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   10.23 + *
   10.24 + * Version: $Id$
   10.25 + */
   10.26 +
   10.27 +#ifndef _INCLUDE_SDKTOOLS_VGLOBALS_H_
   10.28 +#define _INCLUDE_SDKTOOLS_VGLOBALS_H_
   10.29 +
   10.30 +extern void **g_pGameRules;
   10.31 +extern void *g_EntList;
   10.32 +
   10.33 +void InitializeValveGlobals();
   10.34 +
   10.35 +#endif // _INCLUDE_SDKTOOLS_VGLOBALS_H_
    11.1 --- a/extensions/sdktools/vnatives.cpp	Wed Aug 01 06:55:55 2007 +0000
    11.2 +++ b/extensions/sdktools/vnatives.cpp	Wed Aug 01 07:18:58 2007 +0000
    11.3 @@ -36,6 +36,7 @@
    11.4  #include "vcallbuilder.h"
    11.5  #include "vnatives.h"
    11.6  #include "vhelpers.h"
    11.7 +#include "vglobals.h"
    11.8  #include "CellRecipientFilter.h"
    11.9  
   11.10  List<ValveCall *> g_RegCalls;
   11.11 @@ -212,7 +213,7 @@
   11.12  	return engine->IndexOfEdict(pEdict);
   11.13  }
   11.14  
   11.15 -static cell_t IgnitePlayer(IPluginContext *pContext, const cell_t *params)
   11.16 +static cell_t IgniteEntity(IPluginContext *pContext, const cell_t *params)
   11.17  {
   11.18  	static ValveCall *pCall = NULL;
   11.19  	if (!pCall)
   11.20 @@ -241,7 +242,7 @@
   11.21  	return 1;
   11.22  }
   11.23  
   11.24 -static cell_t ExtinguishPlayer(IPluginContext *pContext, const cell_t *params)
   11.25 +static cell_t ExtinguishEntity(IPluginContext *pContext, const cell_t *params)
   11.26  {
   11.27  	static ValveCall *pCall = NULL;
   11.28  	if (!pCall)
   11.29 @@ -261,7 +262,7 @@
   11.30  	return 1;
   11.31  }
   11.32  
   11.33 -static cell_t TeleportPlayer(IPluginContext *pContext, const cell_t *params)
   11.34 +static cell_t TeleportEntity(IPluginContext *pContext, const cell_t *params)
   11.35  {
   11.36  	static ValveCall *pCall = NULL;
   11.37  	if (!pCall)
   11.38 @@ -564,6 +565,44 @@
   11.39  	return 1;
   11.40  }
   11.41  
   11.42 +static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *params)
   11.43 +{
   11.44 +	static ValveCall *pCall = NULL;
   11.45 +	if (!pCall)
   11.46 +	{
   11.47 +		ValvePassInfo pass[3];
   11.48 +		InitPass(pass[0], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL, VDECODE_FLAG_ALLOWNULL|VDECODE_FLAG_ALLOWWORLD);
   11.49 +		InitPass(pass[1], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   11.50 +		InitPass(pass[2], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
   11.51 +		if (!CreateBaseCall("FindEntityByClassname", ValveCall_EntityList, &pass[2], pass, 2, &pCall))
   11.52 +		{
   11.53 +			return pContext->ThrowNativeError("\"FindEntityByClassname\" not supported by this mod");
   11.54 +		} else if (!pCall) {
   11.55 +			return pContext->ThrowNativeError("\"FindEntityByClassname\" wrapper failed to initialized");
   11.56 +		}
   11.57 +	}
   11.58 +
   11.59 +	CBaseEntity *pEntity;
   11.60 +	START_CALL();
   11.61 +	*(void **)vptr = g_EntList; 
   11.62 +	DECODE_VALVE_PARAM(1, vparams, 0);
   11.63 +	DECODE_VALVE_PARAM(2, vparams, 1);
   11.64 +	FINISH_CALL_SIMPLE(&pEntity);
   11.65 +
   11.66 +	if (pEntity == NULL)
   11.67 +	{
   11.68 +		return -1;
   11.69 +	}
   11.70 +
   11.71 +	edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
   11.72 +	if (!pEdict)
   11.73 +	{
   11.74 +		return -1;
   11.75 +	}
   11.76 +
   11.77 +	return engine->IndexOfEdict(pEdict);
   11.78 +}
   11.79 +
   11.80  static cell_t IsPlayerAlive(IPluginContext *pContext, const cell_t *params)
   11.81  {
   11.82  	IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
   11.83 @@ -600,21 +639,22 @@
   11.84  
   11.85  sp_nativeinfo_t g_Natives[] = 
   11.86  {
   11.87 -	{"ExtinguishPlayer",		ExtinguishPlayer},
   11.88 -	{"ExtinguishEntity",		ExtinguishPlayer},
   11.89 +	{"ExtinguishPlayer",		ExtinguishEntity},
   11.90 +	{"ExtinguishEntity",		ExtinguishEntity},
   11.91  	{"ForcePlayerSuicide",		ForcePlayerSuicide},
   11.92  	{"GivePlayerItem",			GiveNamedItem},
   11.93  	{"GetPlayerWeaponSlot",		GetPlayerWeaponSlot},
   11.94 -	{"IgnitePlayer",			IgnitePlayer},
   11.95 -	{"IgniteEntity",			IgnitePlayer},
   11.96 +	{"IgnitePlayer",			IgniteEntity},
   11.97 +	{"IgniteEntity",			IgniteEntity},
   11.98  	{"RemovePlayerItem",		RemovePlayerItem},
   11.99 -	{"TeleportPlayer",			TeleportPlayer},
  11.100 -	{"TeleportEntity",			TeleportPlayer},
  11.101 +	{"TeleportPlayer",			TeleportEntity},
  11.102 +	{"TeleportEntity",			TeleportEntity},
  11.103  	{"SetClientViewEntity",		SetClientViewEntity},
  11.104  	{"SetLightStyle",			SetLightStyle},
  11.105  	{"SlapPlayer",				SlapPlayer},
  11.106  	{"GetClientEyePosition",	GetClientEyePosition},
  11.107  	{"GetClientEyeAngles",		GetClientEyeAngles},
  11.108 +	{"FindEntityByClassname",	FindEntityByClassname},
  11.109  	{"IsPlayerAlive",			IsPlayerAlive},
  11.110  	{NULL,						NULL},
  11.111  };
    12.1 --- a/gamedata/sdktools.games.txt	Wed Aug 01 06:55:55 2007 +0000
    12.2 +++ b/gamedata/sdktools.games.txt	Wed Aug 01 07:18:58 2007 +0000
    12.3 @@ -124,6 +124,53 @@
    12.4  			}
    12.5  		}
    12.6  	}
    12.7 +	
    12.8 +	/* CGlobalEntityList */
    12.9 +	"#default"
   12.10 +	{
   12.11 +		"#supported"
   12.12 +		{
   12.13 +			"game"		"cstrike"
   12.14 +			"game"		"dod"
   12.15 +			"game"		"garrysmod"
   12.16 +			"game"		"hl2mp"
   12.17 +			"game"		"ship"
   12.18 +			"game"		"!Insurgency"
   12.19 +			"game"		"!Pirates, Vikings and Knights II"
   12.20 +			"game"		"!SourceForts v1.9.2"
   12.21 +		}
   12.22 +		
   12.23 +		"Offsets"
   12.24 +		{
   12.25 +			/* Offset into LevelShutdown */
   12.26 +			"gEntList"
   12.27 +			{
   12.28 +				"windows"	"11"
   12.29 +			}
   12.30 +		}
   12.31 +		
   12.32 +		"Signatures"
   12.33 +		{
   12.34 +			"LevelShutdown"
   12.35 +			{
   12.36 +				"library"	"server"
   12.37 +				"windows"	"\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8"
   12.38 +			}
   12.39 +			"gEntList"
   12.40 +			{
   12.41 +				"library"	"server"
   12.42 +				"linux"		"@gEntList"
   12.43 +			}
   12.44 +			
   12.45 +			/* Functions in CGlobalEntityList */
   12.46 +			"FindEntityByClassname"
   12.47 +			{
   12.48 +				"library"	"server"
   12.49 +				"windows"	"\x53\x55\x56\x8B\xF1\x8B\x4C\x24\x2A\x85\xC9\x57\x74\x2A\x8B\x01\xFF\x50\x2A\x8B\x08\x81\xE1\x2A\x2A\x2A\x2A\x83\xC1\x2A\xC1\xE1\x2A\x8B\x3C\x31\xEB\x2A\x8B\xBE\x2A\x2A\x2A\x2A\x85\xFF\x74\x2A\x8B\x5C\x24\x2A\x8B\x2D\x2A\x2A\x2A\x2A\x8D\x9B\x00\x00\x00\x00\x8B\x37\x85\xF6\x75\x2A\x68\x2A\x2A\x2A\x2A\xFF\x2A\x83\xC4\x2A\xEB\x2A\x39"
   12.50 +				"linux"		"@_ZN17CGlobalEntityList21FindEntityByClassnameEP11CBaseEntityPKc"
   12.51 +			}
   12.52 +		}
   12.53 +	}
   12.54  
   12.55  	/* Counter-Strike: Source */
   12.56  	"cstrike"
    13.1 --- a/plugins/include/sdktools.inc	Wed Aug 01 06:55:55 2007 +0000
    13.2 +++ b/plugins/include/sdktools.inc	Wed Aug 01 07:18:58 2007 +0000
    13.3 @@ -36,6 +36,7 @@
    13.4  	SDKCall_Entity,		/**< CBaseEntity call */
    13.5  	SDKCall_Player,		/**< CBasePlayer call */
    13.6  	SDKCall_GameRules,	/**< CGameRules call */
    13.7 +	SDKCall_EntityList,	/**< CGlobalEntityList call */ 
    13.8  };
    13.9  
   13.10  enum SDKLibrary
    14.1 --- a/plugins/include/sdktools_functions.inc	Wed Aug 01 06:55:55 2007 +0000
    14.2 +++ b/plugins/include/sdktools_functions.inc	Wed Aug 01 07:18:58 2007 +0000
    14.3 @@ -105,6 +105,17 @@
    14.4  native SlapPlayer(client, health=5, bool:sound=true);
    14.5  
    14.6  /**
    14.7 + * Searches for an entity by classname.
    14.8 + *
    14.9 + * @param startEnt		The entity index to begin searching from.
   14.10 + *						Use -1 to start from the first entity.
   14.11 + * @param classname		Classname of the entity to find.
   14.12 + * @return				Entity index >= 0 if found, -1 otherwise.
   14.13 + * @error				Lack of mod support.
   14.14 + */
   14.15 +native FindEntityByClassname(startEnt, const String:classname[]);
   14.16 +
   14.17 +/**
   14.18   * Returns the client's eye angles.
   14.19   *
   14.20   * @param client		Player's index.