plugins/include/sdktools_functions.inc
author Nicholas Hastings <skamonkey@gmail.com>
Thu Apr 14 23:26:39 2011 -0400 (2011-04-14)
changeset 3249 4042a6d0e783
parent 2289 44045ead61cd
child 3280 7aea1316eff7
permissions -rw-r--r--
Triggering build.
dvander@954
     1
/**
dvander@954
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
ds@1947
     4
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
ds@1330
     5
 * =============================================================================
ds@1330
     6
 *
ds@1330
     7
 * This file is part of the SourceMod/SourcePawn SDK.
dvander@954
     8
 *
ds@1330
     9
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    11
 * Free Software Foundation.
ds@1330
    12
 * 
ds@1330
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    16
 * details.
dvander@954
    17
 *
ds@1330
    18
 * You should have received a copy of the GNU General Public License along with
ds@1330
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
ds@1330
    20
 *
ds@1330
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    28
 * or <http://www.sourcemod.net/license.php>.
ds@1330
    29
 *
ds@1330
    30
 * Version: $Id$
dvander@954
    31
 */
dvander@954
    32
dvander@954
    33
#if defined _sdktools_functions_included
dvander@954
    34
  #endinput
dvander@954
    35
#endif
dvander@954
    36
#define _sdktools_functions_included
dvander@954
    37
dvander@954
    38
/**
dvander@954
    39
 * Removes a player's item.
dvander@954
    40
 *
dvander@954
    41
 * @param client		Client index.
dvander@954
    42
 * @param item			CBaseCombatWeapon entity index.
dvander@954
    43
 * @return				True on success, false otherwise.
dvander@954
    44
 * @error				Invalid client or entity, lack of mod support, or client not in 
dvander@954
    45
 *						game.
dvander@954
    46
 */
dvander@954
    47
native bool:RemovePlayerItem(client, item);
dvander@954
    48
dvander@954
    49
/**
dvander@954
    50
 * Gives a named item to a player.
dvander@954
    51
 *
dvander@954
    52
 * @param client		Client index.
dvander@954
    53
 * @param item			Item classname (such as weapon_ak47).
dvander@954
    54
 * @param iSubType		Unknown.
dvander@954
    55
 * @return				Entity index on success, or -1 on failure.
dvander@954
    56
 * @error				Invalid client or client not in game, or lack of mod support.
dvander@954
    57
 */
dvander@954
    58
native GivePlayerItem(client, const String:item[], iSubType=0);
dvander@954
    59
dvander@954
    60
/**
dvander@954
    61
 * Returns the weapon in a player's slot.  
dvander@954
    62
 *
dvander@954
    63
 * @param client		Client index.
dvander@954
    64
 * @param slot			Slot index (mod specific).
dvander@954
    65
 * @return				Entity index on success, -1 if no weapon existed.
dvander@955
    66
 * @error				Invalid client or client not in game, or lack of mod support.
dvander@955
    67
 */
dvander@955
    68
native GetPlayerWeaponSlot(client, slot);
dvander@955
    69
dvander@955
    70
/**
dvander@980
    71
 * Ignites an entity on fire.
dvander@955
    72
 *
dvander@980
    73
 * @param entity		Entity index.
dvander@955
    74
 * @param time			Number of seconds to set on fire.
dvander@955
    75
 * @param npc			True to only affect NPCs.
dvander@955
    76
 * @param size			Unknown.
dvander@955
    77
 * @param level			Unknown.
dvander@955
    78
 * @noreturn
dvander@980
    79
 * @error				Invalid entity or client not in game, or lack of mod support.
dvander@954
    80
 */
dvander@980
    81
native IgniteEntity(entity, Float:time, bool:npc=false, Float:size=0.0, bool:level=false);
dvander@955
    82
dvander@955
    83
/**
dvander@955
    84
 * Extinguishes a player that is on fire.
dvander@955
    85
 *
dvander@980
    86
 * @param entity		Entity index.
dvander@955
    87
 * @noreturn
dvander@980
    88
 * @error				Invalid entity or client not in game, or lack of mod support.
dvander@955
    89
 */
dvander@980
    90
