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!
67 // The below only exist on CS:GO
68 CSRoundEnd_TerroristsSurrender, // Terrorists Surrender
69 CSRoundEnd_CTSurrender, // CTs Surrender
83 CSWeapon_SMOKEGRENADE,
106 CSWeapon_ASSAULTSUIT,
107 CSWeapon_NIGHTVISION,
132 * Called when a player attempts to purchase an item.
133 * Return Plugin_Continue to allow the purchase or return a
134 * higher action to deny.
136 * @param client Client index
137 * @param weapon User input for weapon name
139 forward Action:CS_OnBuyCommand(client, const String:weapon[]);
142 * Called when CSWeaponDrop is called
143 * Return Plugin_Continue to allow the call or return a
144 * higher action to deny.
146 * @param client Client index
147 * @param weapon Weapon index
149 forward Action:CS_OnCSWeaponDrop(client, weaponIndex);
152 * Called when game retrieves a weapon's price for a player.
153 * Return Plugin_Continue to use default value or return a higher
154 * action to use a newly-set price.
156 * @note This can be called multiple times per weapon purchase
158 * @param client Client index
159 * @param weapon Weapon classname
160 * @param price Buffer param for the price of the weapon
162 * @note Not all "weapons" call GetWeaponPrice. Example: c4, knife, vest, vest helmet, night vision.
164 forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price);
167 * Called when TerminateRound is called.
168 * Return Plugin_Continue to ignore, return Plugin_Changed to continue,
169 * using the given delay and reason, or return Plugin_Handled or a higher
170 * action to block TerminateRound from firing.
172 * @param delay Time (in seconds) until new round starts
173 * @param reason Reason for round end
175 forward Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason);
180 * @param client Player's index.
182 * @error Invalid client index, client not in game.
184 native CS_RespawnPlayer(client);
187 * Switches the player's team.
189 * @param client Player's index.
190 * @param team Team index.
192 * @error Invalid client index, client not in game.
194 native CS_SwitchTeam(client, team);
197 * Forces a player to drop or toss their weapon
199 * @param client Player's index.
200 * @param weaponIndex Index of weapon to drop.
201 * @param toss True to toss weapon (with velocity) or false to just drop weapon
202 * @param blockhook Set to true to stop the corresponding CS_OnCSWeaponDrop
205 * @error Invalid client index, client not in game, or invalid weapon index.
207 native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false);
210 * Forces round to end with a reason
212 * @param delay Time (in seconds) to delay before new round starts
213 * @param reason Reason for the round ending
214 * @param blockhook Set to true to stop the corresponding CS_OnTerminateRound
215 * forward from being called.
218 native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook = false);
221 * Gets a weapon name from a weapon alias
223 * @param alias Weapons alias to get weapon name for.
224 * @param weapon Buffer to store weapons name
225 * @param size Size of buffer to store the weapons name.
228 * @note Will set the buffer to the original alias if it is not an alias to a weapon.
230 native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size);
233 * Gets a weapon's price
235 * @param client Client to check weapon price for.
236 * @param id Weapon id for the weapon to check
237 * @param defaultprice Set to true to get defaultprice.
238 * @return Returns price of the weapon (even if modified)
240 * @error Invalid client, failing to get weapon info, or failing to get price offset.
241 * @note c4, knife and shield will always return 0. vest, vest helmet and night vision will always return default price.
243 native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false);
246 * Gets a clients clan tag
247 * @param client Client index to get clan tag for.
248 * @param buffer Buffer to store clients clan tag in.
249 * @param size Size of the buffer.
250 * @return Number of non-null bytes written.
252 * @error Invalid client.
254 native CS_GetClientClanTag(client, String:buffer[], size);
257 * Sets a clients clan tag
258 * @param client Client index to set clan tag for.
259 * @param tag Tag to set clients clan tag as.
262 * @error Invalid client.
264 native CS_SetClientClanTag(client, const String:tag[]);
267 * Gets a team's score
268 * @param team Team index to get score for.
269 * @return Returns the internal team score.
271 * @error Invalid team index.
273 native CS_GetTeamScore(team);
276 * Sets a team's score
277 * @param team Team index to set score for.
278 * @param value Value to set teams score as.
281 * @error Invalid team index.
282 * @note This will update the scoreboard only after the scoreboard update function is called. Use SetTeamScore plus this to update the scoreboard instantly and save values correctly.
284 native CS_SetTeamScore(team, value);
287 * Gets a client's mvp count
288 * @param client Client index to get mvp count of.
289 * @return Returns the client's internal MVP count.
291 * @error Invalid client.
293 native CS_GetMVPCount(client);
296 * Sets a client's mvp count
297 * @param client Client index to set mvp count for.
298 * @param value Value to set client's mvp count as.
301 * @error Invalid client.
303 native CS_SetMVPCount(client, value);
306 * Gets a client's contribution score (CS:GO only)
307 * @param client Client index to get score of.
308 * @return Returns the client's score.
310 * @error Invalid client.
312 native CS_GetClientContributionScore(client);
315 * Sets a client's contribution score (CS:GO only)
316 * @param client Client index to set score for.
317 * @param value Value to set client's score as.
320 * @error Invalid client.
322 native CS_SetClientContributionScore(client, value);
325 * Gets a client's assists (CS:GO only)
326 * @param client Client index to get assists of.
327 * @return Returns the client's assists.
329 * @error Invalid client.
331 native CS_GetClientAssists(client);
334 * Sets a client's assists (CS:GO only)
335 * @param client Client index to set assists for.
336 * @param value Value to set client's assists as.
339 * @error Invalid client.
341 native CS_SetClientAssists(client, value);
344 * Gets a weaponID from a alias
345 * @param alias Weapon alias to attempt to get an id for.
346 * @return Returns a weapon id or 0 if failed to find a match.
348 * @note For best results use CS_GetTranslatedWeaponAlias on the weapon name before passing it.
350 native CSWeaponID:CS_AliasToWeaponID(const String:alias[]);
353 * Gets a alias from a weaponID
354 * @param weaponID WeaponID to get alias for.
355 * @param destination Destination string to hold the weapon alias.
356 * @param len Length of the destination array.
357 * @return Returns number of cells written.
359 native CS_WeaponIDToAlias(weaponID, String:destination[], len);
362 * Do not edit below this line!
364 public Extension:__ext_cstrike =
367 file = "games/game.cstrike.ext",
369 #if defined REQUIRE_EXTENSIONS
376 #if !defined REQUIRE_EXTENSIONS
377 public __ext_cstrike_SetNTVOptional()
379 MarkNativeAsOptional("CS_RespawnPlayer");
380 MarkNativeAsOptional("CS_SwitchTeam");
381 MarkNativeAsOptional("CS_DropWeapon");
382 MarkNativeAsOptional("CS_TerminateRound");
383 MarkNativeAsOptional("CS_GetTranslatedWeaponAlias");
384 MarkNativeAsOptional("CS_GetWeaponPrice");
385 MarkNativeAsOptional("CS_GetClientClanTag");
386 MarkNativeAsOptional("CS_SetClientClanTag");
387 MarkNativeAsOptional("CS_GetTeamScore");
388 MarkNativeAsOptional("CS_SetTeamScore");
389 MarkNativeAsOptional("CS_GetMVPCount");
390 MarkNativeAsOptional("CS_SetMVPCount");
391 MarkNativeAsOptional("CS_GetClientContributionScore");
392 MarkNativeAsOptional("CS_SetClientContributionScore");
393 MarkNativeAsOptional("CS_GetClientAssists");
394 MarkNativeAsOptional("CS_SetClientAssists");
395 MarkNativeAsOptional("CS_AliasToWeaponID");