plugins/include/cstrike.inc
author Drifter <rgr_02@comcast.net>
Tue Jun 28 20:16:05 2011 -0400 (2011-06-28)
changeset 3322 d4c2b9f0e915
parent 3313 2ddc75e24c53
child 3324 e981678907dd
permissions -rw-r--r--
Added some small fixes for new CStrike patch (2ddc75e24c53) (bug 4732, 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@3313
    68
/**
rgr_02@3313
    69
 * Called when a player attempts to purchase an item.
rgr_02@3313
    70
 * Return Plugin_Continue to allow the purchase or return a
rgr_02@3313
    71
 * higher action to deny.
rgr_02@3313
    72
 *
rgr_02@3313
    73
 * @param client	Client index
rgr_02@3313
    74
 * @param weapon	User input for weapon name
rgr_02@3313
    75
 */
rgr_02@3313
    76
forward Action:CS_OnBuyCommand(client, const String:weapon[]);
rgr_02@3313
    77
rgr_02@3313
    78
/**
rgr_02@3313
    79
 * Called when CSWeaponDrop is called
rgr_02@3313
    80
 * Return Plugin_Continue to allow the call or return a
rgr_02@3313
    81
 * higher action to deny.
rgr_02@3313
    82
 *
rgr_02@3313
    83
 * @param client	Client index
rgr_02@3313
    84
 * @param weapon	Weapon index
rgr_02@3313
    85
 */
rgr_02@3313
    86
forward Action:CS_OnCSWeaponDrop(client, weaponIndex);
rgr_02@3313
    87
rgr_02@3313
    88
/**
rgr_02@3313
    89
 * Called when game retrieves a weapon's price for a player.
rgr_02@3313
    90
 * Return Plugin_Continue to use default value or return a higher
rgr_02@3313
    91
 * action to use a newly-set price.
rgr_02@3313
    92
 * 
rgr_02@3313
    93
 * @note This can be called multiple times per weapon purchase
rgr_02@3313
    94
 * 
rgr_02@3313
    95
 * @param client	Client index
rgr_02@3313
    96
 * @param weapon	Weapon classname
rgr_02@3313
    97
 * @param price		Buffer param for the price of the weapon
rgr_02@3322
    98
 *
rgr_02@3322
    99
 * @note			Not all "weapons" call GetWeaponPrice. Example: c4, knife, vest, vest helmet, night vision.
rgr_02@3313
   100
 */
rgr_02@3313
   101
forward Action:CS_OnGetWeaponPrice(client, const String:weapon[], &price);
rgr_02@3313
   102
rgr_02@3313
   103
/**
rgr_02@3313
   104
 * Called when TerminateRound is called.
rgr_02@3313
   105
 * Return Plugin_Continue to ignore, return Plugin_Changed to continue,
rgr_02@3313
   106
 * using the given delay and reason, or return Plugin_Handled or a higher
rgr_02@3313
   107
 * action to block TerminateRound from firing.
rgr_02@3313
   108
 *
rgr_02@3313
   109
 * @param delay		Time (in seconds) until new round starts
rgr_02@3313
   110
 * @param reason	Reason for round end
rgr_02@3313
   111
 */
rgr_02@3313
   112
forward Action:CS_OnTerminateRound(&Float:delay, &CSRoundEndReason:reason);
rgr_02@3313
   113
faluco@1441
   114
/**
faluco@1441
   115
 * Respawns a player.
faluco@1441
   116
 *
faluco@1441
   117
 * @param client		Player's index.
faluco@1441
   118
 * @noreturn
faluco@1441
   119
 * @error			Invalid client index, client not in game.
faluco@1441
   120
 */
faluco@1441
   121
native CS_RespawnPlayer(client);
faluco@1441
   122
faluco@1441
   123
/**
faluco@1441
   124
 * Switches the player's team.
faluco@1441
   125
 *
faluco@1441
   126
 * @param client		Player's index.
faluco@1441
   127
 * @param team			Team index.
faluco@1441
   128
 * @noreturn
faluco@1441
   129
 * @error			Invalid client index, client not in game.
faluco@1441
   130
 */
faluco@1441
   131
native CS_SwitchTeam(client, team);
faluco@1441
   132
faluco@1441
   133
/**
rgr_02@3313
   134
 * Forces a player to drop or toss their weapon
rgr_02@3313
   135
 *
rgr_02@3313
   136
 * @param client		Player's index.
rgr_02@3313
   137
 * @param weaponIndex	Index of weapon to drop.
rgr_02@3313
   138
 * @param toss			True to toss weapon (with velocity) or false to just drop weapon
rgr_02@3313
   139
 * @param blockhook		Set to true to stop the corresponding CS_OnCSWeaponDrop
rgr_02@3313
   140
 * 
rgr_02@3313
   141
 * @noreturn
rgr_02@3313
   142
 * @error				Invalid client index, client not in game, or invalid weapon index.
rgr_02@3313
   143
 */
rgr_02@3313
   144
native CS_DropWeapon(client, weaponIndex, bool:toss, bool:blockhook = false);
rgr_02@3313
   145
rgr_02@3313
   146
/**
rgr_02@3313
   147
 * Forces round to end with a reason
rgr_02@3313
   148
 *
rgr_02@3313
   149
 * @param delay			Time (in seconds) to delay before new round starts
rgr_02@3313
   150
 * @param reason		Reason for the round ending
rgr_02@3313
   151
 * @param blockhook		Set to true to stop the corresponding CS_OnTerminateRound
rgr_02@3313
   152
 *						forward from being called.
rgr_02@3313
   153
 * @noreturn
rgr_02@3313
   154
 */
rgr_02@3313
   155
 native CS_TerminateRound(Float:delay, CSRoundEndReason:reason, bool:blockhook = false);
rgr_02@3313
   156
 
rgr_02@3313
   157
 /**
rgr_02@3313
   158
 * Gets a weapon name from a weapon alias
rgr_02@3313
   159
 *
rgr_02@3313
   160
 * @param alias			Weapons alias to get weapon name for.
rgr_02@3313
   161
 * @param weapon		Buffer to store weapons name
rgr_02@3313
   162
 * @param size			Size of buffer to store the weapons name.
rgr_02@3313
   163
 * @noreturn
rgr_02@3313
   164
 *
rgr_02@3313
   165
 * @note				Will set the buffer to the original alias if it is not an alias to a weapon.
rgr_02@3313
   166
 */
rgr_02@3313
   167
 native CS_GetTranslatedWeaponAlias(const String:alias[], String:weapon[], size);
rgr_02@3313
   168
 
rgr_02@3313
   169
/**
faluco@1441
   170
 * Do not edit below this line!
faluco@1441
   171
 */
faluco@1441
   172
public Extension:__ext_cstrike = 
faluco@1441
   173
{
dvander@1573
   174
	name = "cstrike",
dvander@1459
   175
	file = "games/game.cstrike.ext",
faluco@1441
   176
	autoload = 0,
faluco@1441
   177
#if defined REQUIRE_EXTENSIONS
faluco@1441
   178
	required = 1,
faluco@1441
   179
#else
faluco@1441
   180
	required = 0,
faluco@1441
   181
#endif
dvander@1459
   182
};
dvander@1573
   183
dvander@1573
   184
#if !defined REQUIRE_EXTENSIONS
dvander@1573
   185
public __ext_cstrike_SetNTVOptional()
dvander@1573
   186
{
dvander@1573
   187
	MarkNativeAsOptional("CS_RespawnPlayer");
dvander@1573
   188
	MarkNativeAsOptional("CS_SwitchTeam");
rgr_02@3313
   189
	MarkNativeAsOptional("CS_DropWeapon");
rgr_02@3313
   190
	MarkNativeAsOptional("CS_TerminateRound");
rgr_02@3313
   191
	MarkNativeAsOptional("CS_GetTranslatedWeaponAlias");
dvander@1573
   192
}
dvander@1573
   193
#endif
rgr_02@3313
   194