native ExtinguishEntity(client);
dvander@955
    91
dvander@955
    92
/**
dvander@980
    93
 * Teleports an entity.
dvander@955
    94
 *
dvander@980
    95
 * @param entity		Client index.
dvander@955
    96
 * @param origin		New origin, or NULL_VECTOR for no change.
dvander@955
    97
 * @param angles		New angles, or NULL_VECTOR for no change.
dvander@955
    98
 * @param velocity		New velocity, or NULL_VECTOR for no change.
dvander@955
    99
 * @noreturn
dvander@980
   100
 * @error				Invalid entity or client not in game, or lack of mod support.
dvander@980
   101
 */
dvander@980
   102
native TeleportEntity(entity, const Float:origin[3], const Float:angles[3], const Float:velocity[3]);
dvander@980
   103
dvander@980
   104
/**
dvander@1151
   105
 * Forces a player to commit suicide.
dvander@1151
   106
 *
dvander@1151
   107
 * @param client		Client index.
dvander@1151
   108
 * @noreturn
dvander@1169
   109
 * @error				Invalid client or client not in game, or lack of mod support.
dvander@1151
   110
 */
dvander@1151
   111
native ForcePlayerSuicide(client);
dvander@1151
   112
dvander@1151
   113
/**
dvander@1169
   114
 * Slaps a player in a random direction.
dvander@1169
   115
 *
dvander@1169
   116
 * @param client		Client index.
dvander@1169
   117
 * @param health		Health to subtract.
dvander@1169
   118
 * @param sound			False to disable the sound effects.
dvander@1169
   119
 * @noreturn
dvander@1169
   120
 * @error				Invalid client or client not in game, or lack of mod support.
dvander@1169
   121
 */
dvander@1169
   122
native SlapPlayer(client, health=5, bool:sound=true);
dvander@1169
   123
dvander@1169
   124
/**
ds@1240
   125
 * Searches for an entity by classname.
ds@1240
   126
 *
dvander@1918
   127
 * @param startEnt		The entity index after which to begin searching from.
ds@1240
   128
 *						Use -1 to start from the first entity.
ds@1240
   129
 * @param classname		Classname of the entity to find.
ds@1240
   130
 * @return				Entity index >= 0 if found, -1 otherwise.
ds@1240
   131
 * @error				Lack of mod support.
ds@1240
   132
 */
ds@1240
   133
native FindEntityByClassname(startEnt, const String:classname[]);
ds@1240
   134
ds@1240
   135
/**
faluco@1219
   136
 * Returns the client's eye angles.
faluco@1219
   137
 *
faluco@1219
   138
 * @param client		Player's index.
faluco@1219
   139
 * @param ang			Destination vector to store the client's eye angles.
dvander@1611
   140
 * @return				True on success, false on failure.
faluco@1219
   141
 * @error				Invalid client index, client not in game, or no mod support.
faluco@1219
   142
 */
dvander@1611
   143
native bool:GetClientEyeAngles(client, Float:ang[3]);
faluco@1219
   144
faluco@1219
   145
/**
faluco@1428
   146
 * Creates an entity by string name, but does not spawn it (see DispatchSpawn).
faluco@1428
   147
 * If ForceEdictIndex is not -1, then it will use the edict by that index. If the index is 
faluco@1428
   148
 *  invalid or there is already an edict using that index, it will error out.
faluco@1428
   149
 *
dvander@1611
   150
 * @param classname			Entity classname.
faluco@1428
   151
 * @param ForceEdictIndex	Edict index used by the created entity.
dvander@1611
   152
 * @return					Entity index on success, or -1 on failure.
dvander@1611
   153
 * @error					Invalid edict index, or no mod support.
faluco@1428
   154
 */
faluco@1428
   155
native CreateEntityByName(const String:classname[], ForceEdictIndex=-1);
faluco@1428
   156
faluco@1428
   157
/**
faluco@1428
   158
 * Spawns an entity into the game.
faluco@1428
   159
 *
faluco@1428
   160
 * @param entity		Entity index of the created entity.
dvander@1611
   161
 * @return				True on success, false otherwise.
dvander@1611
   162
 * @error				Invalid entity index, or no mod support.
faluco@1428
   163
 */
