plugins/include/tf2_stocks.inc
author Peace-Maker <januk@freenet.de>
Fri May 09 12:32:49 2014 -0700 (2014-05-09)
changeset 4351 5ccbfd632820
parent 4215 088526cf7494
permissions -rw-r--r--
Add DisplayTopMenuCategory native (bug 6033, r=dvander).
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     5  * =============================================================================
     6  *
     7  * This file is part of the SourceMod/SourcePawn SDK.
     8  *
     9  * This program is free software; you can redistribute it and/or modify it under
    10  * the terms of the GNU General Public License, version 3.0, as published by the
    11  * Free Software Foundation.
    12  * 
    13  * This program is distributed in the hope that it will be useful, but WITHOUT
    14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    15  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    16  * details.
    17  *
    18  * You should have received a copy of the GNU General Public License along with
    19  * this program.  If not, see <http://www.gnu.org/licenses/>.
    20  *
    21  * As a special exception, AlliedModders LLC gives you permission to link the
    22  * code of this program (as well as its derivative works) to "Half-Life 2," the
    23  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    24  * by the Valve Corporation.  You must obey the GNU General Public License in
    25  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    26  * this exception to all derivative works.  AlliedModders LLC defines further
    27  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    28  * or <http://www.sourcemod.net/license.php>.
    29  *
    30  * Version: $Id$
    31  */
    32 
    33 #if defined _tf2_stocks_included
    34  #endinput
    35 #endif
    36 #define _tf2_stocks_included
    37 
    38 #include <tf2>
    39 #include <sdktools>
    40 
    41 #define TF_CONDFLAG_NONE            0
    42 #define TF_CONDFLAG_SLOWED          (1 << 0)
    43 #define TF_CONDFLAG_ZOOMED          (1 << 1)
    44 #define TF_CONDFLAG_DISGUISING      (1 << 2)
    45 #define TF_CONDFLAG_DISGUISED       (1 << 3)
    46 #define TF_CONDFLAG_CLOAKED         (1 << 4)
    47 #define TF_CONDFLAG_UBERCHARGED     (1 << 5)
    48 #define TF_CONDFLAG_TELEPORTGLOW    (1 << 6)
    49 #define TF_CONDFLAG_TAUNTING        (1 << 7)
    50 #define TF_CONDFLAG_UBERCHARGEFADE  (1 << 8)
    51 #define TF_CONDFLAG_CLOAKFLICKER    (1 << 9)
    52 #define TF_CONDFLAG_TELEPORTING     (1 << 10)
    53 #define TF_CONDFLAG_KRITZKRIEGED    (1 << 11)
    54 #define TF_CONDFLAG_DEADRINGERED    (1 << 13)
    55 #define TF_CONDFLAG_BONKED          (1 << 14)
    56 #define TF_CONDFLAG_DAZED           (1 << 15)
    57 #define TF_CONDFLAG_BUFFED          (1 << 16)
    58 #define TF_CONDFLAG_CHARGING        (1 << 17)
    59 #define TF_CONDFLAG_DEMOBUFF        (1 << 18)
    60 #define TF_CONDFLAG_CRITCOLA        (1 << 19)
    61 #define TF_CONDFLAG_INHEALRADIUS    (1 << 20)
    62 #define TF_CONDFLAG_HEALING         (1 << 21)
    63 #define TF_CONDFLAG_ONFIRE          (1 << 22)
    64 #define TF_CONDFLAG_OVERHEALED      (1 << 23)
    65 #define TF_CONDFLAG_JARATED         (1 << 24)
    66 #define TF_CONDFLAG_BLEEDING        (1 << 25)
    67 #define TF_CONDFLAG_DEFENSEBUFFED   (1 << 26)
    68 #define TF_CONDFLAG_MILKED          (1 << 27)
    69 #define TF_CONDFLAG_MEGAHEAL        (1 << 28)
    70 #define TF_CONDFLAG_REGENBUFFED     (1 << 29)
    71 #define TF_CONDFLAG_MARKEDFORDEATH  (1 << 30)
    72 
    73 #define TF_DEATHFLAG_KILLERDOMINATION   (1 << 0)
    74 #define TF_DEATHFLAG_ASSISTERDOMINATION (1 << 1)
    75 #define TF_DEATHFLAG_KILLERREVENGE      (1 << 2)
    76 #define TF_DEATHFLAG_ASSISTERREVENGE    (1 << 3)
    77 #define TF_DEATHFLAG_FIRSTBLOOD         (1 << 4)
    78 #define TF_DEATHFLAG_DEADRINGER         (1 << 5)
    79 #define TF_DEATHFLAG_INTERRUPTED        (1 << 6)
    80 #define TF_DEATHFLAG_GIBBED             (1 << 7)
    81 #define TF_DEATHFLAG_PURGATORY          (1 << 8)
    82 
    83 // Custom kill identifiers for the customkill property on the player_death event
    84 enum {
    85 	TF_CUSTOM_HEADSHOT = 1,
    86 	TF_CUSTOM_BACKSTAB,
    87 	TF_CUSTOM_BURNING,
    88 	TF_CUSTOM_WRENCH_FIX,
    89 	TF_CUSTOM_MINIGUN,
    90 	TF_CUSTOM_SUICIDE,
    91 	TF_CUSTOM_TAUNT_HADOUKEN,
    92 	TF_CUSTOM_BURNING_FLARE,
    93 	TF_CUSTOM_TAUNT_HIGH_NOON,
    94 	TF_CUSTOM_TAUNT_GRAND_SLAM,
    95 	TF_CUSTOM_PENETRATE_MY_TEAM,
    96 	TF_CUSTOM_PENETRATE_ALL_PLAYERS,
    97 	TF_CUSTOM_TAUNT_FENCING,
    98 	TF_CUSTOM_PENETRATE_HEADSHOT,
    99 	TF_CUSTOM_TAUNT_ARROW_STAB,
   100 	TF_CUSTOM_TELEFRAG,
   101 	TF_CUSTOM_BURNING_ARROW,
   102 	TF_CUSTOM_FLYINGBURN,
   103 	TF_CUSTOM_PUMPKIN_BOMB,
   104 	TF_CUSTOM_DECAPITATION,
   105 	TF_CUSTOM_TAUNT_GRENADE,
   106 	TF_CUSTOM_BASEBALL,
   107 	TF_CUSTOM_CHARGE_IMPACT,
   108 	TF_CUSTOM_TAUNT_BARBARIAN_SWING,
   109 	TF_CUSTOM_AIR_STICKY_BURST,
   110 	TF_CUSTOM_DEFENSIVE_STICKY,
   111 	TF_CUSTOM_PICKAXE,
   112 	TF_CUSTOM_ROCKET_DIRECTHIT,
   113 	TF_CUSTOM_TAUNT_UBERSLICE,
   114 	TF_CUSTOM_PLAYER_SENTRY,
   115 	TF_CUSTOM_STANDARD_STICKY,
   116 	TF_CUSTOM_SHOTGUN_REVENGE_CRIT,
   117 	TF_CUSTOM_TAUNT_ENGINEER_SMASH,
   118 	TF_CUSTOM_BLEEDING,
   119 	TF_CUSTOM_GOLD_WRENCH,
   120 	TF_CUSTOM_CARRIED_BUILDING,
   121 	TF_CUSTOM_COMBO_PUNCH,
   122 	TF_CUSTOM_TAUNT_ENGINEER_ARM,
   123 	TF_CUSTOM_FISH_KILL,
   124 	TF_CUSTOM_TRIGGER_HURT,
   125 	TF_CUSTOM_DECAPITATION_BOSS,
   126 	TF_CUSTOM_STICKBOMB_EXPLOSION,
   127 	TF_CUSTOM_AEGIS_ROUND,
   128 	TF_CUSTOM_FLARE_EXPLOSION,
   129 	TF_CUSTOM_BOOTS_STOMP,
   130 	TF_CUSTOM_PLASMA,
   131 	TF_CUSTOM_PLASMA_CHARGED,
   132 	TF_CUSTOM_PLASMA_GIB,
   133 	TF_CUSTOM_PRACTICE_STICKY,
   134 	TF_CUSTOM_EYEBALL_ROCKET,
   135 	TF_CUSTOM_HEADSHOT_DECAPITATION,
   136 	TF_CUSTOM_TAUNT_ARMAGEDDON,
   137 	TF_CUSTOM_FLARE_PELLET,
   138 	TF_CUSTOM_CLEAVER,
   139 	TF_CUSTOM_CLEAVER_CRIT,
   140 	TF_CUSTOM_SAPPER_RECORDER_DEATH,
   141 	TF_CUSTOM_MERASMUS_PLAYER_BOMB,
   142 	TF_CUSTOM_MERASMUS_GRENADE,
   143 	TF_CUSTOM_MERASMUS_ZAP,
   144 	TF_CUSTOM_MERASMUS_DECAPITATION,
   145 	TF_CUSTOM_CANNONBALL_PUSH,
   146 	TF_CUSTOM_TAUNT_ALLCLASS_GUITAR_RIFF,
   147 };
   148 
   149 // Weapon codes as used in some events, such as player_death
   150 // (not to be confused with Item Definition Indexes)
   151 enum {
   152 	TF_WEAPON_NONE = 0,
   153 	TF_WEAPON_BAT,
   154 	TF_WEAPON_BAT_WOOD,
   155 	TF_WEAPON_BOTTLE,
   156 	TF_WEAPON_FIREAXE,
   157 	TF_WEAPON_CLUB,
   158 	TF_WEAPON_CROWBAR,
   159 	TF_WEAPON_KNIFE,
   160 	TF_WEAPON_FISTS,
   161 	TF_WEAPON_SHOVEL,
   162 	TF_WEAPON_WRENCH,
   163 	TF_WEAPON_BONESAW,
   164 	TF_WEAPON_SHOTGUN_PRIMARY,
   165 	TF_WEAPON_SHOTGUN_SOLDIER,
   166 	TF_WEAPON_SHOTGUN_HWG,
   167 	TF_WEAPON_SHOTGUN_PYRO,
   168 	TF_WEAPON_SCATTERGUN,
   169 	TF_WEAPON_SNIPERRIFLE,
   170 	TF_WEAPON_MINIGUN,
   171 	TF_WEAPON_SMG,
   172 	TF_WEAPON_SYRINGEGUN_MEDIC,
   173 	TF_WEAPON_TRANQ,
   174 	TF_WEAPON_ROCKETLAUNCHER,
   175 	TF_WEAPON_GRENADELAUNCHER,
   176 	TF_WEAPON_PIPEBOMBLAUNCHER,
   177 	TF_WEAPON_FLAMETHROWER,
   178 	TF_WEAPON_GRENADE_NORMAL,
   179 	TF_WEAPON_GRENADE_CONCUSSION,
   180 	TF_WEAPON_GRENADE_NAIL,
   181 	TF_WEAPON_GRENADE_MIRV,
   182 	TF_WEAPON_GRENADE_MIRV_DEMOMAN,
   183 	TF_WEAPON_GRENADE_NAPALM,
   184 	TF_WEAPON_GRENADE_GAS,
   185 	TF_WEAPON_GRENADE_EMP,
   186 	TF_WEAPON_GRENADE_CALTROP,
   187 	TF_WEAPON_GRENADE_PIPEBOMB,
   188 	TF_WEAPON_GRENADE_SMOKE_BOMB,
   189 	TF_WEAPON_GRENADE_HEAL,
   190 	TF_WEAPON_GRENADE_STUNBALL,
   191 	TF_WEAPON_GRENADE_JAR,
   192 	TF_WEAPON_GRENADE_JAR_MILK,
   193 	TF_WEAPON_PISTOL,
   194 	TF_WEAPON_PISTOL_SCOUT,
   195 	TF_WEAPON_REVOLVER,
   196 	TF_WEAPON_NAILGUN,
   197 	TF_WEAPON_PDA,
   198 	TF_WEAPON_PDA_ENGINEER_BUILD,
   199 	TF_WEAPON_PDA_ENGINEER_DESTROY,
   200 	TF_WEAPON_PDA_SPY,
   201 	TF_WEAPON_BUILDER,
   202 	TF_WEAPON_MEDIGUN,
   203 	TF_WEAPON_GRENADE_MIRVBOMB,
   204 	TF_WEAPON_FLAMETHROWER_ROCKET,
   205 	TF_WEAPON_GRENADE_DEMOMAN,
   206 	TF_WEAPON_SENTRY_BULLET,
   207 	TF_WEAPON_SENTRY_ROCKET,
   208 	TF_WEAPON_DISPENSER,
   209 	TF_WEAPON_INVIS,
   210 	TF_WEAPON_FLAREGUN,
   211 	TF_WEAPON_LUNCHBOX,
   212 	TF_WEAPON_JAR,
   213 	TF_WEAPON_COMPOUND_BOW,
   214 	TF_WEAPON_BUFF_ITEM,
   215 	TF_WEAPON_PUMPKIN_BOMB,
   216 	TF_WEAPON_SWORD,
   217 	TF_WEAPON_DIRECTHIT,
   218 	TF_WEAPON_LIFELINE,
   219 	TF_WEAPON_LASER_POINTER,
   220 	TF_WEAPON_DISPENSER_GUN,
   221 	TF_WEAPON_SENTRY_REVENGE,
   222 	TF_WEAPON_JAR_MILK,
   223 	TF_WEAPON_HANDGUN_SCOUT_PRIMARY,
   224 	TF_WEAPON_BAT_FISH,
   225 	TF_WEAPON_CROSSBOW,
   226 	TF_WEAPON_STICKBOMB,
   227 	TF_WEAPON_HANDGUN_SCOUT_SEC,
   228 	TF_WEAPON_SODA_POPPER,
   229 	TF_WEAPON_SNIPERRIFLE_DECAP,
   230 	TF_WEAPON_RAYGUN,
   231 	TF_WEAPON_PARTICLE_CANNON,
   232 	TF_WEAPON_MECHANICAL_ARM,
   233 	TF_WEAPON_DRG_POMSON,
   234 	TF_WEAPON_BAT_GIFTWRAP,
   235 	TF_WEAPON_GRENADE_ORNAMENT,
   236 	TF_WEAPON_RAYGUN_REVENGE,
   237 	TF_WEAPON_PEP_BRAWLER_BLASTER,
   238 	TF_WEAPON_CLEAVER,
   239 	TF_WEAPON_GRENADE_CLEAVER,
   240 	TF_WEAPON_STICKY_BALL_LAUNCHER,
   241 	TF_WEAPON_GRENADE_STICKY_BALL,
   242 	TF_WEAPON_SHOTGUN_BUILDING_RESCUE,
   243 	TF_WEAPON_CANNON,
   244 	TF_WEAPON_THROWABLE,
   245 	TF_WEAPON_GRENADE_THROWABLE,
   246 	TF_WEAPON_PDA_SPY_BUILD,
   247 	TF_WEAPON_GRENADE_WATERBALLOON,
   248 	TF_WEAPON_HARVESTER_SAW,
   249 	TF_WEAPON_SPELLBOOK,
   250 	TF_WEAPON_SPELLBOOK_PROJECTILE,
   251 };
   252 
   253 // TF2 Weapon Loadout Slots
   254 enum
   255 {
   256 	TFWeaponSlot_Primary,
   257 	TFWeaponSlot_Secondary,
   258 	TFWeaponSlot_Melee,
   259 	TFWeaponSlot_Grenade,
   260 	TFWeaponSlot_Building,
   261 	TFWeaponSlot_PDA,
   262 	TFWeaponSlot_Item1,
   263 	TFWeaponSlot_Item2	
   264 };
   265 
   266 // Identifiers for the eventtype property on the teamplay_flag_event event
   267 enum {
   268 	TF_FLAGEVENT_PICKEDUP = 1,
   269 	TF_FLAGEVENT_CAPTURED,
   270 	TF_FLAGEVENT_DEFENDED,
   271 	TF_FLAGEVENT_DROPPED,
   272 	TF_FLAGEVENT_RETURNED
   273 };
   274 
   275 enum TFResourceType
   276 {
   277 	TFResource_Ping,
   278 	TFResource_Score,
   279 	TFResource_Deaths,
   280 	TFResource_TotalScore, 
   281 	TFResource_Captures,
   282 	TFResource_Defenses,
   283 	TFResource_Dominations,
   284 	TFResource_Revenge,
   285 	TFResource_BuildingsDestroyed, 
   286 	TFResource_Headshots,
   287 	TFResource_Backstabs,
   288 	TFResource_HealPoints,
   289 	TFResource_Invulns,
   290 	TFResource_Teleports,
   291 	TFResource_ResupplyPoints,
   292 	TFResource_KillAssists,
   293 	TFResource_MaxHealth,
   294 	TFResource_PlayerClass
   295 };
   296 
   297 static const String:TFResourceNames[TFResourceType][] =
   298 {
   299 	"m_iPing",
   300 	"m_iScore",
   301 	"m_iDeaths",
   302 	"m_iTotalScore",
   303 	"m_iCaptures",
   304 	"m_iDefenses",
   305 	"m_iDominations",
   306 	"m_iRevenge",
   307 	"m_iBuildingsDestroyed",
   308 	"m_iHeadshots",
   309 	"m_iBackstabs",
   310 	"m_iHealPoints",
   311 	"m_iInvulns",
   312 	"m_iTeleports",
   313 	"m_iResupplyPoints",
   314 	"m_iKillAssists",
   315 	"m_iMaxHealth",
   316 	"m_iPlayerClass"
   317 };
   318 
   319 /**
   320  * Get's a Clients current class.
   321  *
   322  * @param client		Player's index.
   323  * @return				Current TFClassType of player.
   324  * @error				Invalid client index.
   325  */
   326 stock TFClassType:TF2_GetPlayerClass(client)
   327 {
   328 	return TFClassType:GetEntProp(client, Prop_Send, "m_iClass");
   329 }
   330 
   331 /**
   332  * Set's a Clients class.
   333  *
   334  * Note: If setting player class in a player spawn hook weapons should be set to false.
   335  *
   336  * @param client		Player's index.
   337  * @param class			TFClassType class symbol.
   338  * @param weapons		This paramater is ignored.
   339  * @param persistent	If true changes the players desired class so the change stays after death.
   340  * @noreturn
   341  * @error				Invalid client index.
   342  */
   343 stock TF2_SetPlayerClass(client, TFClassType:class, bool:weapons=true, bool:persistent=true)
   344 {
   345 	SetEntProp(client, Prop_Send, "m_iClass", _:class);
   346 	
   347 	if (persistent)
   348 	{
   349 		SetEntProp(client, Prop_Send, "m_iDesiredPlayerClass", _:class);
   350 	}
   351 }
   352 
   353 /**
   354  * Retrieves client data from the resource entity
   355  *
   356  * @param client		Player's index.
   357  * @param type			ResourceType constant
   358  * @return				Value or -1 on failure.
   359  * @error				Invalid client index, client not in game or failed to find resource entity.
   360  */
   361 #pragma deprecated Use GetPlayerResourceEntity and GetEntProp instead
   362 stock TF2_GetPlayerResourceData(client, TFResourceType:type)
   363 {
   364 	if (!IsClientConnected(client))
   365 	{
   366 		return -1;	
   367 	}
   368 	
   369 	new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
   370 		
   371 	if (offset < 1)
   372 	{
   373 		return -1;	
   374 	}
   375 				
   376 	new entity = TF2_GetResourceEntity();
   377 	
   378 	if (entity == -1)
   379 	{
   380 		return -1;
   381 	}
   382 	
   383 	return GetEntData(entity, offset + (client*4));
   384 }
   385 
   386 /**
   387  * Sets client data in the resource entity
   388  *
   389  * Note: The game overwrites these values every frame, so changing them will have very little effect.
   390  *
   391  * @param client		Player's index.
   392  * @param type			ResourceType constant
   393  * @param value			Value to set.
   394  * @return				Value or -1 on failure.
   395  * @error				Invalid client index, client not in game or failed to find resource entity.
   396  */
   397 #pragma deprecated Use GetPlayerResourceEntity and SetEntProp instead
   398 stock bool:TF2_SetPlayerResourceData(client, TFResourceType:type, any:value)
   399 {
   400 	if (!IsClientConnected(client))
   401 	{
   402 		return false;	
   403 	}
   404 	
   405 	new offset = FindSendPropInfo("CTFPlayerResource", TFResourceNames[type]);
   406 						
   407 	if (offset < 1)
   408 	{
   409 		return false;	
   410 	}
   411 				
   412 	new entity = TF2_GetResourceEntity();
   413 	
   414 	if (entity == -1)
   415 	{
   416 		return false;	
   417 	}
   418 	
   419 	SetEntData(entity, offset + (client*4), value);
   420 	
   421 	return true;	
   422 }
   423 
   424 /**
   425  * Removes all weapons from a client's weapon slot
   426  *
   427  * @param client		Player's index.
   428  * @param slot			Slot index (0-5)
   429  * @noreturn
   430  * @error				Invalid client, invalid slot or lack of mod support
   431  */
   432 stock TF2_RemoveWeaponSlot(client, slot)
   433 {
   434 	new weaponIndex;
   435 	while ((weaponIndex = GetPlayerWeaponSlot(client, slot)) != -1)
   436 	{
   437 		RemovePlayerItem(client, weaponIndex);
   438 		AcceptEntityInput(weaponIndex, "Kill");
   439 	}
   440 }
   441 
   442 /**
   443  * Removes all weapons from a client
   444  *
   445  * @param client		Player's index.
   446  * @noreturn
   447  */
   448 stock TF2_RemoveAllWeapons(client)
   449 {
   450 	for (new i = 0; i <= 5; i++)
   451 	{
   452 		TF2_RemoveWeaponSlot(client, i);
   453 	}
   454 }
   455 
   456 /**
   457  * Gets a player's condition bits
   458  *
   459  * @param client		Player's index.
   460  * @return				Player's condition bits
   461  */
   462 #pragma deprecated Use TF2_IsPlayerInCondition instead.
   463 stock TF2_GetPlayerConditionFlags(client)
   464 {
   465 	return GetEntProp(client, Prop_Send, "m_nPlayerCond")|GetEntProp(client, Prop_Send, "_condition_bits");
   466 }
   467 
   468 /**
   469  * Check whether or not a condition is set on a player
   470  *
   471  * @param client		Player's index.
   472  * @param cond			TFCond constant
   473  * @return				True if set, false otherwise
   474  */
   475 stock bool:TF2_IsPlayerInCondition(client, TFCond:cond)
   476 {
   477 	// Conditions are stored across two netprops now, one for each 32-bit segment.
   478 	if (_:cond < 32)
   479 	{
   480 		new bit = 1 << _:cond;
   481 		if ((GetEntProp(client, Prop_Send, "m_nPlayerCond") & bit) == bit)
   482 		{
   483 			return true;
   484 		}
   485 		
   486 		if ((GetEntProp(client, Prop_Send, "_condition_bits") & bit) == bit)
   487 		{
   488 			return true;
   489 		}
   490 	}
   491 	else if (_:cond < 64)
   492 	{
   493 		new bit = (1 << (_:cond - 32));
   494 		if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx") & bit) == bit)
   495 		{
   496 			return true;
   497 		}
   498 	}
   499 	else
   500 	{
   501 		new bit = (1 << (_:cond - 64));
   502 		if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx2") & bit) == bit)
   503 		{
   504 			return true;
   505 		}
   506 	}
   507 	
   508 	return false;
   509 }
   510 
   511 /**
   512  * Gets an entity's object type.
   513  *
   514  * @param entity		Entity index.
   515  * @return				Current TFObjectType of entity.
   516  * @error				Invalid entity index.
   517  */
   518 stock TFObjectType:TF2_GetObjectType(entity)
   519 {
   520 	new offset = GetEntSendPropOffs(entity, "m_iObjectType");
   521 	
   522 	if (offset <= 0)
   523 	{
   524 		ThrowError("Entity index %d is not an object", entity);
   525 	}
   526 	
   527 	return TFObjectType:GetEntData(entity, offset);
   528 }
   529 
   530 /**
   531  * Gets an entity's object mode.
   532  *
   533  * @param entity		Entity index.
   534  * @return				Current TFObjectMode of entity.
   535  * @error				Invalid entity index.
   536  */
   537 stock TFObjectMode:TF2_GetObjectMode(entity)
   538 {
   539 	new offset = GetEntSendPropOffs(entity, "m_iObjectMode");
   540 	
   541 	if (offset <= 0)
   542 	{
   543 		ThrowError("Entity index %d is not an object", entity);
   544 	}
   545 	
   546 	return TFObjectMode:GetEntData(entity, offset);
   547 }