3 * =============================================================================
4 * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
5 * =============================================================================
7 * This file is part of the SourceMod/SourcePawn SDK.
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.
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
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/>.
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>.
33 #if defined _tf2_included
38 #define TF_STUNFLAG_SLOWDOWN (1 << 0) // activates slowdown modifier
39 #define TF_STUNFLAG_BONKSTUCK (1 << 1) // bonk sound, stuck
40 #define TF_STUNFLAG_LIMITMOVEMENT (1 << 2) // disable forward/backward movement
41 #define TF_STUNFLAG_CHEERSOUND (1 << 3) // cheering sound
42 #define TF_STUNFLAG_NOSOUNDOREFFECT (1 << 5) // no sound or particle
43 #define TF_STUNFLAG_THIRDPERSON (1 << 6) // panic animation
44 #define TF_STUNFLAG_GHOSTEFFECT (1 << 7) // ghost particles
46 #define TF_STUNFLAGS_LOSERSTATE TF_STUNFLAG_SLOWDOWN|TF_STUNFLAG_NOSOUNDOREFFECT|TF_STUNFLAG_THIRDPERSON
47 #define TF_STUNFLAGS_GHOSTSCARE TF_STUNFLAG_GHOSTEFFECT|TF_STUNFLAG_THIRDPERSON
48 #define TF_STUNFLAGS_SMALLBONK TF_STUNFLAG_THIRDPERSON|TF_STUNFLAG_SLOWDOWN
49 #define TF_STUNFLAGS_NORMALBONK TF_STUNFLAG_BONKSTUCK
50 #define TF_STUNFLAGS_BIGBONK TF_STUNFLAG_CHEERSOUND|TF_STUNFLAG_BONKSTUCK
68 TFTeam_Unassigned = 0,
82 TFCond_TeleportedGlow,
84 TFCond_UberchargeFading,
102 * Sets a client on fire for 10 seconds.
104 * @param client Player's index.
106 * @error Invalid client index, client not in game, or no mod support.
108 native TF2_IgnitePlayer(client, target);
113 * @param client Player's index.
115 * @error Invalid client index, client not in game, or no mod support.
117 native TF2_RespawnPlayer(client);
120 * Regenerates a client's health and ammunition
122 * @param client Player's index.
124 * @error Invalid client index, client not in game, or no mod support.
126 native TF2_RegeneratePlayer(client);
129 * Adds a condition to a player
131 * @param client Player's index.
132 * @param condition Integer identifier of condition to apply.
133 * @param duration Duration of condition (does not apply to all conditions).
135 * @error Invalid client index, client not in game, or no mod support.
137 native TF2_AddCondition(client, TFCond:condition, Float:duration);
140 * Removes a condition from a player
142 * @param client Player's index.
143 * @param condition Integer identifier of condition to remove.
145 * @error Invalid client index, client not in game, or no mod support.
147 native TF2_RemoveCondition(client, TFCond:condition);
150 * Enables/disables PowerPlay mode on a player.
152 * @param client Player's index.
153 * @param enabled Whether to enable or disable PowerPlay on player.
155 * @error Invalid client index, client not in game, or no mod support.
157 native TF2_SetPlayerPowerPlay(client, bool:enabled);
160 * Disguises a client to the given model and team. Only has an effect on spies.
162 * Note: This only starts the disguise process and a delay occurs before the spy is fully disguised
164 * @param client Player's index.
165 * @param team Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect)
166 * @param class TFClassType class to disguise the player as
168 * @error Invalid client index, client not in game, or no mod support.
170 native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:class);
173 * Removes the current disguise from a client. Only has an effect on spies.
175 * @param client Player's index.
177 * @error Invalid client index, client not in game, or no mod support.
179 native TF2_RemovePlayerDisguise(client);
184 * @param client Player's index.
185 * @param float Duration of stun.
186 * @param float Slowdown percent (as decimal, 0.00-1.00)
187 * (ignored if TF_STUNFLAG_SLOWDOWN is not set.
188 * @param int Stun flags.
189 * @param attacker Attacker's index (0 is allowed for world).
192 native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0);
195 * Retrieves the entity index of the CPlayerResource entity
197 * @return The current resource entity index.
199 native TF2_GetResourceEntity();
202 * Finds the TFClassType for a given class name.
204 * @param classname A classname string such as "sniper" or "demoman"
205 * @return A TFClassType constant.
207 native TFClassType:TF2_GetClass(const String:classname[]);
210 * Called on weapon fire to decide if the current shot should be critical.
211 * Return Plugin_Continue to let the original calculation or return a higher
212 * action to override the decision with the value of 'result'
214 * @note Since critical shots are also calculated client side any changes made with
215 * this will not show for the shooter. Projectile weapons such as the rocketlauncher
216 * and demoman weapons will show a critical bullet but no critical sound effect.
217 * Bullet hits should appear as expected.
219 * @param client Client Index.
220 * @param weapon Weapon entity Index.
221 * @param weaponname Classname of the weapon.
222 * @param result Buffer param for the result of the decision.
224 forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result);
227 * Do not edit below this line!
229 public Extension:__ext_tf2 =
232 file = "game.tf2.ext",
234 #if defined REQUIRE_EXTENSIONS
241 #if !defined REQUIRE_EXTENSIONS
242 public __ext_tf2_SetNTVOptional()
244 MarkNativeAsOptional("TF2_IgnitePlayer");
245 MarkNativeAsOptional("TF2_RespawnPlayer");
246 MarkNativeAsOptional("TF2_RegeneratePlayer");
247 MarkNativeAsOptional("TF2_AddCondition");
248 MarkNativeAsOptional("TF2_RemoveCondition");
249 MarkNativeAsOptional("TF2_SetPlayerPowerPlay");
250 MarkNativeAsOptional("TF2_DisguisePlayer");
251 MarkNativeAsOptional("TF2_RemovePlayerDisguise");
252 MarkNativeAsOptional("TF2_StunPlayer");
253 MarkNativeAsOptional("TF2_GetResourceEntity");
254 MarkNativeAsOptional("TF2_GetClass");