plugins/include/cstrike.inc
author Asher Baker <asherkin@gmail.com>
Sun May 27 01:50:57 2012 +0100 (2012-05-27)
changeset 3507 d1b6fde18611
parent 3437 601c67fafa17
child 3519 a116c415c73e
permissions -rw-r--r--
Fixed error when reloading dependant plugins using aliased natives (bug 5302, r=psychonic).
faluco@1441
     1
/**
faluco@1441
     2
 * vim: set ts=4 :
faluco@1441
     3
 * =============================================================================
ds@1947
     4
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
faluco@1441
     5
 * =============================================================================
faluco@1441
     6
 *
faluco@1441
     7
 * This file is part of the SourceMod/SourcePawn SDK.
faluco@1441
     8
 *
faluco@1441
     9
 * This program is free software; you can redistribute it and/or modify it under
faluco@1441
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
faluco@1441
    11
 * Free Software Foundation.
faluco@1441
    12
 * 
faluco@1441
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
faluco@1441
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
faluco@1441
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
faluco@1441
    16
 * details.
faluco@1441
    17
 *
faluco@1441
    18
 * You should have received a copy of the GNU General Public License along with
faluco@1441
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
faluco@1441
    20
 *
faluco@1441
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
faluco@1441
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
faluco@1441
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
faluco@1441
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
faluco@1441
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
faluco@1441
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
faluco@1441
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
faluco@1441
    28
 * or <http://www.sourcemod.net/license.php>.
faluco@1441
    29
 *
faluco@1441
    30
 * Version: $Id$
faluco@1441
    31
 */
faluco@1441
    32
faluco@1441
    33
#if defined _cstrike_included
faluco@1441
    34
  #endinput
faluco@1441
    35
#endif
faluco@1441
    36
#define _cstrike_included
faluco@1441
    37
faluco@1441
    38
#define CS_TEAM_NONE		0	/**< No team yet. */
faluco@1441
    39
#define CS_TEAM_SPECTATOR	1	/**< Spectators. */
dvander@1459
    40
#define CS_TEAM_T 			2	/**< Terrorists. */
dvander@1459
    41
#define CS_TEAM_CT			3	/**< Counter-Terrorists. */
dvander@1459
    42
dvander@1459
    43
#define CS_SLOT_PRIMARY		0	/**< Primary weapon slot. */
dvander@1459
    44
#define CS_SLOT_SECONDARY	1	/**< Secondary weapon slot. */
dvander@1459
    45
#define CS_SLOT_GRENADE		3	/**< Grenade slot (will only return one grenade). */
dvander@1459
    46
#define CS_SLOT_C4			4	/**< C4 slot. */
faluco@1441
    47
rgr_02@3313
    48
enum CSRoundEndReason
rgr_02@3313
    49
{
rgr_02@3313
    50
	CSRoundEnd_TargetBombed = 0,           // Target Successfully Bombed!
rgr_02@3313
    51
	CSRoundEnd_VIPEscaped,                 // The VIP has escaped!
rgr_02@3313
    52
	CSRoundEnd_VIPKilled,                  // VIP has been assassinated!
rgr_02@3313
    53
	CSRoundEnd_TerroristsEscaped,          // The terrorists have escaped!
rgr_02@3313
    54
	CSRoundEnd_CTStoppedEscape,            // The CTs have prevented most of the terrorists from escaping!
rgr_02@3313
    55
	CSRoundEnd_TerroristsStopped,          // Escaping terrorists have all been neutralized!
rgr_02@3313
    56
	CSRoundEnd_BombDefused,                // The bomb has been defused!
rgr_02@3313
    57
	CSRoundEnd_CTWin,                      // Counter-Terrorists Win!
rgr_02@3313
    58
	CSRoundEnd_TerroristWin,               // Terrorists Win!
rgr_02@3313
    59
	CSRoundEnd_Draw,                       // Round Draw!
rgr_02@3313
    60
	CSRoundEnd_HostagesRescued,            // All Hostages have been rescued!
rgr_02@3313
    61
	CSRoundEnd_TargetSaved,                // Target has been saved!
rgr_02@3313
    62
	CSRoundEnd_HostagesNotRescued,         // Hostages have not been rescued!
rgr_02@3313
    63
	CSRoundEnd_TerroristsNotEscaped,       // Terrorists have not escaped!
rgr_02@3313
    64
	CSRoundEnd_VIPNotEscaped,              // VIP has not escaped!
rgr_02@3313
    65
	CSRoundEnd_GameStart                   // Game Commencing!
rgr_02@3313
    66
};
rgr_02@3313
    67
