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 _cstrike_included
36 #define _cstrike_included
38 #define CS_TEAM_NONE 0 /**< No team yet. */
39 #define CS_TEAM_SPECTATOR 1 /**< Spectators. */
40 #define CS_TEAM_T 2 /**< Terrorists. */
41 #define CS_TEAM_CT 3 /**< Counter-Terrorists. */
43 #define CS_SLOT_PRIMARY 0 /**< Primary weapon slot. */
44 #define CS_SLOT_SECONDARY 1 /**< Secondary weapon slot. */
45 #define CS_SLOT_GRENADE 3 /**< Grenade slot (will only return one grenade). */
46 #define CS_SLOT_C4 4 /**< C4 slot. */
50 CSRoundEnd_TargetBombed = 0, // Target Successfully Bombed!
51 CSRoundEnd_VIPEscaped, // The VIP has escaped!
52 CSRoundEnd_VIPKilled, // VIP has been assassinated!
53 CSRoundEnd_TerroristsEscaped, // The terrorists have escaped!
54 CSRoundEnd_CTStoppedEscape, // The CTs have prevented most of the terrorists from escaping!
55 CSRoundEnd_TerroristsStopped, // Escaping terrorists have all been neutralized!
56 CSRoundEnd_BombDefused, // The bomb has been defused!
57 CSRoundEnd_CTWin, // Counter-Terrorists Win!
58 CSRoundEnd_TerroristWin, // Terrorists Win!
59 CSRoundEnd_Draw, // Round Draw!
60 CSRoundEnd_HostagesRescued, // All Hostages have been rescued!
61 CSRoundEnd_TargetSaved, // Target has been saved!
62 CSRoundEnd_HostagesNotRescued, // Hostages have not been rescued!
63 CSRoundEnd_TerroristsNotEscaped, // Terrorists have not escaped!
64 CSRoundEnd_VIPNotEscaped, // VIP has not escaped!
65 CSRoundEnd_GameStart // Game Commencing!
79 CSWeapon_SMOKEGRENADE,
102 CSWeapon_ASSAULTSUIT,
106 * Called when a player attempts to purchase an item.
107 * Return Plugin_Continue to allow the purchase or return a
108 * higher action to deny.
110 * @param client Client index
111 * @param weapon User input for weapon name
113 forward Action:CS_OnBuyCommand(client, const String:weapon[]);
116 * Called when CSWeaponDrop is called
117 * Return Plugin_Continue to allow the call or return a
118 * higher action to deny.
120 * @param client Client index
121 * @param weapon Weapon index
123 forward Action:CS_OnCSWeaponDrop(client, weaponIndex);
126 * Called when game retrieves a weapon's price for a player.
127 * Return Plugin_Continue to use default value or return a higher
128 * action to use a newly-set price.
130 * @note This can be called multiple times per weapon purchase
132 * @param client Client index
133 * @param weapon Weapon classname
134 * @param price Buffer param for the price of the weapon
136 * @note Not all "weapons" call GetWeaponPrice. Example: c4, knife, vest, vest helmet, night vision.
138 forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price);
141 * Called when TerminateRound is called.
142 * Return Plugin_Continue to ignore, return Plugin_Changed to continue,
143 * using the given delay and reason, or return Plugin_Handled or a higher
144 * action to block TerminateRound from firing.
146 * @param delay Time (in seconds) until new round starts
147 * @param reason Reason for round end
149 forward Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason);
154 * @param client Player's index.
156 * @error Invalid client index, client not in game.
158 native CS_RespawnPlayer(client);
161 * Switches the player's team.
163 * @param client Player's index.
164 * @param team Team index.
166 * @error Invalid client index, client not in game.
168 native CS_SwitchTeam(client, team);
171 * Forces a player to drop or toss their weapon
173 * @param client Player's index.
174 * @param weaponIndex Index of weapon to drop.
175 * @param toss True to toss weapon (with velocity) or false to just drop weapon
176 * @param blockhook Set to true to stop the corresponding CS_OnCSWeaponDrop
179 * @error Invalid client index, client not in game, or invalid weapon index.
181 native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false);
184 * Forces round to end with a reason
186 * @param delay Time (in seconds) to delay before new round starts
187 * @param reason Reason for the round ending
188 * @param blockhook Set to true to stop the corresponding CS_OnTerminateRound
189 * forward from being called.
192 native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook = false);
195 * Gets a weapon name from a weapon alias
197 * @param alias Weapons alias to get weapon name for.
198 * @param weapon Buffer to store weapons name
199 * @param size Size of buffer to store the weapons name.
202 * @note Will set the buffer to the original alias if it is not an alias to a weapon.
204 native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size);
207 * Gets a weapon's price
209 * @param client Client to check weapon price for.
210 * @param id Weapon id for the weapon to check
211 * @param defaultprice Set to true to get defaultprice.
212 * @return Returns price of the weapon (even if modified)
214 * @error Invalid client, failing to get weapon info, or failing to get price offset.
215 * @note Not all "weapons" will return their default price. Example: c4, knife, vest, vest helmet, night vision.
217 native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice=false);
220 * Do not edit below this line!
222 public Extension:__ext_cstrike =
225 file = "games/game.cstrike.ext",
227 #if defined REQUIRE_EXTENSIONS
234 #if !defined REQUIRE_EXTENSIONS
235 public __ext_cstrike_SetNTVOptional()
237 MarkNativeAsOptional("CS_RespawnPlayer");
238 MarkNativeAsOptional("CS_SwitchTeam");
239 MarkNativeAsOptional("CS_DropWeapon");
240 MarkNativeAsOptional("CS_TerminateRound");
241 MarkNativeAsOptional("CS_GetTranslatedWeaponAlias");
242 MarkNativeAsOptional("CS_GetWeaponPrice");