3 * =============================================================================
4 * SourceMod (C)2004-2008 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 after which 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 * Creates an entity by string name, but does not spawn it (see DispatchSpawn).
147 * If ForceEdictIndex is not -1, then it will use the edict by that index. If the index is
148 * invalid or there is already an edict using that index, it will error out.
150 * @param classname Entity classname.
151 * @param ForceEdictIndex Edict index used by the created entity.
152 * @return Entity index on success, or -1 on failure.
153 * @error Invalid edict index, or no mod support.
155 native CreateEntityByName(const String:classname[], ForceEdictIndex=-1);
158 * Spawns an entity into the game.
160 * @param entity Entity index of the created entity.
161 * @return True on success, false otherwise.
162 * @error Invalid entity index, or no mod support.
164 native bool:DispatchSpawn(entity);
167 * Dispatches a KeyValue into given entity using a string value.
169 * @param entity Destination entity index.
170 * @param keyName Name of the key.
171 * @param value String value.
172 * @return True on success, false otherwise.
173 * @error Invalid entity index, or no mod support.
175 native bool:DispatchKeyValue(entity, const String:keyName[], const String:value[]);
178 * Dispatches a KeyValue into given entity using a floating point value.
180 * @param entity Destination entity index.
181 * @param keyName Name of the key.
182 * @param value Floating point value.
183 * @return True on success, false otherwise.
184 * @error Invalid entity index, or no mod support.
186 native bool:DispatchKeyValueFloat(entity, const String:keyName[], Float:value);
189 * Dispatches a KeyValue into given entity using a vector value.
191 * @param entity Destination entity index.
192 * @param keyName Name of the key.
193 * @param vec Vector value.
194 * @return True on success, false otherwise.
195 * @error Invalid entity index, or no mod support.
197 native bool:DispatchKeyValueVector(entity, const String:keyName[], const Float:vector[3]);
200 * Returns the entity a client is aiming at.
202 * @param client Client performing the aiming.
203 * @param only_clients True to exclude all entities but clients.
204 * @return Entity index being aimed at.
205 * -1 if no entity is being aimed at.
206 * -2 if the function is not supported.
207 * @error Invalid client index or client not in game.
209 native GetClientAimTarget(client, bool:only_clients=true);
212 * Returns the total number of teams in a game.
213 * Note: This native should not be called before OnMapStart.
215 * @return Total number of teams.
217 native GetTeamCount();
220 * Retrieves the team name based on a team index.
221 * Note: This native should not be called before OnMapStart.
223 * @param index Team index.
224 * @param name Buffer to store string in.
225 * @param maxlength Maximum length of string buffer.
227 * @error Invalid team index.
229 native GetTeamName(index, String:name[], maxlength);
232 * Returns the score of a team based on a team index.
233 * Note: This native should not be called before OnMapStart.
235 * @param index Team index.
237 * @error Invalid team index.
239 native GetTeamScore(index);
242 * Sets the score of a team based on a team index.
243 * Note: This native should not be called before OnMapStart.
245 * @param index Team index.
246 * @param value New score value.
248 * @error Invalid team index.
250 native SetTeamScore(index, value);
253 * Retrieves the number of players in a certain team.
254 * Note: This native should not be called before OnMapStart.
256 * @param index Team index.
257 * @return Number of players in the team.
258 * @error Invalid team index.
260 native GetTeamClientCount(index);
263 * Sets the model to a given entity.
265 * @param entity Entity index.
266 * @param model Model name.
268 * @error Invalid entity index, or no mod support.
270 native SetEntityModel(entity, const String:model[]);
273 * Retrieves the decal file name associated to a given client.
275 * @param client Player's index.
276 * @param hex Buffer to store the logo filename.
277 * @param maxlength Maximum length of string buffer.
278 * @return True on success, otherwise false.
279 * @error Invalid client or client not in game.
281 native bool:GetPlayerDecalFile(client, String:hex[], maxlength);
284 * Returns the average server network traffic in bytes/sec.
286 * @param in Buffer to store the input traffic velocity.
287 * @param out Buffer to store the output traffic velocity.
290 native GetServerNetStats(&Float:in, &Float:out);
294 * Equip's a player's weapon.
296 * @param client Client index.
297 * @param item CBaseCombatWeapon entity index.
299 * @error Invalid client or entity, lack of mod support, or client not in
302 native EquipPlayerWeapon(client, weapon);