rgr_02@3324
    68
enum CSWeaponID
rgr_02@3324
    69
{
rgr_02@3324
    70
    CSWeapon_NONE,
rgr_02@3324
    71
    CSWeapon_P228,
rgr_02@3324
    72
    CSWeapon_GLOCK,
rgr_02@3324
    73
    CSWeapon_SCOUT,
rgr_02@3324
    74
    CSWeapon_HEGRENADE,
rgr_02@3324
    75
    CSWeapon_XM1014,
rgr_02@3324
    76
    CSWeapon_C4,
rgr_02@3324
    77
    CSWeapon_MAC10,
rgr_02@3324
    78
    CSWeapon_AUG,
rgr_02@3324
    79
    CSWeapon_SMOKEGRENADE,
rgr_02@3324
    80
    CSWeapon_ELITE,
rgr_02@3324
    81
    CSWeapon_FIVESEVEN,
rgr_02@3324
    82
    CSWeapon_UMP45,
rgr_02@3324
    83
    CSWeapon_SG550,
rgr_02@3324
    84
    CSWeapon_GALIL,
rgr_02@3324
    85
    CSWeapon_FAMAS,
rgr_02@3324
    86
    CSWeapon_USP,
rgr_02@3324
    87
    CSWeapon_AWP,
rgr_02@3324
    88
    CSWeapon_MP5NAVY,
rgr_02@3324
    89
    CSWeapon_M249,
rgr_02@3324
    90
    CSWeapon_M3,
rgr_02@3324
    91
    CSWeapon_M4A1,
rgr_02@3324
    92
    CSWeapon_TMP,
rgr_02@3324
    93
    CSWeapon_G3SG1,
rgr_02@3324
    94
    CSWeapon_FLASHBANG,
rgr_02@3324
    95
    CSWeapon_DEAGLE,
rgr_02@3324
    96
    CSWeapon_SG552,
rgr_02@3324
    97
    CSWeapon_AK47,
rgr_02@3324
    98
    CSWeapon_KNIFE,
rgr_02@3324
    99
    CSWeapon_P90,
rgr_02@3324
   100
    CSWeapon_SHIELD,
rgr_02@3324
   101
    CSWeapon_KEVLAR,
rgr_02@3324
   102
    CSWeapon_ASSAULTSUIT,
rgr_02@3324
   103
    CSWeapon_NIGHTVISION
rgr_02@3324
   104
};
rgr_02@3313
   105
/**
rgr_02@3313
   106
 * Called when a player attempts to purchase an item.
rgr_02@3313
   107
 * Return Plugin_Continue to allow the purchase or return a
rgr_02@3313
   108
 * higher action to deny.
rgr_02@3313
   109
 *
rgr_02@3313
   110
 * @param client	Client index
rgr_02@3313
   111
 * @param weapon	User input for weapon name
rgr_02@3313
   112
 */
rgr_02@3313
   113
forward Action:CS_OnBuyCommand(client, const String:weapon[]);
rgr_02@3313
   114
rgr_02@3313
   115
/**
rgr_02@3313
   116
 * Called when CSWeaponDrop is called
rgr_02@3313
   117
 * Return Plugin_Continue to allow the call or return a
rgr_02@3313
   118
 * higher action to deny.
rgr_02@3313
   119
 *
rgr_02@3313
   120
 * @param client	Client index
rgr_02@3313
   121
 * @param weapon	Weapon index
rgr_02@3313
   122
 */
rgr_02@3313
   123
forward Action:CS_OnCSWeaponDrop(client, weaponIndex);
rgr_02@3313
   124
rgr_02@3313
   125
