|
dvander@954
|
1 |
/** |
|
dvander@954
|
2 |
* vim: set ts=4 : |
|
ds@1330
|
3 |
* ============================================================================= |
|
dvander@954
|
4 |
* SourceMod (C)2004-2007 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 |
* |
|
ds@1240
|
127 |
* @param startEnt The entity index 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@1613
|
213 |
* |
|
faluco@1613
|
214 |
* @return Total number of teams. |
|
faluco@1613
|
215 |
*/ |
|
faluco@1613
|
216 |
native GetTeamCount(); |
|
faluco@1613
|
217 |
|
|
faluco@1613
|
218 |
/** |
|
faluco@1613
|
219 |
* Retrieves the team name based on a team index. |
|
faluco@1613
|
220 |
* |
|
faluco@1613
|
221 |
* @param index Team index. |
|
faluco@1613
|
222 |
* @param name Buffer to store string in. |
|
faluco@1613
|
223 |
* @param maxlength Maximum length of string buffer. |
|
faluco@1613
|
224 |
* @noreturn |
|
faluco@1613
|
225 |
* @error Invalid team index. |
|
faluco@1613
|
226 |
*/ |
|
faluco@1613
|
227 |
native GetTeamName(index, String:name[], maxlength); |
|
faluco@1613
|
228 |
|
|
faluco@1613
|
229 |
/** |
|
faluco@1613
|
230 |
* Returns the score of a team based on a team index. |
|
faluco@1613
|
231 |
* |
|
faluco@1613
|
232 |
* @param index Team index. |
|
faluco@1613
|
233 |
* @return Score. |
|
faluco@1613
|
234 |
* @error Invalid team index. |
|
faluco@1613
|
235 |
*/ |
|
faluco@1613
|
236 |
native GetTeamScore(index); |
|
faluco@1613
|
237 |
|
|
faluco@1613
|
238 |
/** |
|
faluco@1613
|
239 |
* Sets the score of a team based on a team index. |
|
faluco@1613
|
240 |
* |
|
faluco@1613
|
241 |
* @param index Team index. |
|
faluco@1615
|
242 |
* @param value New score value. |
|
faluco@1613
|
243 |
* @return Score. |
|
faluco@1613
|
244 |
* @error Invalid team index. |
|
faluco@1613
|
245 |
*/ |
|
faluco@1615
|
246 |
native SetTeamScore(index, value); |
|
faluco@1613
|
247 |
|
|
faluco@1613
|
248 |
/** |
|
faluco@1613
|
249 |
* Retrieves the number of players in a certain team. |
|
faluco@1613
|
250 |
* |
|
faluco@1613
|
251 |
* @param index Team index. |
|
faluco@1613
|
252 |
* @return Number of players in the team. |
|
faluco@1613
|
253 |
* @error Invalid team index. |
|
faluco@1613
|
254 |
*/ |
|
faluco@1613
|
255 |
native GetTeamClientCount(index); |
|
faluco@1613
|
256 |
|
|
faluco@1613
|
257 |
/** |
|
faluco@1720
|
258 |
* Sets the model to a given entity. |
|
faluco@1720
|
259 |
* |
|
faluco@1720
|
260 |
* @param entity Entity index. |
|
faluco@1720
|
261 |
* @param model Model name. |
|
faluco@1720
|
262 |
* @noreturn |
|
faluco@1720
|
263 |
* @error Invalid entity index, or no mod support. |
|
faluco@1720
|
264 |
*/ |
|
faluco@1720
|
265 |
native SetEntityModel(entity, const String:model[]); |
|
faluco@1720
|
266 |
|
|
faluco@1720
|
267 |
/** |
|
faluco@1769
|
268 |
* Retrieves the decal file name associated to a given client. |
|
faluco@1769
|
269 |
* |
|
faluco@1769
|
270 |
* @param client Player's index. |
|
faluco@1769
|
271 |
* @param hex Buffer to store the logo filename. |
|
faluco@1769
|
272 |
* @param maxlength Maximum length of string buffer. |
|
faluco@1769
|
273 |
* @return True on success, otherwise false. |
|
faluco@1769
|
274 |
* @error Invalid client or client not in game. |
|
faluco@1769
|
275 |
*/ |
|
faluco@1769
|
276 |
native bool:GetPlayerDecalFile(client, String:hex[], maxlength); |
|
faluco@1769
|
277 |
|
|
faluco@1769
|
278 |
/** |
|
faluco@1769
|
279 |
* Returns the average server network traffic in bytes/sec. |
|
faluco@1769
|
280 |
* |
|
faluco@1769
|
281 |
* @param in Buffer to store the input traffic velocity. |
|
faluco@1769
|
282 |
* @param out Buffer to store the output traffic velocity. |
|
faluco@1769
|
283 |
* @noreturn |
|
faluco@1769
|
284 |
*/ |
|
faluco@1769
|
285 |
native GetServerNetStats(&Float:in, &Float:out); |
|
faluco@1769
|
286 |
|
|
faluco@1769
|
287 |
/** |
|
dvander@980
|
288 |
* @deprecated |
|
dvander@955
|
289 |
*/ |
|
ds@1268
|
290 |
#pragma deprecated Use IgniteEntity() instead |
|
dvander@980
|
291 |
stock IgnitePlayer(client, Float:time, bool:npc=false, Float:size=0.0, bool:level=false) |
|
dvander@980
|
292 |
{ |
|
dvander@980
|
293 |
return IgniteEntity(client, time, npc, size, level); |
|
dvander@980
|
294 |
} |
|
dvander@980
|
295 |
|
|
dvander@980
|
296 |
/** |
|
dvander@980
|
297 |
* @deprecated |
|
dvander@980
|
298 |
*/ |
|
ds@1268
|
299 |
#pragma deprecated Use ExtinguishEntity() instead |
|
dvander@980
|
300 |
stock ExtinguishClient(client) |
|
dvander@980
|
301 |
{ |
|
dvander@980
|
302 |
return ExtinguishEntity(client); |
|
dvander@980
|
303 |
} |
|
dvander@980
|
304 |
|
|
dvander@980
|
305 |
/** |
|
dvander@980
|
306 |
* @deprecated |
|
dvander@980
|
307 |
*/ |
|
ds@1268
|
308 |
#pragma deprecated Use TeleportEntity() instead |
|
dvander@980
|
309 |
stock TeleportPlayer(client, const Float:origin[3], const Float:angles[3], const Float:velocity[3]) |
|
dvander@980
|
310 |
{ |
|
dvander@980
|
311 |
return TeleportEntity(client, origin, angles, velocity); |
|
dvander@980
|
312 |
} |