faluco@1428
   164
native bool:DispatchSpawn(entity);
faluco@1428
   165
faluco@1428
   166
/**
faluco@1504
   167
 * Dispatches a KeyValue into given entity using a string value.
faluco@1504
   168
 *
faluco@1504
   169
 * @param entity		Destination entity index.
faluco@1504
   170
 * @param keyName		Name of the key.
faluco@1504
   171
 * @param value			String value.
dvander@1611
   172
 * @return				True on success, false otherwise.
dvander@1611
   173
 * @error				Invalid entity index, or no mod support.
faluco@1504
   174
 */
faluco@1504
   175
native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[]);
faluco@1504
   176
faluco@1504
   177
/**
faluco@1504
   178
 * Dispatches a KeyValue into given entity using a floating point value.
faluco@1504
   179
 *
faluco@1504
   180
 * @param entity		Destination entity index.
faluco@1504
   181
 * @param keyName		Name of the key.
faluco@1504
   182
 * @param value			Floating point value.
dvander@1611
   183
 * @return				True on success, false otherwise.
dvander@1611
   184
 * @error				Invalid entity index, or no mod support.
faluco@1504
   185
 */
faluco@1504
   186
native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value);
faluco@1504
   187
faluco@1504
   188
/**
faluco@1504
   189
 * Dispatches a KeyValue into given entity using a vector value.
faluco@1504
   190
 *
faluco@1504
   191
 * @param entity		Destination entity index.
faluco@1504
   192
 * @param keyName		Name of the key.
faluco@1504
   193
 * @param vec			Vector value.
dvander@1611
   194
 * @return				True on success, false otherwise.
dvander@1611
   195
 * @error				Invalid entity index, or no mod support.
faluco@1504
   196
 */
faluco@1504
   197
native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:vector[3]);
faluco@1504
   198
faluco@1504
   199
/**
dvander@1611
   200
 * Returns the entity a client is aiming at.
dvander@1611
   201
 *
dvander@1611
   202
 * @param client		Client performing the aiming.
dvander@1611
   203
 * @param only_clients	True to exclude all entities but clients.
dvander@1611
   204
 * @return				Entity index being aimed at.
dvander@1611
   205
 *						-1 if no entity is being aimed at.
dvander@1611
   206
 * 						-2 if the function is not supported.
dvander@1612
   207
 * @error				Invalid client index or client not in game.
dvander@1611
   208
 */
dvander@1611
   209
native GetClientAimTarget(client, bool:only_clients=true);
dvander@1611
   210
dvander@1611
   211
/**
faluco@1613
   212
 * Returns the total number of teams in a game.
faluco@1993
   213
 * Note: This native should not be called before OnMapStart.
faluco@1613
   214
 *
faluco@1613
   215
 * @return				Total number of teams.
faluco@1613
   216
 */
faluco@1613
   217
native GetTeamCount();
faluco@1613
   218
faluco@1613
   219
/**
faluco@1613
   220
 * Retrieves the team name based on a team index.
faluco@1993
   221
 * Note: This native should not be called before OnMapStart.
faluco@1613
   222
 *
faluco@1613
   223
 * @param index				Team index.
faluco@1613
   224
 * @param name				Buffer to store string in.
faluco@1613
   225
 * @param maxlength			Maximum length of string buffer.
faluco@1613
   226
 * @noreturn
faluco@1613
   227
 * @error				Invalid team index.
faluco@1613
   228
 */
faluco@1613
   229
native GetTeamName(index, String:name[], maxlength);
faluco@1613
   230
faluco@1613
   231
/**
faluco@1613
   232
 * Returns the score of a team based on a team index.
faluco@1993
   233
 * Note: This native should not be called before OnMapStart.
faluco@1613
   234
 *
faluco@1613
   235
 * @param index				Team index.
faluco@1613
   236
 * @return				Score.
faluco@1613
   237
 * @error				Invalid team index.
faluco@1613
   238
 */
faluco@1613
   239
native GetTeamScore(index);
faluco@1613
   240
faluco@1613
   241