/**
rgr_02@3313
   126
 * Called when game retrieves a weapon's price for a player.
rgr_02@3313
   127
 * Return Plugin_Continue to use default value or return a higher
rgr_02@3313
   128
 * action to use a newly-set price.
rgr_02@3313
   129
 * 
rgr_02@3313
   130
 * @note This can be called multiple times per weapon purchase
rgr_02@3313
   131
 * 
rgr_02@3313
   132
 * @param client	Client index
rgr_02@3313
   133
 * @param weapon	Weapon classname
rgr_02@3313
   134
 * @param price		Buffer param for the price of the weapon
rgr_02@3322
   135
 *
rgr_02@3322
   136
 * @note			Not all "weapons" call GetWeaponPrice. Example: c4, knife, vest, vest helmet, night vision.
rgr_02@3313
   137
 */
rgr_02@3313
   138
forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price);
rgr_02@3313
   139
rgr_02@3313
   140
/**
rgr_02@3313
   141
 * Called when TerminateRound is called.
rgr_02@3313
   142
 * Return Plugin_Continue to ignore, return Plugin_Changed to continue,
rgr_02@3313
   143
 * using the given delay and reason, or return Plugin_Handled or a higher
rgr_02@3313
   144
 * action to block TerminateRound from firing.
rgr_02@3313
   145
 *
rgr_02@3313
   146
 * @param delay		Time (in seconds) until new round starts
rgr_02@3313
   147
 * @param reason	Reason for round end
rgr_02@3313
   148
 */
rgr_02@3313
   149
forward Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason);
rgr_02@3313
   150
faluco@1441
   151
/**
faluco@1441
   152
 * Respawns a player.
faluco@1441
   153
 *
faluco@1441
   154
 * @param client		Player's index.
faluco@1441
   155
 * @noreturn
faluco@1441
   156
 * @error			Invalid client index, client not in game.
faluco@1441
   157
 */
faluco@1441
   158
native CS_RespawnPlayer(client);
faluco@1441
   159
faluco@1441
   160
/**
faluco@1441
   161
 * Switches the player's team.
faluco@1441
   162
 *
faluco@1441
   163
 * @param client		Player's index.
faluco@1441
   164
 * @param team			Team index.
faluco@1441
   165
 * @noreturn
faluco@1441
   166
 * @error			Invalid client index, client not in game.
faluco@1441
   167
 */
faluco@1441
   168
native CS_SwitchTeam(client, team);
faluco@1441
   169
faluco@1441
   170
/**
rgr_02@3313
   171
 * Forces a player to drop or toss their weapon
rgr_02@3313
   172
 *
rgr_02@3313
   173
 * @param client		Player's index.
rgr_02@3313
   174
 * @param weaponIndex	Index of weapon to drop.
rgr_02@3313
   175
 * @param toss			True to toss weapon (with velocity) or false to just drop weapon
rgr_02@3313
   176
 * @param blockhook		Set to true to stop the corresponding CS_OnCSWeaponDrop
rgr_02@3313
   177
 * 
rgr_02@3313
   178
 * @noreturn
rgr_02@3313
   179
 * @error				Invalid client index, client not in game, or invalid weapon index.
rgr_02@3313
   180
 */
rgr_02@3313
   181
native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false);
rgr_02@3313
   182
rgr_02@3313
   183
/**
rgr_02@3313
   184
 * Forces round to end with a reason
rgr_02@3313
   185
 *
rgr_02@3313
   186
 * @param delay			Time (in seconds) to delay before new round starts
rgr_02@3313
   187
 * @param reason		Reason for the round ending
rgr_02@3313
   188
 * @param blockhook		Set to true to stop the corresponding CS_OnTerminateRound
rgr_02@3313
   189
 *						forward from being called.
rgr_02@3313
   190
 * @noreturn
rgr_02@3313
   191
 */
skamonkey@3437
   192
native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook = false);
rgr_02@3313
   193
 
skamonkey@3405
   194
/**
rgr_02@3313
   195
 * Gets a weapon name from a weapon alias
rgr_02@3313
   196
 *
rgr_02@3313
   197
 * @param alias			Weapons alias to get weapon name for.
rgr_02@3313
   198
 * @param weapon		Buffer to store weapons name
rgr_02@3313
   199
 * @param size			Size of buffer to store the weapons name.
rgr_02@3313
   200
 * @noreturn
rgr_02@3313
   201
 *
rgr_02@3313
   202
 * @note				Will set the buffer to the original alias if it is not an alias to a weapon.
rgr_02@3313
   203
 */
