plugins/include/tf2.inc
author Matt Woodrow <pred@alliedmods.net>
Thu Apr 10 04:49:17 2008 +0000 (2008-04-10)
changeset 1979 d36fac1a8203
parent 1965 63d5a5f6935f
child 1981 0a12326343ad
permissions -rw-r--r--
Added Critical Hit hook to TF2 extension
     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: sdktools_entoutput.inc 1504 2007-09-28 19:56:19Z faluco $
    31  */
    32 
    33 #if defined _tf2_included
    34  #endinput
    35 #endif
    36 #define _tf2_included
    37 
    38 enum TFClassType
    39 {
    40 	TFClass_Unknown = 0,
    41 	TFClass_Scout,
    42 	TFClass_Sniper,
    43 	TFClass_Soldier,
    44 	TFClass_DemoMan,
    45 	TFClass_Medic,
    46 	TFClass_Heavy,
    47 	TFClass_Pyro,
    48 	TFClass_Spy,
    49 	TFClass_Engineer
    50 }
    51 
    52 enum TFTeam
    53 {
    54 	TFTeam_Unassigned = 0,
    55 	TFTeam_Spectator = 1,
    56 	TFTeam_Red = 2,
    57 	TFTeam_Blue = 3	
    58 }
    59 
    60 /**
    61  * Set's a Clients invulnrability status (ubercharge effect)
    62  *
    63  * @param client		Player's index.
    64  * @param enabled		Enable/Disable invulnrability.
    65  * @noreturn
    66  * @error				Invalid client index, client not in game, or no mod support.
    67  */
    68 native TF2_SetPlayerInvuln(client, bool:enabled);
    69 
    70 /**
    71  * Respawns a client
    72  *
    73  * @param client		Player's index.
    74  * @noreturn
    75  * @error				Invalid client index, client not in game, or no mod support.
    76  */
    77 native TF2_RespawnPlayer(client);
    78 
    79 /**
    80  * Disguises a client to the given model and team. Only has an effect on spies.
    81  *
    82  * Note: This only starts the disguise process and a delay occurs before the spy is fully disguised
    83  *
    84  * @param client		Player's index.
    85  * @param team			Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect)
    86  * @param class			TFClassType class to disguise the player as
    87  * @noreturn
    88  * @error				Invalid client index, client not in game, or no mod support.
    89  */
    90 native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:class);
    91 
    92 /**
    93  * Removes the current disguise from a client. Only has an effect on spies.
    94  *
    95  * @param client		Player's index.
    96  * @noreturn
    97  * @error				Invalid client index, client not in game, or no mod support.
    98  */
    99 native TF2_RemovePlayerDisguise(client);
   100 
   101 /**
   102  * Retrieves the entity index of the CPlayerResource entity
   103  *
   104  * @return				The current resource entity index.
   105  */
   106 native TF2_GetResourceEntity();
   107 
   108 /**
   109  * Finds the TFClassType for a given class name.
   110  *
   111  * @param classname		A classname string such as "sniper" or "demoman"
   112  * @return				A TFClassType constant.
   113  */
   114 native TFClassType:TF2_GetClass(const String:classname[]);
   115 
   116 /**
   117  * Called on weapon fire to decide if the current shot should be critical.
   118  * Return Plugin_Continue to let the original calculation or return a higher
   119  * action to override the decision with the value of 'result'
   120  *
   121  * @note Since critical shots are also calculated client side any changes made with
   122  *		 this will not show for the shooter. Projectile weapons such as the rocketlauncher
   123  *		 and demoman weapons will show a critical bullet but no critical sound effect.
   124  *		 Bullet hits should appear as expected.
   125  *
   126  * @param client		Client Index.
   127  * @param weapon		Weapon entity Index.
   128  * @param weaponname	Classname of the weapon.
   129  * @param result		Buffer param for the result of the decision.
   130  */
   131 forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result)
   132 
   133 /**
   134  * Do not edit below this line!
   135  */
   136 public Extension:__ext_tf2 = 
   137 {
   138 	name = "TF2 Tools",
   139 	file = "game.tf2.ext",
   140 	autoload = 1,
   141 #if defined REQUIRE_EXTENSIONS
   142 	required = 1,
   143 #else
   144 	required = 0,
   145 #endif
   146 };