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,
113 TFCond_CritHype = 36,
114 TFCond_CritOnFirstBlood,
116 TFCond_CritOnFlagCapture,
118 TFCond_RestrictToMelee,
120 TFCond_CritMmmph = 44,
121 TFCond_DefenseBuffMmmph,
126 TFHoliday_Birthday = 1,
129 TFHoliday_MeetThePyro,
130 TFHoliday_MannVsMachine,
132 TFHoliday_HalloweenOrFullMoon,
137 TFObject_CartDispenser = 0,
138 TFObject_Dispenser = 0,
139 TFObject_Teleporter = 1,
146 TFObjectMode_None = 0,
147 TFObjectMode_Entrance = 0,
148 TFObjectMode_Exit = 1
152 * Sets a client on fire for 10 seconds.
154 * @param client Player's index.
156 * @error Invalid client index, client not in game, or no mod support.
158 native TF2_IgnitePlayer(client, target);
163 * @param client Player's index.
165 * @error Invalid client index, client not in game, or no mod support.
167 native TF2_RespawnPlayer(client);
170 * Regenerates a client's health and ammunition
172 * @param client Player's index.
174 * @error Invalid client index, client not in game, or no mod support.
176 native TF2_RegeneratePlayer(client);
179 * Adds a condition to a player
181 * @param client Player's index.
182 * @param condition Integer identifier of condition to apply.
183 * @param duration Duration of condition (does not apply to all conditions).
185 * @error Invalid client index, client not in game, or no mod support.
187 native TF2_AddCondition(client, TFCond:condition, Float:duration);
190 * Removes a condition from a player
192 * @param client Player's index.
193 * @param condition Integer identifier of condition to remove.
195 * @error Invalid client index, client not in game, or no mod support.
197 native TF2_RemoveCondition(client, TFCond:condition);
200 * Enables/disables PowerPlay mode on a player.
202 * @param client Player's index.
203 * @param enabled Whether to enable or disable PowerPlay on player.
205 * @error Invalid client index, client not in game, or no mod support.
207 native TF2_SetPlayerPowerPlay(client, bool:enabled);
210 * Disguises a client to the given model and team. Only has an effect on spies.
212 * Note: This only starts the disguise process and a delay occurs before the spy is fully disguised
214 * @param client Player's index.
215 * @param team Team to disguise the player as (only TFTeam_Red and TFTeam_Blue have an effect)
216 * @param class TFClassType class to disguise the player as
217 * @param target Specific target player to disguise as (0 for any)
219 * @error Invalid client index, client not in game, or no mod support.
221 native TF2_DisguisePlayer(client, TFTeam:team, TFClassType:class, target=0);
224 * Removes the current disguise from a client. Only has an effect on spies.
226 * @param client Player's index.
228 * @error Invalid client index, client not in game, or no mod support.
230 native TF2_RemovePlayerDisguise(client);
235 * @param client Player's index.
236 * @param float Duration of stun.
237 * @param float Slowdown percent (as decimal, 0.00-1.00)
238 * (ignored if TF_STUNFLAG_SLOWDOWN is not set.
239 * @param int Stun flags.
240 * @param attacker Attacker's index (0 is allowed for world).
243 native TF2_StunPlayer(client, Float:duration, Float:slowdown=0.0, stunflags, attacker=0);
246 * Induces the bleed effect on a client
248 * @param client Player's index.
249 * @param attacker Attacker's index.
250 * @param float Duration of bleeding (in seconds).
253 native TF2_MakeBleed(client, attacker, Float:duration);
256 * Retrieves the entity index of the CPlayerResource entity
258 * @return The current resource entity index.
260 native TF2_GetResourceEntity();
263 * Finds the TFClassType for a given class name.
265 * @param classname A classname string such as "sniper" or "demoman"
266 * @return A TFClassType constant.
268 native TFClassType:TF2_GetClass(const String:classname[]);
271 * Called on weapon fire to decide if the current shot should be critical.
272 * Return Plugin_Continue to let the original calculation or return a higher
273 * action to override the decision with the value of 'result'
275 * @note Since critical shots are also calculated client side any changes made with
276 * this will not show for the shooter. Projectile weapons such as the rocketlauncher
277 * and demoman weapons will show a critical bullet but no critical sound effect.
278 * Bullet hits should appear as expected.
280 * @param client Client Index.
281 * @param weapon Weapon entity Index.
282 * @param weaponname Classname of the weapon.
283 * @param result Buffer param for the result of the decision.
285 forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result);
288 * @deprecated No longer called. Use TF2_OnIsHolidayActive.
290 #pragma deprecated No longer called. Use TF2_OnIsHolidayActive.
291 forward Action:TF2_OnGetHoliday(&TFHoliday:holiday);
294 * Called at various times when the game checks to see if the given holiday is active.
295 * Return Plugin_Continue to let the original calculation or return a higher
296 * action to override the decision with the value of 'result'
298 * @param holiday Holiday being checked.
299 * @param result Buffer param for the result of the decision.
300 * @return Plugin_Continue for original calculation, higher value to use 'result'.
302 forward Action:TF2_OnIsHolidayActive(TFHoliday:holiday, &bool:result);
305 * Returns whether or not a client (Player) is in a duel.
307 * @param client Client Index.
308 * @return Boolean of whether or not the client/player is dueling.
310 native bool:TF2_IsPlayerInDuel(client);
313 * Called after a condition is added to a player
315 * @param client Index of the client to which the conditon is being added.
316 * @param condition Condition that is being added.
319 forward TF2_OnConditionAdded(client, TFCond:condition);
322 * Called after a condition is removed from a player
324 * @param client Index of the client to which the condition is being removed.
325 * @param condition Condition that is being removed.
328 forward TF2_OnConditionRemoved(client, TFCond:condition);
331 * Called when the server enters the Waiting for Players round state
335 forward TF2_OnWaitingForPlayersStart();
338 * Called when the server exits the Waiting for Players round state
342 forward TF2_OnWaitingForPlayersEnd();
345 * Called when a player attempts to use a teleporter to decide if the player should be allowed to teleport.
346 * Return Plugin_Continue to let the original calculation or return a higher
347 * action to override the decision with the value of 'result'
349 * @param client Client index.
350 * @param teleporter Teleporter entity index.
351 * @param result Buffer param for the result of the decision.
352 * This is prepopulated with the game's original decision to let a player teleport.
353 * @return Plugin_Continue for original calculation, higher value to use 'result'.
355 forward Action:TF2_OnPlayerTeleport(client, teleporter, &bool:result);
358 * Do not edit below this line!
360 public Extension:__ext_tf2 =
363 file = "game.tf2.ext",
365 #if defined REQUIRE_EXTENSIONS
372 #if !defined REQUIRE_EXTENSIONS
373 public __ext_tf2_SetNTVOptional()
375 MarkNativeAsOptional("TF2_IgnitePlayer");
376 MarkNativeAsOptional("TF2_RespawnPlayer");
377 MarkNativeAsOptional("TF2_RegeneratePlayer");
378 MarkNativeAsOptional("TF2_AddCondition");
379 MarkNativeAsOptional("TF2_RemoveCondition");
380 MarkNativeAsOptional("TF2_SetPlayerPowerPlay");
381 MarkNativeAsOptional("TF2_DisguisePlayer");
382 MarkNativeAsOptional("TF2_RemovePlayerDisguise");
383 MarkNativeAsOptional("TF2_StunPlayer");
384 MarkNativeAsOptional("TF2_MakeBleed");
385 MarkNativeAsOptional("TF2_GetResourceEntity");
386 MarkNativeAsOptional("TF2_GetClass");
387 MarkNativeAsOptional("TF2_IsPlayerInDuel");