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,
86 TFCond_CloakFlicker = 9,
90 TFCond_TmpDamageBonus = 12,
104 TFCond_DefenseBuffed,
108 TFCond_MarkedForDeath,
109 TFCond_NoHealingDamageBuff,
110 TFCond_SpeedBuffAlly,
111 TFCond_HalloweenCritCandy,
114 TFCond_CritHype = 36,
115 TFCond_CritOnFirstBlood,
117 TFCond_CritOnFlagCapture,
119 TFCond_RestrictToMelee,
121 TFCond_Reprogrammed = 43,
123 TFCond_DefenseBuffMmmph,
125 TFCond_DisguiseRemoved,
126 TFCond_MarkedForDeathSilent,
127 TFCond_DisguisedAsDispenser,
129 TFCond_UberchargedHidden,
130 TFCond_UberchargedCanteen,
131 TFCond_HalloweenBombHead,
132 TFCond_HalloweenThriller,
133 TFCond_RadiusHealOnDamage,
135 TFCond_UberchargedOnTakeDamage,
136 TFCond_UberBulletResist,
137 TFCond_UberBlastResist,
138 TFCond_UberFireResist,
139 TFCond_SmallBulletResist,
140 TFCond_SmallBlastResist,
141 TFCond_SmallFireResist,
146 TFHoliday_Birthday = 1,
149 TFHoliday_ValentinesDay,
150 TFHoliday_MeetThePyro,
152 TFHoliday_HalloweenOrFullMoon,
153 TFHoliday_HalloweenOrFullMoonOrValentines,
158 TFObject_CartDispenser = 0,
159 TFObject_Dispenser = 0,
160 TFObject_Teleporter = 1,
167 TFObjectMode_None = 0,
168 TFObjectMode_Entrance = 0,
169 TFObjectMode_Exit = 1
173 * Sets a client on fire for 10 seconds.
175 * @param client Player's index.
176 * @param attacker Attacker's index.
178 * @error Invalid client index, client not in game, or no mod support.
180 native TF2_IgnitePlayer(client, attacker);
185 * @param client Player's index.
187 * @error Invalid client index, client not in game, or no mod support.
189 native TF2_RespawnPlayer(client);
192 * Regenerates a client's health and ammunition
194 * @param client Player's index.
196 * @error Invalid client index, client not in game, or no mod support.
198 native TF2_RegeneratePlayer(client);
201 * Adds a condition to a player
203 * @param client Player's index.
204 * @param condition Integer identifier of condition to apply.
205 * @param duration Duration of condition (does not apply to all conditions).
206 * @param inflictor Condition inflictor's index (0 for no inflictor).
208 * @error Invalid client index, client not in game, or no mod support.
210 native TF2_AddCondition(client, TFCond:condition, Float:duration, inflictor=0);
213 * Removes a condition from a player
215 * @param client Player's index.
216 * @param condition Integer identifier of condition to remove.
218 * @error Invalid client index, client not in game, or no mod support.
220 native TF2_RemoveCondition(client, TFCond:condition);
223 * Enables/disables PowerPlay mode on a player.
225 * @param client Player's index.
226 * @param enabled Whether to enable or disable PowerPlay on player.
228 * @error Invalid client index, client not in game, or no mod support.
230 native TF2_SetPlayerPowerPlay(client, bool:enabled);
233 * Disguises a client to the given model and team. Only has an effect on spies.
235 * Note: This only starts the disguise process and a delay occurs before the spy is fully disguised
237 * @param client Player's index.
238 * @param team Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect)
239 * @param class TFClassType class to disguise the player as
240 * @param target Specific target player to disguise as (0 for any)
242 * @error Invalid client index, client not in game, or no mod support.
244 native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:class, target=0);
247 * Removes the current disguise from a client. Only has an effect on spies.
249 * @param client Player's index.
251 * @error Invalid client index, client not in game, or no mod support.
253 native TF2_RemovePlayerDisguise(client);
258 * @param client Player's index.
259 * @param duration Duration of stun.
260 * @param slowdown Slowdown percent (as decimal, 0.00-1.00)
261 * Ignored if TF_STUNFLAG_SLOWDOWN is not set.
262 * @param stunflags Stun flags.
263 * @param attacker Attacker's index (0 is allowed for world).
266 native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0);
269 * Induces the bleed effect on a client
271 * @param client Player's index.
272 * @param attacker Attacker's index.
273 * @param duration Duration of bleeding (in seconds).
276 native TF2_MakeBleed(client, attacker, Float:duration);
279 * Retrieves the entity index of the CPlayerResource entity
281 * @return The current resource entity index.
283 #pragma deprecated Use GetPlayerResourceEntity instead
284 native TF2_GetResourceEntity();
287 * Finds the TFClassType for a given class name.
289 * @param classname A classname string such as "sniper" or "demoman"
290 * @return A TFClassType constant.
292 native TFClassType:TF2_GetClass(const String:classname[]);
295 * Called on weapon fire to decide if the current shot should be critical.
296 * Return Plugin_Continue to let the original calculation or return a higher
297 * action to override the decision with the value of 'result'
299 * @note Since critical shots are also calculated client side any changes made with
300 * this will not show for the shooter. Projectile weapons such as the rocketlauncher
301 * and demoman weapons will show a critical bullet but no critical sound effect.
302 * Bullet hits should appear as expected.
304 * @param client Client Index.
305 * @param weapon Weapon entity Index.
306 * @param weaponname Classname of the weapon.
307 * @param result Buffer param for the result of the decision.
309 forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result);
312 * @deprecated No longer called. Use TF2_OnIsHolidayActive.
314 #pragma deprecated No longer called. Use TF2_OnIsHolidayActive.
315 forward Action:TF2_OnGetHoliday(&TFHoliday:holiday);
318 * Called at various times when the game checks to see if the given holiday is active.
319 * Return Plugin_Continue to let the original calculation or return a higher
320 * action to override the decision with the value of 'result'
322 * @param holiday Holiday being checked.
323 * @param result Buffer param for the result of the decision.
324 * @return Plugin_Continue for original calculation, higher value to use 'result'.
326 forward Action:TF2_OnIsHolidayActive(TFHoliday:holiday, &bool:result);
329 * Returns whether or not a client (Player) is in a duel.
331 * @param client Client Index.
332 * @return Boolean of whether or not the client/player is dueling.
334 native bool:TF2_IsPlayerInDuel(client);
337 * Called after a condition is added to a player
339 * @param client Index of the client to which the conditon is being added.
340 * @param condition Condition that is being added.
343 forward TF2_OnConditionAdded(client, TFCond:condition);
346 * Called after a condition is removed from a player
348 * @param client Index of the client to which the condition is being removed.
349 * @param condition Condition that is being removed.
352 forward TF2_OnConditionRemoved(client, TFCond:condition);
355 * Called when the server enters the Waiting for Players round state
359 forward TF2_OnWaitingForPlayersStart();
362 * Called when the server exits the Waiting for Players round state
366 forward TF2_OnWaitingForPlayersEnd();
369 * Called when a player attempts to use a teleporter to decide if the player should be allowed to teleport.
370 * Return Plugin_Continue to let the original calculation or return a higher
371 * action to override the decision with the value of 'result'
373 * @param client Client index.
374 * @param teleporter Teleporter entity index.
375 * @param result Buffer param for the result of the decision.
376 * This is prepopulated with the game's original decision to let a player teleport.
377 * @return Plugin_Continue for original calculation, higher value to use 'result'.
379 forward Action:TF2_OnPlayerTeleport(client, teleporter, &bool:result);
382 * Do not edit below this line!
384 public Extension:__ext_tf2 =
387 file = "game.tf2.ext",
389 #if defined REQUIRE_EXTENSIONS
396 #if !defined REQUIRE_EXTENSIONS
397 public __ext_tf2_SetNTVOptional()
399 MarkNativeAsOptional("TF2_IgnitePlayer");
400 MarkNativeAsOptional("TF2_RespawnPlayer");
401 MarkNativeAsOptional("TF2_RegeneratePlayer");
402 MarkNativeAsOptional("TF2_AddCondition");
403 MarkNativeAsOptional("TF2_RemoveCondition");
404 MarkNativeAsOptional("TF2_SetPlayerPowerPlay");
405 MarkNativeAsOptional("TF2_DisguisePlayer");
406 MarkNativeAsOptional("TF2_RemovePlayerDisguise");
407 MarkNativeAsOptional("TF2_StunPlayer");
408 MarkNativeAsOptional("TF2_MakeBleed");
409 MarkNativeAsOptional("TF2_GetResourceEntity");
410 MarkNativeAsOptional("TF2_GetClass");
411 MarkNativeAsOptional("TF2_IsPlayerInDuel");