skamonkey@3437
   204
native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size);
rgr_02@3313
   205
 
skamonkey@3405
   206
/**
rgr_02@3324
   207
 * Gets a weapon's price
rgr_02@3324
   208
 *
rgr_02@3324
   209
 * @param client		Client to check weapon price for.
rgr_02@3324
   210
 * @param id			Weapon id for the weapon to check
rgr_02@3324
   211
 * @param defaultprice	Set to true to get defaultprice.
rgr_02@3324
   212
 * @return				Returns price of the weapon (even if modified)
rgr_02@3324
   213
 *
rgr_02@3324
   214
 * @error				Invalid client, failing to get weapon info, or failing to get price offset.
rgr_02@3359
   215
 * @note				c4, knife and shield will always return 0. vest, vest helmet and night vision will always return default price.
rgr_02@3324
   216
 */
skamonkey@3437
   217
native CS_GetWeaponPrice(client, CSWeaponID:id, bool:defaultprice = false);
rgr_02@3324
   218
 
rgr_02@3313
   219
/**
skamonkey@3405
   220
 * Gets a clients clan tag
skamonkey@3405
   221
 * @param client		Client index to get clan tag for.
skamonkey@3405
   222
 * @param buffer		Buffer to store clients clan tag in.
skamonkey@3405
   223
 * @param size			Size of the buffer.
skamonkey@3405
   224
 * @return				Number of non-null bytes written.
skamonkey@3405
   225
 *
skamonkey@3405
   226
 * @error				Invalid client.
skamonkey@3405
   227
 */
skamonkey@3437
   228
native CS_GetClientClanTag(client, String:buffer[], size);
skamonkey@3405
   229
skamonkey@3405
   230
/**
skamonkey@3405
   231
 * Sets a clients clan tag
skamonkey@3405
   232
 * @param client		Client index to set clan tag for.
skamonkey@3405
   233
 * @param tag			Tag to set clients clan tag as.
skamonkey@3405
   234
 * @noreturn
skamonkey@3405
   235
 *
skamonkey@3405
   236
 * @error				Invalid client.
skamonkey@3405
   237
 */
skamonkey@3437
   238
native CS_SetClientClanTag(client, const String:tag[]);
skamonkey@3405
   239
 
skamonkey@3405
   240
/**
faluco@1441
   241
 * Do not edit below this line!
faluco@1441
   242
 */
faluco@1441
   243
public Extension:__ext_cstrike = 
faluco@1441
   244
{
dvander@1573
   245
	name = "cstrike",
dvander@1459
   246
	file = "games/game.cstrike.ext",
faluco@1441
   247
	autoload = 0,
faluco@1441
   248
#if defined REQUIRE_EXTENSIONS
faluco@1441
   249
	required = 1,
faluco@1441
   250
#else
faluco@1441
   251
	required = 0,
faluco@1441
   252
#endif
dvander@1459
   253
};
dvander@1573
   254
dvander@1573
   255
#if !defined REQUIRE_EXTENSIONS
dvander@1573
   256
public __ext_cstrike_SetNTVOptional()
dvander@1573
   257
{
dvander@1573
   258
	MarkNativeAsOptional("CS_RespawnPlayer");
dvander@1573
   259
	MarkNativeAsOptional("CS_SwitchTeam");
rgr_02@3313
   260
	MarkNativeAsOptional("CS_DropWeapon");
rgr_02@3313
   261
	MarkNativeAsOptional("CS_TerminateRound");
rgr_02@3313
   262
	MarkNativeAsOptional("CS_GetTranslatedWeaponAlias");
rgr_02@3324
   263
	MarkNativeAsOptional("CS_GetWeaponPrice");
skamonkey@3405
   264
	MarkNativeAsOptional("CS_GetClientClanTag");
skamonkey@3405
   265
	MarkNativeAsOptional("CS_SetClientClanTag");
dvander@1573
   266
}
dvander@1573
   267
#endif
rgr_02@3313
   268