/**
faluco@1613
   242
 * Sets the score of a team based on a team index.
faluco@1993
   243
 * Note: This native should not be called before OnMapStart.
faluco@1613
   244
 *
faluco@1613
   245
 * @param index				Team index.
faluco@1615
   246
 * @param value				New score value.
faluco@1613
   247
 * @return				Score.
faluco@1613
   248
 * @error				Invalid team index.
faluco@1613
   249
 */
faluco@1615
   250
native SetTeamScore(index, value);
faluco@1613
   251
faluco@1613
   252
/**
faluco@1613
   253
 * Retrieves the number of players in a certain team.
faluco@1993
   254
 * Note: This native should not be called before OnMapStart.
faluco@1613
   255
 *
faluco@1613
   256
 * @param index				Team index.
faluco@1613
   257
 * @return				Number of players in the team.
faluco@1613
   258
 * @error				Invalid team index.
faluco@1613
   259
 */
faluco@1613
   260
native GetTeamClientCount(index);
faluco@1613
   261
faluco@1613
   262
/**
faluco@1720
   263
 * Sets the model to a given entity.
faluco@1720
   264
 *
faluco@1720
   265
 * @param entity			Entity index.
faluco@1720
   266
 * @param model				Model name.
faluco@1720
   267
 * @noreturn
faluco@1720
   268
 * @error				Invalid entity index, or no mod support.
faluco@1720
   269
 */
faluco@1720
   270
native SetEntityModel(entity, const String:model[]);
faluco@1720
   271
faluco@1720
   272
/**
faluco@1769
   273
 * Retrieves the decal file name associated to a given client.
faluco@1769
   274
 *
faluco@1769
   275
 * @param client			Player's index.
faluco@1769
   276
 * @param hex				Buffer to store the logo filename.
faluco@1769
   277
 * @param maxlength			Maximum length of string buffer.
faluco@1769
   278
 * @return				True on success, otherwise false.
faluco@1769
   279
 * @error				Invalid client or client not in game.
faluco@1769
   280
 */
faluco@1769
   281
native bool:GetPlayerDecalFile(client, String:hex[], maxlength);
faluco@1769
   282
faluco@1769
   283
/**
faluco@1769
   284
 * Returns the average server network traffic in bytes/sec.
faluco@1769
   285
 *
faluco@1769
   286
 * @param in				Buffer to store the input traffic velocity.
faluco@1769
   287
 * @param out				Buffer to store the output traffic velocity.
faluco@1769
   288
 * @noreturn
faluco@1769
   289
 */
faluco@1769
   290
native GetServerNetStats(&Float:in, &Float:out);
pred@1956
   291
pred@1956
   292
/**
pred@1956
   293
 * Equip's a player's weapon.
pred@1956
   294
 *
pred@1956
   295
 * @param client		Client index.
pred@1956
   296
 * @param item			CBaseCombatWeapon entity index.
pred@1956
   297
 * @noreturn
pred@1956
   298
 * @error				Invalid client or entity, lack of mod support, or client not in 
pred@1956
   299
 *						game.
pred@1956
   300
 */
pred@1956
   301
native EquipPlayerWeapon(client, weapon);
dvander@2007
   302
dvander@2007
   303
/**
dvander@2007
   304
 * Activates an entity (CBaseAnimating::Activate)
dvander@2007
   305
 *
dvander@2007
   306
 * @param entity		Entity index.
dvander@2007
   307
 * @noreturn
dvander@2007
   308
 * @error				Invalid entity or lack of mod support.
dvander@2007
   309
 */
dvander@2007
   310
native ActivateEntity(entity);
pred@2107
   311
pred@2107
   312
/**
pred@2107
   313
 * Sets values to client info buffer keys and notifies the engine of the change.
pred@2107
   314
 * The change does not get propogated to mods until the next frame.
pred@2107
   315
 *
pred@2107
   316
 * @param client		Player's index.
pred@2107
   317
 * @param key			Key string.
pred@2107
   318
 * @param value			Value string.
pred@2107
   319
 * @noreturn
pred@2107
   320
 * @error				Invalid client index, or client not connected.
pred@2107
   321
 */
pred@2107
   322
native SetClientInfo(client, const String:key[], const String:value[]);