3 * =============================================================================
4 * SourceMod (C)2004-2007 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 _sdktools_functions_included
36 #define _sdktools_functions_included
39 * Removes a player's item.
41 * @param client Client index.
42 * @param item CBaseCombatWeapon entity index.
43 * @return True on success, false otherwise.
44 * @error Invalid client or entity, lack of mod support, or client not in
47 native bool:RemovePlayerItem(client, item);
50 * Gives a named item to a player.
52 * @param client Client index.
53 * @param item Item classname (such as weapon_ak47).
54 * @param iSubType Unknown.
55 * @return Entity index on success, or -1 on failure.
56 * @error Invalid client or client not in game, or lack of mod support.
58 native GivePlayerItem(client, const String:item[], iSubType=0);
61 * Returns the weapon in a player's slot.
63 * @param client Client index.
64 * @param slot Slot index (mod specific).
65 * @return Entity index on success, -1 if no weapon existed.
66 * @error Invalid client or client not in game, or lack of mod support.
68 native GetPlayerWeaponSlot(client, slot);
71 * Ignites an entity on fire.
73 * @param entity Entity index.
74 * @param time Number of seconds to set on fire.
75 * @param npc True to only affect NPCs.
76 * @param size Unknown.
77 * @param level Unknown.
79 * @error Invalid entity or client not in game, or lack of mod support.
81 native IgniteEntity(entity, Float:time, bool:npc=false, Float:size=0.0, bool:level=false);
84 * Extinguishes a player that is on fire.
86 * @param entity Entity index.
88 * @error Invalid entity or client not in game, or lack of mod support.
90 native ExtinguishEntity(client);
93 * Teleports an entity.
95 * @param entity Client index.
96 * @param origin New origin, or NULL_VECTOR for no change.
97 * @param angles New angles, or NULL_VECTOR for no change.
98 * @param velocity New velocity, or NULL_VECTOR for no change.
100 * @error Invalid entity or client not in game, or lack of mod support.
102 native TeleportEntity(entity, const Float:origin[3], const Float:angles[3], const Float:velocity[3]);
105 * Forces a player to commit suicide.
107 * @param client Client index.
109 * @error Invalid client or client not in game, or lack of mod support.
111 native ForcePlayerSuicide(client);
114 * Slaps a player in a random direction.
116 * @param client Client index.
117 * @param health Health to subtract.
118 * @param sound False to disable the sound effects.
120 * @error Invalid client or client not in game, or lack of mod support.
122 native SlapPlayer(client, health=5, bool:sound=true);
125 * Searches for an entity by classname.
127 * @param startEnt The entity index to begin searching from.
128 * Use -1 to start from the first entity.
129 * @param classname Classname of the entity to find.
130 * @return Entity index >= 0 if found, -1 otherwise.
131 * @error Lack of mod support.
133 native FindEntityByClassname(startEnt, const String:classname[]);
136 * Returns the client's eye angles.
138 * @param client Player's index.
139 * @param ang Destination vector to store the client's eye angles.
140 * @return True on success, false on failure.
141 * @error Invalid client index, client not in game, or no mod support.
143 native bool:GetClientEyeAngles(client, Float:ang[3]);
146 * Returns if the client is alive or dead.
148 * @param client Player's index.
149 * @return True if the client is alive, false otherwise.
150 * @error Invalid client index, client not in game, or no mod support.
152 native bool:IsPlayerAlive(client);
155 * Creates an entity by string name, but does not spawn it (see DispatchSpawn).
156 * If ForceEdictIndex is not -1, then it will use the edict by that index. If the index is
157 * invalid or there is already an edict using that index, it will error out.
159 * @param classname Entity classname.
160 * @param ForceEdictIndex Edict index used by the created entity.
161 * @return Entity index on success, or -1 on failure.
162 * @error Invalid edict index, or no mod support.
164 native CreateEntityByName(const String:classname[], ForceEdictIndex=-1);
167 * Spawns an entity into the game.
169 * @param entity Entity index of the created entity.
170 * @return True on success, false otherwise.
171 * @error Invalid entity index, or no mod support.
173 native bool:DispatchSpawn(entity);
176 * Dispatches a KeyValue into given entity using a string value.
178 * @param entity Destination entity index.
179 * @param keyName Name of the key.
180 * @param value String value.
181 * @return True on success, false otherwise.
182 * @error Invalid entity index, or no mod support.
184 native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[]);
187 * Dispatches a KeyValue into given entity using a floating point value.
189 * @param entity Destination entity index.
190 * @param keyName Name of the key.
191 * @param value Floating point value.
192 * @return True on success, false otherwise.
193 * @error Invalid entity index, or no mod support.
195 native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value);
198 * Dispatches a KeyValue into given entity using a vector value.
200 * @param entity Destination entity index.
201 * @param keyName Name of the key.
202 * @param vec Vector value.
203 * @return True on success, false otherwise.
204 * @error Invalid entity index, or no mod support.
206 native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:vector[3]);
209 * Returns the entity a client is aiming at.
211 * @param client Client performing the aiming.
212 * @param only_clients True to exclude all entities but clients.
213 * @return Entity index being aimed at.
214 * -1 if no entity is being aimed at.
215 * -2 if the function is not supported.
216 * @error Invalid client index or client not in game.
218 native GetClientAimTarget(client, bool:only_clients=true);
221 * Returns the total number of teams in a game.
223 * @return Total number of teams.
225 native GetTeamCount();
228 * Retrieves the team name based on a team index.
230 * @param index Team index.
231 * @param name Buffer to store string in.
232 * @param maxlength Maximum length of string buffer.
234 * @error Invalid team index.
236 native GetTeamName(index, String:name[], maxlength);
239 * Returns the score of a team based on a team index.
241 * @param index Team index.
243 * @error Invalid team index.
245 native GetTeamScore(index);
248 * Sets the score of a team based on a team index.
250 * @param index Team index.
251 * @param value New score value.
253 * @error Invalid team index.
255 native SetTeamScore(index, value);
258 * Retrieves the number of players in a certain team.
260 * @param index Team index.
261 * @return Number of players in the team.
262 * @error Invalid team index.
264 native GetTeamClientCount(index);
269 #pragma deprecated Use IgniteEntity() instead
270 stock IgnitePlayer(client, Float:time, bool:npc=false, Float:size=0.0, bool:level=false)
272 return IgniteEntity(client, time, npc, size, level);
278 #pragma deprecated Use ExtinguishEntity() instead
279 stock ExtinguishClient(client)
281 return ExtinguishEntity(client);
287 #pragma deprecated Use TeleportEntity() instead
288 stock TeleportPlayer(client, const Float:origin[3], const Float:angles[3], const Float:velocity[3])
290 return TeleportEntity(client, origin, angles, velocity);