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