Parent Directory | Revision Log
Revision 17 - (view) (download)
1 : | ian | 1 | /* NS module functions |
2 : | ian | 17 | * |
3 : | * by the AMX Mod X Development Team | ||
4 : | * | ||
5 : | ian | 1 | * This file is provided as is (no warranties). |
6 : | */ | ||
7 : | |||
8 : | #if defined NS_INC | ||
9 : | #endinput | ||
10 : | #endif | ||
11 : | #define NS_INC | ||
12 : | |||
13 : | #if AMXX_VERSION_NUM >= 175 | ||
14 : | #pragma reqlib ns | ||
15 : | #if !defined AMXMODX_NOAUTOLOAD | ||
16 : | #pragma loadlib ns | ||
17 : | #endif | ||
18 : | #else | ||
19 : | #pragma library ns | ||
20 : | #endif | ||
21 : | |||
22 : | |||
23 : | ian | 17 | |
24 : | ian | 1 | #include <ns_const> |
25 : | |||
26 : | |||
27 : | ian | 17 | /** |
28 : | * Called whenever the client's class is changed. | ||
29 : | * | ||
30 : | * @param id The index of the player who changed. | ||
31 : | * @param newclass The class the client changed to. Check the class enum in ns_const.inc. | ||
32 : | * @param oldclass The class the client changed from. Check the class enum in ns_const.inc. | ||
33 : | * @noreturn | ||
34 : | */ | ||
35 : | forward client_changeclass(id, newclass, oldclass); | ||
36 : | ian | 1 | |
37 : | ian | 17 | /** |
38 : | * Called whenever the client builds a structyure. | ||
39 : | * | ||
40 : | * @param idPlayer The player index who triggered the building. | ||
41 : | * @param idStructure The structure index that was created. | ||
42 : | * @param type The type of structure that was built (1 for marine, 2 for alien). | ||
43 : | * @param impulse The impulse command that was issued to build this structure. | ||
44 : | * @noreturn | ||
45 : | */ | ||
46 : | forward client_built(idPlayer, idStructure, type, impulse); | ||
47 : | ian | 1 | |
48 : | ian | 17 | /** |
49 : | * Tell whether or not the map is combat. | ||
50 : | * | ||
51 : | * @return 1 if combat, 0 otherwise. | ||
52 : | */ | ||
53 : | ian | 1 | native ns_is_combat(); |
54 : | |||
55 : | ian | 17 | /** |
56 : | * Returns the gameplay type for the currently active map. | ||
57 : | * Refer to ns_const.inc's NSGameplay enum for details. | ||
58 : | * | ||
59 : | * @note The earliest this is guaranteed to be accurate is during plugin_init(). It needs | ||
60 : | * the info_gameplay entity to be properly set within the map, or it will return "Unknown", | ||
61 : | * or "Cantfind". | ||
62 : | * | ||
63 : | * @return Return the gameplay mode, as accurate as the module can tell. | ||
64 : | */ | ||
65 : | native NSGameplay:ns_get_gameplay(); | ||
66 : | ian | 1 | |
67 : | ian | 17 | /** |
68 : | * Exact syntax as get_user_team, but should be more accurate. | ||
69 : | * | ||
70 : | * @param id Player id. | ||
71 : | * @param buff Buffer to store team name in. | ||
72 : | * @param len Buffer length. | ||
73 : | * @return The pev_team setting for the player. | ||
74 : | */ | ||
75 : | native ns_get_user_team(id, buff[], len); | ||
76 : | ian | 1 | |
77 : | ian | 17 | /** |
78 : | * Send an NS-style popup message. | ||
79 : | * | ||
80 : | * @param target The client to receive the message. Set to 0 to send to everybody. | ||
81 : | * @param szMsg The message to send, 180 characters max. | ||
82 : | * @param ah Whether to only display the message on clients who have the cvar "cl_autohelp" set to 1. | ||
83 : | * @noreturn | ||
84 : | */ | ||
85 : | native ns_popup(target, const szMsg[180], ah=0); | ||
86 : | ian | 1 | |
87 : | ian | 17 | /** |
88 : | * Sets a player model. Omit the second parameter to return to default | ||
89 : | * | ||
90 : | * @note The model does not revert on death, teamswitch, gestation, etc. | ||
91 : | * | ||
92 : | * @param id The player id to change. | ||
93 : | * @param szModel The model to change to. | ||
94 : | * @noreturn | ||
95 : | */ | ||
96 : | native ns_set_player_model(id, const szModel[]=""); | ||
97 : | ian | 1 | |
98 : | ian | 17 | /** |
99 : | * Sets a player skin. Omit the second parameter to return to default | ||
100 : | * | ||
101 : | * @note The skin does not revert on death, teamswitch, gestation, etc. | ||
102 : | * | ||
103 : | * @param id The player id to change. | ||
104 : | * @param skin The skin number to change to. | ||
105 : | * @noreturn | ||
106 : | */ | ||
107 : | native ns_set_player_skin(id, skin=-1); | ||
108 : | ian | 1 | |
109 : | ian | 17 | /** |
110 : | * Sets a player body. Omit the second parameter to return to default | ||
111 : | * | ||
112 : | * @note The body does not revert on death, teamswitch, gestation, etc. | ||
113 : | * | ||
114 : | * @param id The player id to change. | ||
115 : | * @param body The body number to change to. | ||
116 : | * @noreturn | ||
117 : | */ | ||
118 : | native ns_set_player_body(id, body=-1); | ||
119 : | |||
120 : | /** | ||
121 : | * Set this to modify the player's speed by a certain amount. | ||
122 : | * | ||
123 : | * @note The speed does not revert on death, teamswitch, gestation, etc. | ||
124 : | * | ||
125 : | * @param id The player id to change. | ||
126 : | * @param speedchange The speed to modify the player speed by. Set to 0 to revert to default speed. | ||
127 : | * @noreturn | ||
128 : | */ | ||
129 : | native ns_set_speedchange(id, speedchange=0); | ||
130 : | |||
131 : | /** | ||
132 : | * Returns a client's current speed modifier. | ||
133 : | * | ||
134 : | * @param id The client id to check. | ||
135 : | * @return The module's current speed modifier for the client. | ||
136 : | */ | ||
137 : | ian | 1 | native ns_get_speedchange(id); |
138 : | |||
139 : | ian | 17 | /** |
140 : | * Returns a client's maxspeed before the speed change modifier is factored in. | ||
141 : | * | ||
142 : | * @param id The client id to check. | ||
143 : | * @return The maxspeed for the client. | ||
144 : | */ | ||
145 : | ian | 1 | native ns_get_maxspeed(id); |
146 : | |||
147 : | /* Returns whether or not this mask is set from the entity's iuser4 field. Use the "mask" enum for reference. */ | ||
148 : | native ns_get_mask(id,mask); | ||
149 : | |||
150 : | /* Sets or removes the mask from the entity's iuser4 field. Set "value" to 1 to turn the mask on, 0 to turn it off. */ | ||
151 : | native ns_set_mask(id,mask,value); | ||
152 : | |||
153 : | /* Returns built/unbuilt structures. | ||
154 : | If: | ||
155 : | builtOnly is 1 (default): | ||
156 : | Only fully built structures are counted. | ||
157 : | builtOnly is 0: | ||
158 : | Any structure meeting the classname is counted. | ||
159 : | |||
160 : | Number is 0 (default): | ||
161 : | The total number of matching structures is returned. | ||
162 : | Number is any other value: | ||
163 : | The index of the #th matching structure is returned. | ||
164 : | */ | ||
165 : | native ns_get_build(const classname[],builtOnly=1,Number=0); | ||
166 : | |||
167 : | /* Returns if the player has the weapon or not in their pev->weapons field. | ||
168 : | set "setweapon" to 0 to turn the bit off, set to 1 to turn it on. Or omit it to just return the value. */ | ||
169 : | native ns_has_weapon(id,weapon,setweapon=-1); | ||
170 : | |||
171 : | /* Gets spawn point for specified team (type). | ||
172 : | If: | ||
173 : | Team is equal to 0: | ||
174 : | Ready room spawns are returned. | ||
175 : | Team is greater than 0: | ||
176 : | Spawns for the team are returned. | ||
177 : | |||
178 : | Number is equal to 0: | ||
179 : | Total number of spawns is returned. | ||
180 : | Number is greater than 0: | ||
181 : | The location of the specified spawn is returned. | ||
182 : | */ | ||
183 : | native ns_get_spawn(team,number=0,Float:ret[3]); | ||
184 : | |||
185 : | /* Returns the class of the player. Look in the classes enum in ns_const.inc for the value's meaning. */ | ||
186 : | native ns_get_class(id); | ||
187 : | |||
188 : | ian | 17 | /** |
189 : | * Gets the player's jetpack fuel reserve. | ||
190 : | * | ||
191 : | * @param id The player to get fuel from. | ||
192 : | * @return The amount of fuel in the player's reserve. (0.0 through 100.0) | ||
193 : | */ | ||
194 : | ian | 1 | native Float:ns_get_jpfuel(id); |
195 : | |||
196 : | ian | 17 | /** |
197 : | * Sets the player's jetpack fuel reserve. | ||
198 : | * | ||
199 : | * @param id The player to set fuel. | ||
200 : | * @param fuel The amount of fuel to set, as a percentage (0.0 through 100.0) | ||
201 : | * @noreturn | ||
202 : | */ | ||
203 : | native ns_set_jpfuel(id, Float:fuel); | ||
204 : | ian | 1 | |
205 : | ian | 17 | /** |
206 : | * Adds to the player's jetpack fuel reserve. | ||
207 : | * | ||
208 : | * @param id The player to add fuel to. | ||
209 : | * @param amount The amount of fuel to add, as a percentage (0.0 through 100.0) | ||
210 : | * @return The new amount of fuel in the player's reserve. (0.0 through 100.0) | ||
211 : | */ | ||
212 : | native Float:ns_add_jpfuel(id, Float:amount); | ||
213 : | |||
214 : | /** | ||
215 : | * Gets the player's energy percentage. | ||
216 : | * | ||
217 : | * @param id The player to get the energy from. | ||
218 : | * @return The amount of energy the player has (0.0 through 100.0) | ||
219 : | */ | ||
220 : | ian | 1 | native Float:ns_get_energy(id); |
221 : | |||
222 : | ian | 17 | /** |
223 : | * Sets the player's energy percentage. | ||
224 : | * | ||
225 : | * @param id The player to set the energy on. | ||
226 : | * @param energy The amount of energy to set (0.0 through 100.0) | ||
227 : | * @noreturn | ||
228 : | */ | ||
229 : | native ns_set_energy(id, Float:energy); | ||
230 : | ian | 1 | |
231 : | ian | 17 | /** |
232 : | * Adds to the player's energy percentage. | ||
233 : | * | ||
234 : | * @param id The player to add the energy to. | ||
235 : | * @param amount The amount of energy to add to the player. | ||
236 : | * @return The new amount of energy the player has (0.0 through 100.0) | ||
237 : | */ | ||
238 : | native Float:ns_add_energy(id, Float:amount); | ||
239 : | |||
240 : | |||
241 : | /** | ||
242 : | * Returns a player's resources. | ||
243 : | * | ||
244 : | * @note This is only for alien players. | ||
245 : | * @param id The id of the player to check. | ||
246 : | * @return Amount of resources this player has. | ||
247 : | */ | ||
248 : | ian | 1 | native Float:ns_get_res(id); |
249 : | |||
250 : | ian | 17 | /** |
251 : | * Sets a player's resources. | ||
252 : | * | ||
253 : | * @note This is only for alien players. | ||
254 : | * @param id The id of the player to set. | ||
255 : | * @param res Amount of resources to set on this player. | ||
256 : | * @noreturn | ||
257 : | */ | ||
258 : | native ns_set_res(id, Float:res); | ||
259 : | ian | 1 | |
260 : | ian | 17 | /** |
261 : | * Adds an amount of resources to the player. | ||
262 : | * | ||
263 : | * @note This is only for alien players. | ||
264 : | * @param id The id of the player to add resources to. | ||
265 : | * @param amount The amount to add to the player. | ||
266 : | * @return The new amount of resources the player has. | ||
267 : | */ | ||
268 : | native Float:ns_add_res(id, Float:amount); | ||
269 : | |||
270 : | /** | ||
271 : | * Returns the team's resources. | ||
272 : | * | ||
273 : | * @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines, | ||
274 : | 2 is aliens. In mvm, 1 is marine1, 2 is marine2) | ||
275 : | * @return The amount of resources in this team's resource pool. | ||
276 : | */ | ||
277 : | native Float:ns_get_teamres(Team); | ||
278 : | |||
279 : | /** | ||
280 : | * Sets the team's resources in the resource pool. | ||
281 : | * | ||
282 : | * @note If this is used on an alien team, the resources will be | ||
283 : | * distributed between all of the players who need resources. | ||
284 : | * @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines, | ||
285 : | * 2 is aliens. In mvm, 1 is marine1, 2 is marine2) | ||
286 : | * @param value The amount to set the resources to set to. | ||
287 : | * @noreturn | ||
288 : | */ | ||
289 : | native ns_set_teamres(Team, Float:value); | ||
290 : | |||
291 : | /** | ||
292 : | * Adds to the team's resources in the resource pool. | ||
293 : | * | ||
294 : | * @note If this is used on an alien team, the resources will be | ||
295 : | * distributed between all of the players who need resources. | ||
296 : | * @param Team 1 for teama, 2 for teamb. (eg: in MvA maps, 1 is marines, | ||
297 : | * 2 is aliens. In mvm, 1 is marine1, 2 is marine2) | ||
298 : | * @param value The amount to set the resources to add to the pool | ||
299 : | * @return The new amount of resources in the resource pool. | ||
300 : | */ | ||
301 : | native Float:ns_add_teamres(Team,Float:value); | ||
302 : | |||
303 : | |||
304 : | /** | ||
305 : | * Returns the player's experience. | ||
306 : | * | ||
307 : | * @note Combat only. | ||
308 : | * @param id The player to get experience value from. | ||
309 : | * @return The amount of experience this player has. | ||
310 : | */ | ||
311 : | ian | 1 | native Float:ns_get_exp(id); |
312 : | |||
313 : | ian | 17 | /** |
314 : | * Sets the player's experience. | ||
315 : | * | ||
316 : | * @note Combat only. | ||
317 : | * @param id The player to set experience value on. | ||
318 : | * @param exp The amount of experience this player will have. | ||
319 : | * @noreturn | ||
320 : | */ | ||
321 : | ian | 1 | native ns_set_exp(id,Float:exp); |
322 : | |||
323 : | ian | 17 | /** |
324 : | * Adds to the player's experience. | ||
325 : | * | ||
326 : | * @note Combat only. | ||
327 : | * @param id The player to add experience value to. | ||
328 : | * @param value The amount of experience this player will receive. | ||
329 : | * @return The new amount of experience this player has. | ||
330 : | */ | ||
331 : | native Float:ns_add_exp(id, Float:value); | ||
332 : | |||
333 : | /** | ||
334 : | * Gets the player's points spent count in combat. | ||
335 : | * | ||
336 : | * @param id The player to check. | ||
337 : | * @return The amount of points this player has spent. | ||
338 : | */ | ||
339 : | ian | 1 | native ns_get_points(id); |
340 : | |||
341 : | ian | 17 | /** |
342 : | * Sets the player's points spent count in combat. | ||
343 : | * | ||
344 : | * @param id The player to set this on. | ||
345 : | * @param points The amount to set this to. | ||
346 : | * @noreturn | ||
347 : | */ | ||
348 : | native ns_set_points(id, points); | ||
349 : | ian | 1 | |
350 : | ian | 17 | /** |
351 : | * Adds to the player's points spent count in combat. | ||
352 : | * | ||
353 : | * @param id The player to add this to. | ||
354 : | * @param value The value to add to the points spent. | ||
355 : | * @return The new value of the points spent variable. | ||
356 : | */ | ||
357 : | native ns_add_points(id,points); | ||
358 : | |||
359 : | /** | ||
360 : | * Gets the damage for this weapon. | ||
361 : | * | ||
362 : | * @note Use weapon index, not player index! | ||
363 : | * @param idWeapon The entity index of the weapon to check. | ||
364 : | * @return The damage this weapon does. | ||
365 : | */ | ||
366 : | ian | 1 | native Float:ns_get_weap_dmg(idWeapon); |
367 : | |||
368 : | ian | 17 | /** |
369 : | * Sets the damage for this weapon. | ||
370 : | * | ||
371 : | * @note Use weapon index, not player index! | ||
372 : | * @param idWeapon The entity index of the weapon to set. | ||
373 : | * @param damage The damage to make this weapon cause. | ||
374 : | * @noreturn | ||
375 : | */ | ||
376 : | native ns_set_weap_dmg(idWeapon, Float:damage); | ||
377 : | ian | 1 | |
378 : | ian | 17 | /** |
379 : | * Gets the maximum range for this weapon. | ||
380 : | * | ||
381 : | * @note Use weapon index, not player index! | ||
382 : | * @param idWeapon The entity index of the weapon to check. | ||
383 : | * @return The maximum range this weapon has. | ||
384 : | */ | ||
385 : | ian | 1 | native Float:ns_get_weap_range(idWeapon); |
386 : | |||
387 : | ian | 17 | /** |
388 : | * Sets the maximum range for this weapon. | ||
389 : | * | ||
390 : | * @note Use weapon index, not player index! | ||
391 : | * @param idWeapon The entity index of the weapon to set. | ||
392 : | * @param range The maximum range this weapon will have. | ||
393 : | * @noreturn | ||
394 : | */ | ||
395 : | native ns_set_weap_range(idWeapon, Float:range); | ||
396 : | ian | 1 | |
397 : | ian | 17 | /** |
398 : | * Gets the weapon's clip ammo. | ||
399 : | * | ||
400 : | * @note Use weapon index, not player index! | ||
401 : | * @param idWeapon The weapon to get the clip ammo from. | ||
402 : | * @return The amount of ammunition in the weapon's clip. | ||
403 : | */ | ||
404 : | ian | 1 | native ns_get_weap_clip(idWeapon); |
405 : | |||
406 : | ian | 17 | /** |
407 : | * Sets the weapon's ammo in the clip. | ||
408 : | * | ||
409 : | * @note Use weapon index, not player index! | ||
410 : | * @param idWeapon The weapon to set the clip ammo on. | ||
411 : | * @param clipsize The amount of ammunition to set in the weapon's clip. | ||
412 : | * @noreturn | ||
413 : | */ | ||
414 : | native ns_set_weap_clip(idWeapon, clipsize); | ||
415 : | ian | 1 | |
416 : | ian | 17 | /** |
417 : | * Gets the player's weapon reserve (backpack ammo) for the specified | ||
418 : | * type of weapon. | ||
419 : | * | ||
420 : | * @note Use player index, not weapon index! | ||
421 : | * @param id The player id to check ammo count on. | ||
422 : | * @param weapon The weapon type to check ammo count for. | ||
423 : | * @return The ammunition count in the player's reserve. | ||
424 : | */ | ||
425 : | ian | 1 | native ns_get_weap_reserve(id,weapon); |
426 : | |||
427 : | ian | 17 | /** |
428 : | * Sets the player's weapon reserve (backpack ammo) for the specified | ||
429 : | * type of weapon. | ||
430 : | * | ||
431 : | * @note Use player index, not weapon index! | ||
432 : | * @param id The player id to set ammo count on. | ||
433 : | * @param weapon The weapon type to set ammo count for. | ||
434 : | * @param ammo The ammunition count to set. | ||
435 : | * @noreturn | ||
436 : | */ | ||
437 : | ian | 1 | native ns_set_weap_reserve(id,weapon,ammo); |
438 : | |||
439 : | ian | 17 | /** |
440 : | * Gets the player's score. | ||
441 : | * | ||
442 : | * @note The score from level is automatically factored into the scoreboard in combat. | ||
443 : | * @param idPlayer The player to get the score for. | ||
444 : | * @return The player's score. | ||
445 : | */ | ||
446 : | ian | 1 | native ns_get_score(idPlayer); |
447 : | |||
448 : | ian | 17 | /** |
449 : | * Sets the player's score. | ||
450 : | * | ||
451 : | * @note The score from level is automatically factored into the scoreboard in combat. | ||
452 : | * @param idPlayer The player to get the score for. | ||
453 : | * @param score What to set the player's score as. | ||
454 : | * @noreturn | ||
455 : | */ | ||
456 : | native ns_set_score(idPlayer, score); | ||
457 : | ian | 1 | |
458 : | ian | 17 | /* Adds to a player's score |
459 : | * Returns the new score on success | ||
460 : | */ | ||
461 : | native ns_add_score(idPlayer,score); | ||
462 : | |||
463 : | ian | 1 | /* Gets a player's death count. */ |
464 : | native ns_get_deaths(idPlayer); | ||
465 : | |||
466 : | /* Sets a player's death count. */ | ||
467 : | native ns_set_deaths(idPlayer,numdeaths); | ||
468 : | |||
469 : | ian | 17 | /* Adds to a player's death count |
470 : | * Returns the new death count on success | ||
471 : | */ | ||
472 : | native ns_add_deaths(idPlayer,numdeaths); | ||
473 : | |||
474 : | ian | 1 | /* Gets the index of the owner of a structure. -1 for no owner. */ |
475 : | native ns_get_struct_owner(idStructsure); | ||
476 : | |||
477 : | /* Sets the index of the owner of a structure. -1 for no owner. */ | ||
478 : | native ns_set_struct_owner(idStructure,indexOwner); | ||
479 : | |||
480 : | /* Gets the trait type tied to the hive. Look at the hivetrait enum for the values. */ | ||
481 : | native ns_get_hive_trait(idHive); | ||
482 : | |||
483 : | /* Sets the trait type tied to the hive. Look at the hivetrait enum for the values. */ | ||
484 : | native ns_set_hive_trait(idHive,trait); | ||
485 : | |||
486 : | /* Sets the players field of view, set "_fov" to 0.0 (or omit it) to return to normal. FOV change will persist until disconnect unless reset by a plugin */ | ||
487 : | native ns_set_fov(idPlayer,Float:_fov=0.0); | ||
488 : | |||
489 : | ian | 17 | /** |
490 : | * Give the player an item. | ||
491 : | * | ||
492 : | * @param id The player to give the item to. | ||
493 : | * @param class The map-classname of the entity to give to the player. | ||
494 : | * @noreturn | ||
495 : | */ | ||
496 : | native ns_give_item(id, const class[]); | ||
497 : | ian | 1 | |
498 : | ian | 17 | /** |
499 : | * Returns 1 if a player has the hive ability number. | ||
500 : | * If ability is 0, it will return the number of active hives. | ||
501 : | * | ||
502 : | * @param idPlayer The player index to look up. | ||
503 : | * @param ability The ability number to check, set to 0 to get number of active hives. | ||
504 : | * @return If ability is != 0, returns 1 or 0 depending on if the client has the ability. | ||
505 : | * If ability is 0, returns the number of active hives. | ||
506 : | */ | ||
507 : | ian | 1 | native ns_get_hive_ability(idPlayer, ability=0); |
508 : | |||
509 : | ian | 17 | /** |
510 : | * Triggered whenever a client's pev->team changes. | ||
511 : | * | ||
512 : | * @param id The id of the client. | ||
513 : | * @param newteam The team number of the new team. | ||
514 : | * @param oldteam The team number of the old team. | ||
515 : | * @noreturn | ||
516 : | */ | ||
517 : | forward client_changeteam(id, newteam, oldteam); | ||
518 : | ian | 1 | |
519 : | ian | 17 | /** |
520 : | * Triggered whenever a client's pev->deadflag changes from >0 to 0. | ||
521 : | * | ||
522 : | * @param id The id of the client. | ||
523 : | * @noreturn | ||
524 : | */ | ||
525 : | forward client_spawn(id); | ||
526 : | |||
527 : | /** | ||
528 : | * Calls NS's private damage routine on the victim entity. | ||
529 : | * | ||
530 : | * @deprecated | ||
531 : | * @note This is provided for backwards compatibility with peachy's module. | ||
532 : | * It is suggested to use hamsandwich for this action instead. | ||
533 : | * | ||
534 : | * @param IDVictim The victim that is taking the damage. | ||
535 : | * @param IDInflictor The entity that is causing the damage (weapon, etc). | ||
536 : | * @param IDAttacker The attacker who is triggering the damage (person shooting). | ||
537 : | * @param Damage The amount of damage being done. | ||
538 : | * @param DamageType The damage type being done (bitmask). | ||
539 : | */ | ||
540 : | native ns_takedamage(IDVictim, IDInflictor, IDAttacker, Float:Damage, DamageType); | ||
541 : | |||
542 : | /** | ||
543 : | * Attempts to unstick a player. | ||
544 : | * | ||
545 : | * @param id Player to unstick. | ||
546 : | * @param StartDistance Distance to start from the player to check for a new location. | ||
547 : | * @param MaxAttempts How many attempts to try to find a new spot before giving up. | ||
548 : | * @return 1 on success, 0 on cannot find a place to move player to, | ||
549 : | * -1 on invalid state (stunned/webbed), -2 on invalid class (comm/egg) | ||
550 : | * -3 if the player is dead or a spectator, -4 on invalid player, | ||
551 : | * -5 if the player is not connected. | ||
552 : | */ | ||
553 : | native ns_unstick_player(id, StartDistance=32, MaxAttempts=128); | ||
554 : | |||
555 : | /** | ||
556 : | * Whether or not there is a game in progress. | ||
557 : | * | ||
558 : | * @return true if a game is in progress, false otherwise. | ||
559 : | */ | ||
560 : | native bool:ns_round_in_progress(); | ||
561 : | |||
562 : | /** | ||
563 : | * Called at the approximate time that a round is started. | ||
564 : | * | ||
565 : | * @noreturn | ||
566 : | */ | ||
567 : | forward round_start(); | ||
568 : | |||
569 : | /** | ||
570 : | * Called immediately when a round ends | ||
571 : | * | ||
572 : | * @param roundtime The length of the round in seconds. | ||
573 : | * @noreturn | ||
574 : | */ | ||
575 : | forward round_end(Float:roundtime); | ||
576 : | |||
577 : | forward map_reset(isload); | ||
578 : | |||
579 : | native ns_get_weapon(idPlayer,weaponid,&weapontype=0); | ||
580 : | |||
581 : | /* Returns the location name of the provided x/y position | ||
582 : | * (z origin is ignored; can't have location over location) | ||
583 : | * - | ||
584 : | * Note that as of NS 3.2 beta 2, on the following maps | ||
585 : | * the returned string should be passed through ns_lookup_title | ||
586 : | * to be human readable: | ||
587 : | * ns_bast, ns_hera, ns_nothing, ns_tanith, | ||
588 : | * ns_nancy, ns_caged, ns_eclipse, ns_veil | ||
589 : | * | ||
590 : | * Passing the 5th parameter as non zero will auto look up | ||
591 : | * the title if it exists. | ||
592 : | */ | ||
593 : | native ns_get_locationname(Float:x, Float:y, name[], len, titlelookup=0); | ||
594 : | |||
595 : | /* Looks up a key from titles.txt | ||
596 : | * Returns -1 if the key is not found | ||
597 : | * Otherwise it returns the length of the output | ||
598 : | */ | ||
599 : | native ns_lookup_title(const KeyName[], Output[], length); | ||
600 : | |||
601 : | /* Forces the structure to fully build | ||
602 : | * Removes the ghost state from marine structures. | ||
603 : | * Do not use this on hives! It wont work. | ||
604 : | */ | ||
605 : | native ns_build_structure(idStructure); | ||
606 : | |||
607 : | /* Forces the structure to begin recycling | ||
608 : | * Passing an index other than a marine structure will | ||
609 : | * have undefined results! | ||
610 : | * - | ||
611 : | * Note: This calls a private NS function! | ||
612 : | * Be careful when using this! | ||
613 : | */ | ||
614 : | native ns_recycle(idStructure); | ||
615 : | |||
616 : | /* Forces the weldable to trigger | ||
617 : | * Passing an index other than a weldable | ||
618 : | * will have undefined results! | ||
619 : | * - | ||
620 : | * NS renames func_weldable to avhweldable | ||
621 : | * at map load. | ||
622 : | * - | ||
623 : | * Note: This calls a private NS function! | ||
624 : | * Be careful when using this! | ||
625 : | */ | ||
626 : | native ns_finish_weldable(idWeldable); | ||
627 : | |||
628 : | /* Gets the total time needed to weld this | ||
629 : | * func_weldable shut. | ||
630 : | * Note: NS renames "func_weldable"s to "avhweldable"s | ||
631 : | * at run time! | ||
632 : | */ | ||
633 : | native Float:ns_get_weld_time(idWeldable); | ||
634 : | |||
635 : | /* Sets the total time needed to weld this | ||
636 : | * func_weldable shut. | ||
637 : | */ | ||
638 : | native ns_set_weld_time(idWeldable,Float:value); | ||
639 : | |||
640 : | /* Adds to the weldable's time required to open. | ||
641 : | * Returns the new required time on success. | ||
642 : | * Note this native clamps the low value to 0. | ||
643 : | */ | ||
644 : | native Float:ns_add_weld_time(idWeldable,Float:value); | ||
645 : | |||
646 : | /* Gets the total time this func_weldable | ||
647 : | * has been welded. | ||
648 : | */ | ||
649 : | native Float:ns_get_weld_done(idWeldable); | ||
650 : | |||
651 : | /* Sets the total time this func_weldable | ||
652 : | * has been welded. | ||
653 : | */ | ||
654 : | native ns_set_weld_done(idWeldable,Float:value); | ||
655 : | |||
656 : | /* Adds to the total time this func_weldable | ||
657 : | * has been welded. Returns the new value. | ||
658 : | * Note this native clamps the low value to 0.0 | ||
659 : | */ | ||
660 : | native Float:ns_add_weld_done(idWeldable,Float:value); | ||
661 : | |||
662 : | /* Gets/sets/adds to the energy pool of this observatory. */ | ||
663 : | native Float:ns_get_obs_energy(idObs); | ||
664 : | native ns_set_obs_energy(idObs,Float:value); | ||
665 : | native Float:ns_add_obs_energy(idObs,Float:value); | ||
666 : | /** | ||
667 : | * Particle system natives | ||
668 : | * - | ||
669 : | * The particle system emulates a map-based custom particle system. | ||
670 : | * Familiarity with the keyvalues from the map-based particle systems | ||
671 : | * is recommended! You will be lost otherwise! | ||
672 : | * - | ||
673 : | * prsearle's NSPEdit is also recommended for designing the systems: | ||
674 : | * http://homepage.ntlworld.com/pr.searle/NSPSEdit/NSPSEdit.html | ||
675 : | */ | ||
676 : | |||
677 : | /* Creates a handle to the a particle system to configure | ||
678 : | * - | ||
679 : | * Note! this is not a particle system you can pass to | ||
680 : | * ns_fire_ps()! | ||
681 : | */ | ||
682 : | native RawPS:ns_create_ps(); | ||
683 : | |||
684 : | /* Sets the name of the particle system. | ||
685 : | * - | ||
686 : | * This is used for things like ns_get_ps_id() | ||
687 : | * and through calling another particle system | ||
688 : | * through the "ps_to_gen" field | ||
689 : | */ | ||
690 : | native ns_set_ps_name(RawPS:system, const name[]); | ||
691 : | |||
692 : | /* Sets the sprite to use for the particle system | ||
693 : | * - | ||
694 : | * You do NOT have to precache the sprite, BUT | ||
695 : | * the sprite must obviously be on the client to | ||
696 : | * display. | ||
697 : | */ | ||
698 : | native ns_set_ps_sprite(RawPS:system, const sprite[]); | ||
699 : | |||
700 : | /* Finalizes the particle system. Do not configure it after this. | ||
701 : | * A usable particle system handle is returned. | ||
702 : | */ | ||
703 : | native Particle:ns_spawn_ps(RawPS:system); | ||
704 : | |||
705 : | /* Draws a particle system at the given origin (and angles) | ||
706 : | * Flags are the FEV_* defines from hlsdk_const.inc | ||
707 : | * Only use handles returned by ns_spawn_ps or ns_get_ps_id here! | ||
708 : | */ | ||
709 : | native ns_fire_ps(Particle:system,const Float:origin[3],const Float:angles[3]={0.0,0.0,0.0}, flags=0); | ||
710 : | |||
711 : | /* Looks up a particle system by name | ||
712 : | * Returns a usable particle system handle. | ||
713 : | */ | ||
714 : | native Particle:ns_get_ps_id(const Name[]); | ||
715 : | |||
716 : | /* The following are the parameters for configuring the | ||
717 : | * particle system. Look through the fgd and NSPSEdit | ||
718 : | * for details! | ||
719 : | */ | ||
720 : | native ns_set_ps_genrate(RawPS:system, genrate); | ||
721 : | native ns_set_ps_genshape(RawPS:system, NSPS_GenShape:genshape); | ||
722 : | native ns_set_ps_genshape_params(RawPS:system, const params[]); | ||
723 : | native ns_set_ps_spriteframes(RawPS:system, spriteframes); | ||
724 : | native ns_set_ps_numparticles(RawPS:system, numparticles); | ||
725 : | native ns_set_ps_size(RawPS:system, Float:size); | ||
726 : | native ns_set_ps_vel_params(RawPS:system, const params[]); | ||
727 : | native ns_set_ps_vel_shape(RawPS:system, NSPS_VelShape:shape); | ||
728 : | native ns_set_ps_sys_life(RawPS:system, Float:lifetime); | ||
729 : | native ns_set_ps_particle_life(RawPS:system, Float:lifetime); | ||
730 : | native ns_set_ps_rendermode(RawPS:system, NSPS_RenderMode:rendermode); | ||
731 : | native ns_set_ps_to_gen(RawPS:system, const name[]); | ||
732 : | native ns_set_ps_anim_speed(RawPS:system, speed); | ||
733 : | native ns_set_ps_spawn_flags(RawPS:system, NSPS_Flags:flags); | ||
734 : | native ns_set_ps_base_color(RawPS:system, const colors[]); | ||
735 : | native ns_set_ps_scale(RawPS:system, Float:scale); | ||
736 : | native ns_set_ps_max_alpha(RawPS:system, Float:maxalpha); |
Contact | ViewVC Help |
Powered by ViewVC 1.0.4 |