extensions/sdktools/vnatives.cpp
branchrefac-jit
changeset 2284 026da5437111
parent 2192 7602d7fb60d9
child 2288 15c77b21589a
     1.1 --- a/extensions/sdktools/vnatives.cpp	Fri Jul 11 06:51:21 2008 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,1006 +0,0 @@
     1.4 -/**
     1.5 - * vim: set ts=4 :
     1.6 - * =============================================================================
     1.7 - * SourceMod SDKTools Extension
     1.8 - * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     1.9 - * =============================================================================
    1.10 - *
    1.11 - * This program is free software; you can redistribute it and/or modify it under
    1.12 - * the terms of the GNU General Public License, version 3.0, as published by the
    1.13 - * Free Software Foundation.
    1.14 - * 
    1.15 - * This program is distributed in the hope that it will be useful, but WITHOUT
    1.16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.17 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    1.18 - * details.
    1.19 - *
    1.20 - * You should have received a copy of the GNU General Public License along with
    1.21 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    1.22 - *
    1.23 - * As a special exception, AlliedModders LLC gives you permission to link the
    1.24 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    1.25 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    1.26 - * by the Valve Corporation.  You must obey the GNU General Public License in
    1.27 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    1.28 - * this exception to all derivative works.  AlliedModders LLC defines further
    1.29 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    1.30 - * or <http://www.sourcemod.net/license.php>.
    1.31 - *
    1.32 - * Version: $Id$
    1.33 - */
    1.34 -
    1.35 -#include <stdlib.h>
    1.36 -#include <sh_string.h>
    1.37 -#include "extension.h"
    1.38 -#include "vcallbuilder.h"
    1.39 -#include "vnatives.h"
    1.40 -#include "vhelpers.h"
    1.41 -#include "vglobals.h"
    1.42 -#include "CellRecipientFilter.h"
    1.43 -#include <inetchannel.h>
    1.44 -#include <iclient.h>
    1.45 -#include "iserver.h"
    1.46 -
    1.47 -SourceHook::List<ValveCall *> g_RegCalls;
    1.48 -SourceHook::List<ICallWrapper *> g_CallWraps;
    1.49 -
    1.50 -inline void InitPass(ValvePassInfo &info, ValveType vtype, PassType type, unsigned int flags, unsigned int decflags=0)
    1.51 -{
    1.52 -	info.decflags = decflags;
    1.53 -	info.encflags = 0;
    1.54 -	info.flags = flags;
    1.55 -	info.type = type;
    1.56 -	info.vtype = vtype;
    1.57 -}
    1.58 -
    1.59 -#define START_CALL() \
    1.60 -	unsigned char *vptr = pCall->stk_get();
    1.61 -
    1.62 -#define FINISH_CALL_SIMPLE(vret) \
    1.63 -	pCall->call->Execute(vptr, vret); \
    1.64 -	pCall->stk_put(vptr);
    1.65 -
    1.66 -#define ENCODE_VALVE_PARAM(num, which, vnum) \
    1.67 -	if (EncodeValveParam(pContext, \
    1.68 -			params[num], \
    1.69 -			pCall, \
    1.70 -			&pCall->which[vnum], \
    1.71 -			vptr) \
    1.72 -		== Data_Fail) \
    1.73 -	{ \
    1.74 -		return 0; \
    1.75 -	}
    1.76 -
    1.77 -#define DECODE_VALVE_PARAM(num, which, vnum) \
    1.78 -	if (DecodeValveParam(pContext, \
    1.79 -			params[num], \
    1.80 -			pCall, \
    1.81 -			&pCall->which[vnum], \
    1.82 -			vptr) \
    1.83 -		== Data_Fail) \
    1.84 -	{ \
    1.85 -		return 0; \
    1.86 -	}
    1.87 -
    1.88 -bool CreateBaseCall(const char *name,
    1.89 -						  ValveCallType vcalltype,
    1.90 -						  const ValvePassInfo *retinfo,
    1.91 -						  const ValvePassInfo params[],
    1.92 -						  unsigned int numParams,
    1.93 -						  ValveCall **vaddr)
    1.94 -{
    1.95 -	int offset;
    1.96 -	ValveCall *call;
    1.97 -	if (g_pGameConf->GetOffset(name, &offset))
    1.98 -	{
    1.99 -		call = CreateValveVCall(offset, vcalltype, retinfo, params, numParams);
   1.100 -		if (call)
   1.101 -		{
   1.102 -			g_RegCalls.push_back(call);
   1.103 -		}
   1.104 -		*vaddr = call;
   1.105 -		return true;
   1.106 -	} else {
   1.107 -		void *addr;
   1.108 -		if (g_pGameConf->GetMemSig(name, &addr))
   1.109 -		{
   1.110 -			call = CreateValveCall(addr, vcalltype, retinfo, params, numParams);
   1.111 -			if (call)
   1.112 -			{
   1.113 -				g_RegCalls.push_back(call);
   1.114 -			}
   1.115 -			*vaddr = call;
   1.116 -			return true;
   1.117 -		}
   1.118 -	}
   1.119 -	return false;
   1.120 -}
   1.121 -
   1.122 -static cell_t RemovePlayerItem(IPluginContext *pContext, const cell_t *params)
   1.123 -{
   1.124 -	static ValveCall *pCall = NULL;
   1.125 -	if (!pCall)
   1.126 -	{
   1.127 -		ValvePassInfo pass[2];
   1.128 -		InitPass(pass[0], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
   1.129 -		InitPass(pass[1], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
   1.130 -		if (!CreateBaseCall("RemovePlayerItem", ValveCall_Player, &pass[1], pass, 1, &pCall))
   1.131 -		{
   1.132 -			return pContext->ThrowNativeError("\"RemovePlayerItem\" not supported by this mod");
   1.133 -		} else if (!pCall) {
   1.134 -			return pContext->ThrowNativeError("\"RemovePlayerItem\" wrapper failed to initialized");
   1.135 -		}
   1.136 -	}
   1.137 -
   1.138 -	bool ret;
   1.139 -	START_CALL();
   1.140 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.141 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.142 -	FINISH_CALL_SIMPLE(&ret);
   1.143 -	return ret ? 1 : 0;
   1.144 -}
   1.145 -
   1.146 -static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params)
   1.147 -{
   1.148 -	static ValveCall *pCall = NULL;
   1.149 -	if (!pCall)
   1.150 -	{
   1.151 -		ValvePassInfo pass[3];
   1.152 -		InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.153 -		InitPass(pass[1], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
   1.154 -		InitPass(pass[2], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
   1.155 -		if (!CreateBaseCall("GiveNamedItem", ValveCall_Player, &pass[2], pass, 2, &pCall))
   1.156 -		{
   1.157 -			return pContext->ThrowNativeError("\"GiveNamedItem\" not supported by this mod");
   1.158 -		} else if (!pCall) {
   1.159 -			return pContext->ThrowNativeError("\"GiveNamedItem\" wrapper failed to initialized");
   1.160 -		}
   1.161 -	}
   1.162 -
   1.163 -	CBaseEntity *pEntity = NULL;
   1.164 -	START_CALL();
   1.165 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.166 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.167 -	DECODE_VALVE_PARAM(3, vparams, 1);
   1.168 -	FINISH_CALL_SIMPLE(&pEntity);
   1.169 -
   1.170 -	if (pEntity == NULL)
   1.171 -	{
   1.172 -		return -1;
   1.173 -	}
   1.174 -
   1.175 -	edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
   1.176 -	if (!pEdict)
   1.177 -	{
   1.178 -		return -1;
   1.179 -	}
   1.180 -
   1.181 -	return engine->IndexOfEdict(pEdict);
   1.182 -}
   1.183 -
   1.184 -static cell_t GetPlayerWeaponSlot(IPluginContext *pContext, const cell_t *params)
   1.185 -{
   1.186 -	static ValveCall *pCall = NULL;
   1.187 -	if (!pCall)
   1.188 -	{
   1.189 -		ValvePassInfo pass[2];
   1.190 -		InitPass(pass[0], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
   1.191 -		InitPass(pass[1], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
   1.192 -		if (!CreateBaseCall("Weapon_GetSlot", ValveCall_Player, &pass[1], pass, 1, &pCall))
   1.193 -		{
   1.194 -			return pContext->ThrowNativeError("\"Weapon_GetSlot\" not supported by this mod");
   1.195 -		} else if (!pCall) {
   1.196 -			return pContext->ThrowNativeError("\"Weapon_GetSlot\" wrapper failed to initialized");
   1.197 -		}
   1.198 -	}
   1.199 -
   1.200 -	CBaseEntity *pEntity;
   1.201 -	START_CALL();
   1.202 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.203 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.204 -	FINISH_CALL_SIMPLE(&pEntity);
   1.205 -
   1.206 -	if (pEntity == NULL)
   1.207 -	{
   1.208 -		return -1;
   1.209 -	}
   1.210 -
   1.211 -	edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
   1.212 -	if (!pEdict)
   1.213 -	{
   1.214 -		return -1;
   1.215 -	}
   1.216 -
   1.217 -	return engine->IndexOfEdict(pEdict);
   1.218 -}
   1.219 -
   1.220 -static cell_t IgniteEntity(IPluginContext *pContext, const cell_t *params)
   1.221 -{
   1.222 -	static ValveCall *pCall = NULL;
   1.223 -	if (!pCall)
   1.224 -	{
   1.225 -		ValvePassInfo pass[4];
   1.226 -		InitPass(pass[0], Valve_Float, PassType_Float, PASSFLAG_BYVAL);
   1.227 -		InitPass(pass[1], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
   1.228 -		InitPass(pass[2], Valve_Float, PassType_Float, PASSFLAG_BYVAL);
   1.229 -		InitPass(pass[3], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
   1.230 -		if (!CreateBaseCall("Ignite", ValveCall_Entity, NULL, pass, 4, &pCall))
   1.231 -		{
   1.232 -			return pContext->ThrowNativeError("\"Ignite\" not supported by this mod");
   1.233 -		} else if (!pCall) {
   1.234 -			return pContext->ThrowNativeError("\"Ignite\" wrapper failed to initialized");
   1.235 -		}
   1.236 -	}
   1.237 -
   1.238 -	START_CALL();
   1.239 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.240 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.241 -	DECODE_VALVE_PARAM(3, vparams, 1);
   1.242 -	DECODE_VALVE_PARAM(4, vparams, 2);
   1.243 -	DECODE_VALVE_PARAM(5, vparams, 3);
   1.244 -	FINISH_CALL_SIMPLE(NULL);
   1.245 -
   1.246 -	return 1;
   1.247 -}
   1.248 -
   1.249 -static cell_t ExtinguishEntity(IPluginContext *pContext, const cell_t *params)
   1.250 -{
   1.251 -	static ValveCall *pCall = NULL;
   1.252 -	if (!pCall)
   1.253 -	{
   1.254 -		if (!CreateBaseCall("Extinguish", ValveCall_Entity, NULL, NULL, 0, &pCall))
   1.255 -		{
   1.256 -			return pContext->ThrowNativeError("\"Extinguish\" not supported by this mod");
   1.257 -		} else if (!pCall) {
   1.258 -			return pContext->ThrowNativeError("\"Extinguish\" wrapper failed to initialized");
   1.259 -		}
   1.260 -	}
   1.261 -
   1.262 -	START_CALL();
   1.263 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.264 -	FINISH_CALL_SIMPLE(NULL);
   1.265 -
   1.266 -	return 1;
   1.267 -}
   1.268 -
   1.269 -static cell_t TeleportEntity(IPluginContext *pContext, const cell_t *params)
   1.270 -{
   1.271 -	static ValveCall *pCall = NULL;
   1.272 -	if (!pCall)
   1.273 -	{
   1.274 -		ValvePassInfo pass[3];
   1.275 -		InitPass(pass[0], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL, VDECODE_FLAG_ALLOWNULL);
   1.276 -		InitPass(pass[1], Valve_QAngle, PassType_Basic, PASSFLAG_BYVAL, VDECODE_FLAG_ALLOWNULL);
   1.277 -		InitPass(pass[2], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL, VDECODE_FLAG_ALLOWNULL);
   1.278 -		if (!CreateBaseCall("Teleport", ValveCall_Entity, NULL, pass, 3, &pCall))
   1.279 -		{
   1.280 -			return pContext->ThrowNativeError("\"Teleport\" not supported by this mod");
   1.281 -		} else if (!pCall) {
   1.282 -			return pContext->ThrowNativeError("\"Teleport\" wrapper failed to initialized");
   1.283 -		}
   1.284 -	}
   1.285 -
   1.286 -	START_CALL();
   1.287 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.288 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.289 -	DECODE_VALVE_PARAM(3, vparams, 1);
   1.290 -	DECODE_VALVE_PARAM(4, vparams, 2);
   1.291 -	FINISH_CALL_SIMPLE(NULL);
   1.292 -
   1.293 -	return 1;
   1.294 -}
   1.295 -
   1.296 -#if defined ORANGEBOX_BUILD
   1.297 -/* :TODO: This is Team Fortress 2 specific */
   1.298 -static cell_t ForcePlayerSuicide(IPluginContext *pContext, const cell_t *params)
   1.299 -{
   1.300 -	static ValveCall *pCall = NULL;
   1.301 -	if (!pCall)
   1.302 -	{
   1.303 -		ValvePassInfo pass[2];
   1.304 -		InitPass(pass[0], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
   1.305 -		InitPass(pass[1], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
   1.306 -		if (!CreateBaseCall("CommitSuicide", ValveCall_Player, NULL, pass, 2, &pCall))
   1.307 -		{
   1.308 -			return pContext->ThrowNativeError("\"CommitSuicide\" not supported by this mod");
   1.309 -		}
   1.310 -		else if (!pCall)
   1.311 -		{
   1.312 -			return pContext->ThrowNativeError("\"CommitSuicide\" wrapper failed to initialized");
   1.313 -		}
   1.314 -	}
   1.315 -
   1.316 -	START_CALL();
   1.317 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.318 -	*(bool *)(vptr + 4) = false;
   1.319 -	*(bool *)(vptr + 5) = false;
   1.320 -	FINISH_CALL_SIMPLE(NULL);
   1.321 -
   1.322 -	return 1;
   1.323 -}
   1.324 -#else
   1.325 -static cell_t ForcePlayerSuicide(IPluginContext *pContext, const cell_t *params)
   1.326 -{
   1.327 -	static ValveCall *pCall = NULL;
   1.328 -	if (!pCall)
   1.329 -	{
   1.330 -		if (!CreateBaseCall("CommitSuicide", ValveCall_Player, NULL, NULL, 0, &pCall))
   1.331 -		{
   1.332 -			return pContext->ThrowNativeError("\"CommitSuicide\" not supported by this mod");
   1.333 -		} else if (!pCall) {
   1.334 -			return pContext->ThrowNativeError("\"CommitSuicide\" wrapper failed to initialized");
   1.335 -		}
   1.336 -	}
   1.337 -
   1.338 -	START_CALL();
   1.339 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.340 -	FINISH_CALL_SIMPLE(NULL);
   1.341 -
   1.342 -	return 1;
   1.343 -}
   1.344 -#endif
   1.345 -
   1.346 -static cell_t SetClientViewEntity(IPluginContext *pContext, const cell_t *params)
   1.347 -{
   1.348 -	IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
   1.349 -	if (player == NULL)
   1.350 -	{
   1.351 -		return pContext->ThrowNativeError("Invalid client index %d", params[1]);
   1.352 -	}
   1.353 -	if (!player->IsInGame())
   1.354 -	{
   1.355 -		return pContext->ThrowNativeError("Client %d is not in game", params[1]);
   1.356 -	}
   1.357 -
   1.358 -	edict_t *pEdict = engine->PEntityOfEntIndex(params[2]);
   1.359 -	if (!pEdict || pEdict->IsFree())
   1.360 -	{
   1.361 -		return pContext->ThrowNativeError("Entity %d is not valid", params[2]);
   1.362 -	}
   1.363 -
   1.364 -	engine->SetView(player->GetEdict(), pEdict);
   1.365 -
   1.366 -	return 1;
   1.367 -}
   1.368 -
   1.369 -static SourceHook::String *g_lightstyle[MAX_LIGHTSTYLES] = {NULL};
   1.370 -static cell_t SetLightStyle(IPluginContext *pContext, const cell_t *params)
   1.371 -{
   1.372 -	int style = params[1];
   1.373 -	if (style >= MAX_LIGHTSTYLES)
   1.374 -	{
   1.375 -		return pContext->ThrowNativeError("Light style %d is invalid (range: 0-%d)", style, MAX_LIGHTSTYLES - 1);
   1.376 -	}
   1.377 -
   1.378 -	if (g_lightstyle[style] == NULL)
   1.379 -	{
   1.380 -		/* We allocate and never free this because the Engine wants to hold onto it :\
   1.381 -		 * in theory we could hook light style and know whether we're supposed to free 
   1.382 -		 * this or not on shutdown, but for ~4K of memory MAX, it doesn't seem worth it yet.
   1.383 -		 * So, it's a :TODO:!
   1.384 -		 */
   1.385 -		g_lightstyle[style] = new SourceHook::String();
   1.386 -	}
   1.387 -
   1.388 -	char *str;
   1.389 -	pContext->LocalToString(params[2], &str);
   1.390 -
   1.391 -	g_lightstyle[style]->assign(str);
   1.392 -
   1.393 -	engine->LightStyle(style, g_lightstyle[style]->c_str());
   1.394 -
   1.395 -	return 1;
   1.396 -}
   1.397 -
   1.398 -static cell_t SlapPlayer(IPluginContext *pContext, const cell_t *params)
   1.399 -{
   1.400 -	static bool s_slap_supported = false;
   1.401 -	static bool s_slap_setup = false;
   1.402 -	static ICallWrapper *s_teleport = NULL;
   1.403 -	static int s_health_offs = 0;
   1.404 -	static int s_sound_count = 0;
   1.405 -	static int s_frag_offs = 0;
   1.406 -
   1.407 -	if (!s_slap_setup)
   1.408 -	{
   1.409 -		int tries = 0;
   1.410 -
   1.411 -		s_slap_setup = true;
   1.412 -
   1.413 -		if (IsTeleportSupported())
   1.414 -		{
   1.415 -			tries++;
   1.416 -		}
   1.417 -		if (IsGetVelocitySupported())
   1.418 -		{
   1.419 -			tries++;
   1.420 -		}
   1.421 -
   1.422 -		/* Setup health */
   1.423 -		if (g_pGameConf->GetOffset("m_iHealth", &s_health_offs) && s_health_offs)
   1.424 -		{
   1.425 -			tries++;
   1.426 -		}
   1.427 -
   1.428 -		if (tries == 3)
   1.429 -		{
   1.430 -			s_slap_supported = true;
   1.431 -
   1.432 -			const char *key;
   1.433 -			if ((key = g_pGameConf->GetKeyValue("SlapSoundCount")) != NULL)
   1.434 -			{
   1.435 -				s_sound_count = atoi(key);
   1.436 -			}
   1.437 -		}
   1.438 -	}
   1.439 -
   1.440 -	if (!s_slap_supported)
   1.441 -	{
   1.442 -		return pContext->ThrowNativeError("This function is not supported on this mod");
   1.443 -	}
   1.444 -
   1.445 -	/* First check if the client is valid */
   1.446 -	int client = params[1];
   1.447 -	IGamePlayer *player = playerhelpers->GetGamePlayer(client);
   1.448 -	if (!player)
   1.449 -	{
   1.450 -		return pContext->ThrowNativeError("Client %d is not valid", client);
   1.451 -	} else if (!player->IsInGame()) {
   1.452 -		return pContext->ThrowNativeError("Client %d is not in game", client);
   1.453 -	}
   1.454 -
   1.455 -	edict_t *pEdict = player->GetEdict();
   1.456 -	CBaseEntity *pEntity = pEdict->GetUnknown()->GetBaseEntity();
   1.457 -
   1.458 -	/* See if we should be taking away health */
   1.459 -	bool should_slay = false;
   1.460 -	if (params[2])
   1.461 -	{
   1.462 -		int *health = (int *)((char *)pEntity + s_health_offs);
   1.463 -		if (*health - params[2] <= 0)
   1.464 -		{
   1.465 -			*health = 1;
   1.466 -			should_slay = true;
   1.467 -		} else {
   1.468 -			*health -= params[2];
   1.469 -		}
   1.470 -	}
   1.471 -
   1.472 -	/* Teleport in a random direction - thank you, Mani!*/
   1.473 -	Vector velocity;
   1.474 -	GetVelocity(pEntity, &velocity, NULL);
   1.475 -	velocity.x += ((rand() % 180) + 50) * (((rand() % 2) == 1) ?  -1 : 1);
   1.476 -	velocity.y += ((rand() % 180) + 50) * (((rand() % 2) == 1) ?  -1 : 1);
   1.477 -	velocity.z += rand() % 200 + 100;
   1.478 -	Teleport(pEntity, NULL, NULL, &velocity);
   1.479 -
   1.480 -	/* Play a random sound */
   1.481 -	if (params[3] && s_sound_count > 0)
   1.482 -	{
   1.483 -		char name[48];
   1.484 -		const char *sound_name;
   1.485 -		cell_t player_list[256], total_players = 0;
   1.486 -		int maxClients = playerhelpers->GetMaxClients();
   1.487 -
   1.488 -		int r = (rand() % s_sound_count) + 1;
   1.489 -		snprintf(name, sizeof(name), "SlapSound%d", r);
   1.490 -
   1.491 -		if ((sound_name = g_pGameConf->GetKeyValue(name)) != NULL)
   1.492 -		{
   1.493 -			IGamePlayer *other;
   1.494 -			for (int i=1; i<=maxClients; i++)
   1.495 -			{
   1.496 -				other = playerhelpers->GetGamePlayer(i);
   1.497 -				if (other->IsInGame())
   1.498 -				{
   1.499 -					player_list[total_players++] = i;
   1.500 -				}
   1.501 -			}
   1.502 -
   1.503 -			const Vector & pos = pEdict->GetCollideable()->GetCollisionOrigin();
   1.504 -			CellRecipientFilter rf;
   1.505 -			rf.SetToReliable(true);
   1.506 -			rf.Initialize(player_list, total_players);
   1.507 -			engsound->EmitSound(rf, client, CHAN_AUTO, sound_name, VOL_NORM, ATTN_NORM, 0, PITCH_NORM, &pos);
   1.508 -		}
   1.509 -	}
   1.510 -
   1.511 -	if (!s_frag_offs)
   1.512 -	{
   1.513 -		const char *frag_prop = g_pGameConf->GetKeyValue("m_iFrags");
   1.514 -		if (frag_prop)
   1.515 -		{
   1.516 -			datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
   1.517 -			typedescription_t *pType = gamehelpers->FindInDataMap(pMap, frag_prop);
   1.518 -			if (pType != NULL)
   1.519 -			{
   1.520 -				s_frag_offs = pType->fieldOffset[TD_OFFSET_NORMAL];
   1.521 -			}
   1.522 -		}
   1.523 -		if (!s_frag_offs)
   1.524 -		{
   1.525 -			s_frag_offs = -1;
   1.526 -		}
   1.527 -	}
   1.528 -
   1.529 -	int old_frags = 0;
   1.530 -	if (s_frag_offs > 0)
   1.531 -	{
   1.532 -		old_frags = *(int *)((char *)pEntity + s_frag_offs);
   1.533 -	}
   1.534 -	
   1.535 -	/* Force suicide */
   1.536 -	if (should_slay)
   1.537 -	{
   1.538 -		pluginhelpers->ClientCommand(pEdict, "kill\n");
   1.539 -	}
   1.540 -
   1.541 -	if (s_frag_offs > 0)
   1.542 -	{
   1.543 -		*(int *)((char *)pEntity + s_frag_offs) = old_frags;
   1.544 -	}
   1.545 -
   1.546 -	return 1;
   1.547 -}
   1.548 -
   1.549 -static cell_t GetClientEyePosition(IPluginContext *pContext, const cell_t *params)
   1.550 -{
   1.551 -	IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
   1.552 -	if (player == NULL)
   1.553 -	{
   1.554 -		return pContext->ThrowNativeError("Invalid client index %d", params[1]);
   1.555 -	}
   1.556 -	if (!player->IsInGame())
   1.557 -	{
   1.558 -		return pContext->ThrowNativeError("Client %d is not in game", params[1]);
   1.559 -	}
   1.560 -
   1.561 -	Vector pos;
   1.562 -	serverClients->ClientEarPosition(player->GetEdict(), &pos);
   1.563 -
   1.564 -	cell_t *addr;
   1.565 -	pContext->LocalToPhysAddr(params[2], &addr);
   1.566 -	addr[0] = sp_ftoc(pos.x);
   1.567 -	addr[1] = sp_ftoc(pos.y);
   1.568 -	addr[2] = sp_ftoc(pos.z);
   1.569 -
   1.570 -	return 1;
   1.571 -}
   1.572 -
   1.573 -static cell_t GetClientEyeAngles(IPluginContext *pContext, const cell_t *params)
   1.574 -{
   1.575 -	int client = params[1];
   1.576 -	IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
   1.577 -
   1.578 -	if (!pPlayer)
   1.579 -	{
   1.580 -		return pContext->ThrowNativeError("Invalid client index %d", client);
   1.581 -	}
   1.582 -	else if (!pPlayer->IsInGame())
   1.583 -	{
   1.584 -		return pContext->ThrowNativeError("Client %d is not in game", client);
   1.585 -	}
   1.586 -
   1.587 -	edict_t *pEdict = pPlayer->GetEdict();
   1.588 -	CBaseEntity *pEntity = pEdict->GetUnknown() ? pEdict->GetUnknown()->GetBaseEntity() : NULL;
   1.589 -
   1.590 -	/* We always set the angles for backwards compatibility -- 
   1.591 -	 * The original function had no return value.
   1.592 -	 */
   1.593 -	QAngle angles;
   1.594 -	bool got_angles = false;
   1.595 -
   1.596 -	if (pEntity != NULL)
   1.597 -	{
   1.598 -		got_angles = GetEyeAngles(pEntity, &angles);
   1.599 -	}
   1.600 -	
   1.601 -	cell_t *addr;
   1.602 -	pContext->LocalToPhysAddr(params[2], &addr);
   1.603 -	addr[0] = sp_ftoc(angles.x);
   1.604 -	addr[1] = sp_ftoc(angles.y);
   1.605 -	addr[2] = sp_ftoc(angles.z);
   1.606 -
   1.607 -	return got_angles ? 1 : 0;
   1.608 -}
   1.609 -
   1.610 -static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *params)
   1.611 -{
   1.612 -	static ValveCall *pCall = NULL;
   1.613 -	if (!pCall)
   1.614 -	{
   1.615 -		ValvePassInfo pass[3];
   1.616 -		InitPass(pass[0], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL, VDECODE_FLAG_ALLOWNULL|VDECODE_FLAG_ALLOWWORLD);
   1.617 -		InitPass(pass[1], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.618 -		InitPass(pass[2], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
   1.619 -		if (!CreateBaseCall("FindEntityByClassname", ValveCall_EntityList, &pass[2], pass, 2, &pCall))
   1.620 -		{
   1.621 -			return pContext->ThrowNativeError("\"FindEntityByClassname\" not supported by this mod");
   1.622 -		} else if (!pCall) {
   1.623 -			return pContext->ThrowNativeError("\"FindEntityByClassname\" wrapper failed to initialized");
   1.624 -		}
   1.625 -	}
   1.626 -
   1.627 -	CBaseEntity *pEntity;
   1.628 -	START_CALL();
   1.629 -	*(void **)vptr = g_EntList; 
   1.630 -	DECODE_VALVE_PARAM(1, vparams, 0);
   1.631 -	DECODE_VALVE_PARAM(2, vparams, 1);
   1.632 -	FINISH_CALL_SIMPLE(&pEntity);
   1.633 -
   1.634 -	if (pEntity == NULL)
   1.635 -	{
   1.636 -		return -1;
   1.637 -	}
   1.638 -
   1.639 -	edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
   1.640 -	if (!pEdict)
   1.641 -	{
   1.642 -		return -1;
   1.643 -	}
   1.644 -
   1.645 -	return engine->IndexOfEdict(pEdict);
   1.646 -}
   1.647 -
   1.648 -static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params)
   1.649 -{
   1.650 -	static ValveCall *pCall = NULL;
   1.651 -	if (!pCall)
   1.652 -	{
   1.653 -		ValvePassInfo pass[3];
   1.654 -		InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.655 -		InitPass(pass[1], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
   1.656 -		InitPass(pass[2], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
   1.657 -		if (!CreateBaseCall("CreateEntityByName", ValveCall_Static, &pass[2], pass, 2, &pCall))
   1.658 -		{
   1.659 -			return pContext->ThrowNativeError("\"CreateEntityByName\" not supported by this mod");
   1.660 -		} else if (!pCall) {
   1.661 -			return pContext->ThrowNativeError("\"CreateEntityByName\" wrapper failed to initialized");
   1.662 -		}
   1.663 -	}
   1.664 -
   1.665 -	CBaseEntity *pEntity = NULL;
   1.666 -	START_CALL();
   1.667 -	DECODE_VALVE_PARAM(1, vparams, 0);
   1.668 -	DECODE_VALVE_PARAM(2, vparams, 1);
   1.669 -	FINISH_CALL_SIMPLE(&pEntity);
   1.670 -
   1.671 -	if (pEntity == NULL)
   1.672 -	{
   1.673 -		return -1;
   1.674 -	}
   1.675 -
   1.676 -	edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
   1.677 -	if (!pEdict)
   1.678 -	{
   1.679 -		return -1;
   1.680 -	}
   1.681 -
   1.682 -	return engine->IndexOfEdict(pEdict);
   1.683 -}
   1.684 -
   1.685 -static cell_t DispatchSpawn(IPluginContext *pContext, const cell_t *params)
   1.686 -{
   1.687 -	static ValveCall *pCall = NULL;
   1.688 -	if (!pCall)
   1.689 -	{
   1.690 -		ValvePassInfo pass[2];
   1.691 -		InitPass(pass[0], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
   1.692 -		InitPass(pass[1], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
   1.693 -		if (!CreateBaseCall("DispatchSpawn", ValveCall_Static, &pass[1], pass, 1, &pCall))
   1.694 -		{
   1.695 -			return pContext->ThrowNativeError("\"DispatchSpawn\" not supported by this mod");
   1.696 -		} else if (!pCall) {
   1.697 -			return pContext->ThrowNativeError("\"DispatchSpawn\" wrapper failed to initialized");
   1.698 -		}
   1.699 -	}
   1.700 -
   1.701 -	int ret;
   1.702 -	START_CALL();
   1.703 -	DECODE_VALVE_PARAM(1, vparams, 0);
   1.704 -	FINISH_CALL_SIMPLE(&ret);
   1.705 -
   1.706 -	return (ret == -1) ? 0 : 1;
   1.707 -}
   1.708 -
   1.709 -static cell_t DispatchKeyValue(IPluginContext *pContext, const cell_t *params)
   1.710 -{
   1.711 -	static ValveCall *pCall = NULL;
   1.712 -	if (!pCall)
   1.713 -	{
   1.714 -		ValvePassInfo pass[3];
   1.715 -		InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.716 -		InitPass(pass[1], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.717 -		InitPass(pass[2], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
   1.718 -		if (!CreateBaseCall("DispatchKeyValue", ValveCall_Entity, &pass[2], pass, 2, &pCall))
   1.719 -		{
   1.720 -			return pContext->ThrowNativeError("\"DispatchKeyValue\" not supported by this mod");
   1.721 -		} else if (!pCall) {
   1.722 -			return pContext->ThrowNativeError("\"DispatchKeyValue\" wrapper failed to initialized");
   1.723 -		}
   1.724 -	}
   1.725 -
   1.726 -	bool ret;
   1.727 -	START_CALL();
   1.728 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.729 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.730 -	DECODE_VALVE_PARAM(3, vparams, 1);
   1.731 -	FINISH_CALL_SIMPLE(&ret);
   1.732 -
   1.733 -	return (ret) ? 1 : 0;
   1.734 -}
   1.735 -
   1.736 -static cell_t DispatchKeyValueFloat(IPluginContext *pContext, const cell_t *params)
   1.737 -{
   1.738 -	static ValveCall *pCall = NULL;
   1.739 -	if (!pCall)
   1.740 -	{
   1.741 -		ValvePassInfo pass[3];
   1.742 -		InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.743 -		InitPass(pass[1], Valve_Float, PassType_Float, PASSFLAG_BYVAL);
   1.744 -		InitPass(pass[2], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
   1.745 -		if (!CreateBaseCall("DispatchKeyValueFloat", ValveCall_Entity, &pass[2], pass, 2, &pCall))
   1.746 -		{
   1.747 -			return pContext->ThrowNativeError("\"DispatchKeyValueFloat\" not supported by this mod");
   1.748 -		} else if (!pCall) {
   1.749 -			return pContext->ThrowNativeError("\"DispatchKeyValueFloat\" wrapper failed to initialized");
   1.750 -		}
   1.751 -	}
   1.752 -
   1.753 -	bool ret;
   1.754 -	START_CALL();
   1.755 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.756 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.757 -	DECODE_VALVE_PARAM(3, vparams, 1);
   1.758 -	FINISH_CALL_SIMPLE(&ret);
   1.759 -
   1.760 -	return (ret) ? 1 : 0;
   1.761 -}
   1.762 -
   1.763 -static cell_t DispatchKeyValueVector(IPluginContext *pContext, const cell_t *params)
   1.764 -{
   1.765 -	static ValveCall *pCall = NULL;
   1.766 -	if (!pCall)
   1.767 -	{
   1.768 -		ValvePassInfo pass[3];
   1.769 -		InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.770 -#if defined ORANGEBOX_BUILD
   1.771 -		InitPass(pass[1], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL);
   1.772 -#else
   1.773 -		InitPass(pass[1], Valve_Vector, PassType_Object, PASSFLAG_BYVAL|PASSFLAG_OCTOR|PASSFLAG_OASSIGNOP);
   1.774 -#endif
   1.775 -		InitPass(pass[2], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
   1.776 -		if (!CreateBaseCall("DispatchKeyValueVector", ValveCall_Entity, &pass[2], pass, 2, &pCall))
   1.777 -		{
   1.778 -			return pContext->ThrowNativeError("\"DispatchKeyValueVector\" not supported by this mod");
   1.779 -		} else if (!pCall) {
   1.780 -			return pContext->ThrowNativeError("\"DispatchKeyValueVector\" wrapper failed to initialized");
   1.781 -		}
   1.782 -	}
   1.783 -
   1.784 -	bool ret;
   1.785 -	START_CALL();
   1.786 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.787 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.788 -	DECODE_VALVE_PARAM(3, vparams, 1);
   1.789 -	FINISH_CALL_SIMPLE(&ret);
   1.790 -
   1.791 -	return (ret) ? 1 : 0;
   1.792 -}
   1.793 -
   1.794 -static cell_t sm_GetClientAimTarget(IPluginContext *pContext, const cell_t *params)
   1.795 -{
   1.796 -	int client = params[1];
   1.797 -	IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client);
   1.798 -
   1.799 -	if (!pPlayer)
   1.800 -	{
   1.801 -		return pContext->ThrowNativeError("Invalid client index %d", client);
   1.802 -	}
   1.803 -	else if (!pPlayer->IsInGame())
   1.804 -	{
   1.805 -		return pContext->ThrowNativeError("Client %d is not in game", client);
   1.806 -	}
   1.807 -
   1.808 -	return GetClientAimTarget(pPlayer->GetEdict(), params[2] ? true : false);
   1.809 -}
   1.810 -
   1.811 -static cell_t sm_SetEntityModel(IPluginContext *pContext, const cell_t *params)
   1.812 -{
   1.813 -	static ValveCall *pCall = NULL;
   1.814 -	if (!pCall)
   1.815 -	{
   1.816 -		ValvePassInfo pass[1];
   1.817 -		InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.818 -		if (!CreateBaseCall("SetEntityModel", ValveCall_Entity, NULL, pass, 1, &pCall))
   1.819 -		{
   1.820 -			return pContext->ThrowNativeError("\"SetEntityModel\" not supported by this mod");
   1.821 -		} else if (!pCall) {
   1.822 -			return pContext->ThrowNativeError("\"SetEntityModel\" wrapper failed to initialized");
   1.823 -		}
   1.824 -	}
   1.825 -
   1.826 -	START_CALL();
   1.827 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.828 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.829 -	FINISH_CALL_SIMPLE(NULL);
   1.830 -
   1.831 -	return 1;
   1.832 -}
   1.833 -
   1.834 -static cell_t GetPlayerDecalFile(IPluginContext *pContext, const cell_t *params)
   1.835 -{
   1.836 -	IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
   1.837 -	if (player == NULL)
   1.838 -	{
   1.839 -		return pContext->ThrowNativeError("Invalid client index %d", params[1]);
   1.840 -	}
   1.841 -	if (!player->IsInGame())
   1.842 -	{
   1.843 -		return pContext->ThrowNativeError("Client %d is not in game", params[1]);
   1.844 -	}
   1.845 -
   1.846 -	player_info_t info;
   1.847 -	char *buffer;
   1.848 -
   1.849 -	if (!GetPlayerInfo(params[1], &info) || !info.customFiles[0])
   1.850 -	{
   1.851 -		return 0;
   1.852 -	}
   1.853 -
   1.854 -	pContext->LocalToString(params[2], &buffer);
   1.855 -	Q_binarytohex((byte *)&info.customFiles[0], sizeof(info.customFiles[0]), buffer, params[3]);
   1.856 -
   1.857 -	return 1;
   1.858 -}
   1.859 -
   1.860 -static cell_t GetServerNetStats(IPluginContext *pContext, const cell_t *params)
   1.861 -{
   1.862 -	if (iserver == NULL)
   1.863 -	{
   1.864 -		return pContext->ThrowNativeError("IServer interface not supported, file a bug report.");
   1.865 -	}
   1.866 -
   1.867 -	float in, out;
   1.868 -	cell_t *pIn, *pOut;
   1.869 -
   1.870 -	pContext->LocalToPhysAddr(params[1], &pIn);
   1.871 -	pContext->LocalToPhysAddr(params[2], &pOut);
   1.872 -	iserver->GetNetStats(in, out);
   1.873 -
   1.874 -	*pIn = sp_ftoc(in);
   1.875 -	*pOut = sp_ftoc(out);
   1.876 -
   1.877 -	return 1;
   1.878 -}
   1.879 -
   1.880 -static cell_t WeaponEquip(IPluginContext *pContext, const cell_t *params)
   1.881 -{
   1.882 -	static ValveCall *pCall = NULL;
   1.883 -	if (!pCall)
   1.884 -	{
   1.885 -		ValvePassInfo pass[1];
   1.886 -		InitPass(pass[0], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
   1.887 -		if (!CreateBaseCall("WeaponEquip", ValveCall_Player, NULL, pass, 1, &pCall))
   1.888 -		{
   1.889 -			return pContext->ThrowNativeError("\"WeaponEquip\" not supported by this mod");
   1.890 -		} else if (!pCall) {
   1.891 -			return pContext->ThrowNativeError("\"WeaponEquip\" wrapper failed to initialized");
   1.892 -		}
   1.893 -	}
   1.894 -
   1.895 -	START_CALL();
   1.896 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.897 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.898 -	FINISH_CALL_SIMPLE(NULL);
   1.899 -
   1.900 -	return 1;
   1.901 -}
   1.902 -
   1.903 -static cell_t ActivateEntity(IPluginContext *pContext, const cell_t *params)
   1.904 -{
   1.905 -	static ValveCall *pCall = NULL;
   1.906 -	if (!pCall)
   1.907 -	{
   1.908 -		if (!CreateBaseCall("Activate", ValveCall_Entity, NULL, NULL, 0, &pCall))
   1.909 -		{
   1.910 -			return pContext->ThrowNativeError("\"Activate\" not supported by this mod");
   1.911 -		}
   1.912 -		else if (!pCall)
   1.913 -		{
   1.914 -			return pContext->ThrowNativeError("\"Activate\" wrapper failed to initialized");
   1.915 -		}
   1.916 -	}
   1.917 -
   1.918 -	START_CALL();
   1.919 -	DECODE_VALVE_PARAM(1, thisinfo, 0);
   1.920 -	FINISH_CALL_SIMPLE(NULL);
   1.921 -
   1.922 -	return 1;
   1.923 -}
   1.924 -
   1.925 -static cell_t SetClientInfo(IPluginContext *pContext, const cell_t *params)
   1.926 -{
   1.927 -	IGamePlayer *player = playerhelpers->GetGamePlayer(params[1]);
   1.928 -	IClient *pClient = iserver->GetClient(params[1]-1);
   1.929 -	if (player == NULL || pClient == NULL)
   1.930 -	{
   1.931 -		return pContext->ThrowNativeError("Invalid client index %d", params[1]);
   1.932 -	}
   1.933 -	if (!player->IsConnected())
   1.934 -	{
   1.935 -		return pContext->ThrowNativeError("Client %d is not connected", params[1]);
   1.936 -	}
   1.937 -
   1.938 -	static ValveCall *pCall = NULL;
   1.939 -	if (!pCall)
   1.940 -	{
   1.941 -		ValvePassInfo params[2];
   1.942 -		InitPass(params[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.943 -		InitPass(params[1], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
   1.944 -
   1.945 -		if (!CreateBaseCall("SetUserCvar", ValveCall_Entity, NULL, params, 2, &pCall))
   1.946 -		{
   1.947 -			return pContext->ThrowNativeError("\"SetUserCvar\" not supported by this mod");
   1.948 -		}
   1.949 -		else if (!pCall)
   1.950 -		{
   1.951 -			return pContext->ThrowNativeError("\"SetUserCvar\" wrapper failed to initialized");
   1.952 -		}
   1.953 -	}
   1.954 -
   1.955 -	static int changedOffset = -1;
   1.956 -
   1.957 -	if (changedOffset == -1)
   1.958 -	{	
   1.959 -		if (!g_pGameConf->GetOffset("InfoChanged", &changedOffset))
   1.960 -		{
   1.961 -			return pContext->ThrowNativeError("\"SetUserCvar\" not supported by this mod");
   1.962 -		}
   1.963 -	}
   1.964 -
   1.965 -	unsigned char *CGameClient = (unsigned char *)pClient - 4;
   1.966 -
   1.967 -	START_CALL();
   1.968 -	/* Not really a CBaseEntity* but this works */
   1.969 -	CBaseEntity **ebuf = (CBaseEntity **)vptr;
   1.970 -	*ebuf = (CBaseEntity *)CGameClient;
   1.971 -	DECODE_VALVE_PARAM(2, vparams, 0);
   1.972 -	DECODE_VALVE_PARAM(3, vparams, 1);
   1.973 -	FINISH_CALL_SIMPLE(NULL);
   1.974 -
   1.975 -	uint8_t* changed = (uint8_t *)(CGameClient + changedOffset);
   1.976 -	*changed = 1;
   1.977 -
   1.978 -	return 1;
   1.979 -}
   1.980 -
   1.981 -sp_nativeinfo_t g_Natives[] = 
   1.982 -{
   1.983 -	{"ExtinguishEntity",		ExtinguishEntity},
   1.984 -	{"ForcePlayerSuicide",		ForcePlayerSuicide},
   1.985 -	{"GivePlayerItem",			GiveNamedItem},
   1.986 -	{"GetPlayerWeaponSlot",		GetPlayerWeaponSlot},
   1.987 -	{"IgniteEntity",			IgniteEntity},
   1.988 -	{"RemovePlayerItem",		RemovePlayerItem},
   1.989 -	{"TeleportEntity",			TeleportEntity},
   1.990 -	{"SetClientViewEntity",		SetClientViewEntity},
   1.991 -	{"SetLightStyle",			SetLightStyle},
   1.992 -	{"SlapPlayer",				SlapPlayer},
   1.993 -	{"GetClientEyePosition",	GetClientEyePosition},
   1.994 -	{"GetClientEyeAngles",		GetClientEyeAngles},
   1.995 -	{"FindEntityByClassname",	FindEntityByClassname},
   1.996 -	{"CreateEntityByName",		CreateEntityByName},
   1.997 -	{"DispatchSpawn",			DispatchSpawn},
   1.998 -	{"DispatchKeyValue",		DispatchKeyValue},
   1.999 -	{"DispatchKeyValueFloat",	DispatchKeyValueFloat},
  1.1000 -	{"DispatchKeyValueVector",	DispatchKeyValueVector},
  1.1001 -	{"GetClientAimTarget",		sm_GetClientAimTarget},
  1.1002 -	{"SetEntityModel",			sm_SetEntityModel},
  1.1003 -	{"GetPlayerDecalFile",		GetPlayerDecalFile},
  1.1004 -	{"GetServerNetStats",		GetServerNetStats},
  1.1005 -	{"EquipPlayerWeapon",		WeaponEquip},
  1.1006 -	{"ActivateEntity",			ActivateEntity},
  1.1007 -	{"SetClientInfo",			SetClientInfo},
  1.1008 -	{NULL,						NULL},
  1.1009 -};