[Half-Life AMXX] / include / amxmodx.inc Repository:
ViewVC logotype

Annotation of /include/amxmodx.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : ian 1 /* AMX Mod X functions
2 :     *
3 :     * by the AMX Mod X Development Team
4 :     * originally developed by OLO
5 :     *
6 :     * This file is provided as is (no warranties).
7 :     */
8 :    
9 :     #if defined _amxmodx_included
10 :     #endinput
11 :     #endif
12 :     #define _amxmodx_included
13 :    
14 :     #include <core>
15 :     #include <float>
16 :     #include <amxconst>
17 :     #include <string>
18 :     #include <file>
19 :     #include <vault>
20 :     #include <lang>
21 :     #include <messages>
22 :     #include <vector>
23 :     #include <sorting>
24 :    
25 :     /* Function is called just after server activation.
26 :     * Good place for configuration loading, commands and cvars registration. */
27 :     forward plugin_init();
28 :    
29 :     /* Called when the plugin is paused. */
30 :     forward plugin_pause();
31 :    
32 :     /* Called when the plugin is unpaused. */
33 :     forward plugin_unpause();
34 :    
35 :     /* Called when the mod tries to change the map. */
36 :     forward server_changelevel(map[]);
37 :    
38 :     /* Function is called when all plugin_init from plugins
39 :     * were called, so all commmands and cvars should be already registered. */
40 :     forward plugin_cfg();
41 :    
42 :     /* Function called before plugin unloading (server deactivation) */
43 :     forward plugin_end();
44 :    
45 :     /* Called on log message. */
46 :     forward plugin_log();
47 :    
48 :     /* Use here model_precache() and sound_precache() functions. */
49 :     forward plugin_precache();
50 :    
51 :     /* Whenever player info is changed, this function is called. */
52 :     forward client_infochanged(id);
53 :    
54 :     /* Called on client connection. */
55 :     forward client_connect(id);
56 :    
57 :     /* Called when client gets valid STEAM id (usually
58 :     * between client_connect() and client_putinserver()). */
59 :     forward client_authorized(id);
60 :    
61 :     /* Called when client is disconnecting from server. */
62 :     forward client_disconnect(id);
63 :    
64 :     /* Called when client is sending command. */
65 :     forward client_command(id);
66 :    
67 :     /* Called when client is entering to a game. */
68 :     forward client_putinserver(id);
69 :    
70 :     /* Sets informations about plugin. Returns the plugin id of the calling plugin. */
71 :     native register_plugin(const plugin_name[],const version[],const author[]);
72 :    
73 :     /* Precache model. Can be used only in plugin_precache() function.*/
74 :     native precache_model(const name[]);
75 :    
76 :     /* Precache sound. Can be used only in plugin_precache() function.*/
77 :     native precache_sound(const name[]);
78 :    
79 :     /* Precaches any file. */
80 :     native precache_generic(const szFile[]);
81 :    
82 :     /* Sets info for player. */
83 :     native set_user_info(index,const info[],const value[]);
84 :    
85 :     /* Gets info from player. */
86 :     native get_user_info(index,const info[],output[],len);
87 :    
88 :     /* Sets info for server. */
89 :     native set_localinfo(const info[],const value[]);
90 :    
91 :     /* Gets info from server. */
92 :     native get_localinfo(const info[],output[],len);
93 :    
94 :     /* Shows text in MOTD window. When there is no header, the MOTD title
95 :     * will be the name of server. If message is filename, then a contents
96 :     * of this file will be displayed as MOTD. */
97 :     native show_motd(player,const message[],const header[]="");
98 :    
99 :     /* Sends message to player. Set index to 0 to send text globaly. */
100 :     native client_print(index,type,const message[],{Float,Sql,Result,_}:...);
101 :    
102 :     /* Sends message to player by engine. Set index to 0 to send text globaly. */
103 :     native engclient_print(player,type,const message[],{Float,Sql,Result,_}:...);
104 :    
105 :     /* Sends message to console. */
106 :     native console_print(id,const message[],{Float,Sql,Result,_}:...);
107 :    
108 :     /* Sends command to console. */
109 :     native console_cmd(id,const cmd[],{Float,Sql,Result,_}:...);
110 :    
111 :     /* Registers event on which a given function will be called
112 :     * Flags:
113 :     * "a" - global event.
114 :     * "b" - specified.
115 :     * "c" - send only once when repeated to other players.
116 :     * "d" - call if is send to dead player.
117 :     * "e" - to alive.
118 :     * Examples for conditions:
119 :     * "2=c4" - 2nd parameter of message must be sting "c4".
120 :     * "3>10" - 3rd parameter must be greater then 10.
121 :     * "3!4" - 3rd must be different from 4.
122 :     * "2&Buy" - 2nd parameter of message must contain "Buy" substring.
123 :     * "2!Buy" - 2nd parameter of message can't contain "Buy" substring. */
124 :     native register_event(const event[],const function[],const flags[],const cond[]="", ... );
125 :    
126 :     /* Registers log event on which the given function will be called
127 :     * Examples for conditions:
128 :     * "0=World triggered" "1=Game_Commencing"
129 :     * "1=say"
130 :     * "3=Terrorists_Win"
131 :     * "1=entered the game"
132 :     * "0=Server cvar"
133 :     */
134 :     native register_logevent(const function[], argsnum, ... );
135 :    
136 :     /**
137 :     * Sets format for hudmessage.
138 :     * Note - as of AMX Mod X 1.61, setting the channel to -1
139 :     * will automatically choose the next available HUD channel for a player.
140 :     */
141 :     native set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);
142 :    
143 :     /* Displays HUD message to given player. */
144 :     native show_hudmessage(index,const message[],{Float,Sql,Result,_}:...);
145 :    
146 :     /* Displays menu. Keys have bit values (key 1 is (1<<0), key 5 is (1<<4) etc.). */
147 :     native show_menu(index,keys,const menu[], time = -1, const title[] = "");
148 :    
149 :     /* Gets value from client messages.
150 :     * When you are asking for string the array and length is needed (read_data(2,name,len)).
151 :     * Integer is returned by function (new me = read_data(3)).
152 :     * Float is set in second parameter (read_data(3,value)). */
153 :     native read_data(value, {Float,Sql,Result,_}:... );
154 :    
155 :     /* Returns number of values in client message. */
156 :     native read_datanum();
157 :    
158 :     /* Gets log message. Can be called only in plugin_log() forward function. */
159 :     native read_logdata(output[],len);
160 :    
161 :     /* Returns number of log arguments.
162 :     * Can be called only in plugin_log() forward function. */
163 :     native read_logargc();
164 :    
165 :     /* Gets log argument indexed from 0.
166 :     * Can be called only in plugin_log() forward function. */
167 :     native read_logargv(id,output[],len);
168 :    
169 :     /* Parse log data about user ( "Butcher<5><BOT><TERRORIST>" etc. ). */
170 :     native parse_loguser(const text[], name[], nlen, &userid = -2, authid[] = "", alen = 0, team[]="", tlen=0);
171 :    
172 :     /* Prints message to server console.
173 :     * You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) */
174 :     native server_print(const message[], {Float,Sql,Result,_}:...);
175 :    
176 :     /* Returns 1 or 0. */
177 :     native is_map_valid(const mapname[]);
178 :    
179 :     /* Returns 1 or 0. */
180 :     native is_user_bot(index);
181 :    
182 :     /* Returns 1 or 0. */
183 :     native is_user_hltv(index);
184 :    
185 :     /* Returns 1 or 0. */
186 :     native is_user_connected(index);
187 :    
188 :     /* Returns 1 or 0. */
189 :     native is_user_connecting(index);
190 :    
191 :     /* Returns 1 or 0. */
192 :     native is_user_alive(index);
193 :    
194 :     /* Returns 1 or 0. */
195 :     native is_dedicated_server();
196 :    
197 :     /* Returns 1 or 0. */
198 :     native is_linux_server();
199 :    
200 :     /* Returns 1 or 0. */
201 :     native is_jit_enabled();
202 :    
203 :     /* Returns AMXX's version string of the current gameserver */
204 :     native get_amxx_verstring(buffer[], length);
205 :    
206 :     /* If player is not attacked function returns 0, in other
207 :     * case returns index of attacking player. On second and third
208 :     * parameter you may get info about weapon and body hit place.
209 :     * As of 1.75, get_user_attacker can return a non-player index if the player was attacked by a non-player entity.
210 :     */
211 :     native get_user_attacker(index,...);
212 :    
213 :     /* If player doesn't hit at anything function returns 0.0,
214 :     * in other case the distance between hit point and player is returned.
215 :     * If player is aiming at another player then the id and part of body are set. */
216 :     native Float:get_user_aiming(index,&id,&body,dist=9999);
217 :    
218 :     /* Returns player frags. */
219 :     native get_user_frags(index);
220 :    
221 :     /* Returns player armor. */
222 :     native get_user_armor(index);
223 :    
224 :     /* Returns player deaths. */
225 :     native get_user_deaths(index);
226 :    
227 :     /* Returns player health. */
228 :     native get_user_health(index);
229 :    
230 :     /* Returns index. */
231 :     native get_user_index(const name[]);
232 :    
233 :     /* Returns ip. */
234 :     native get_user_ip(index,ip[],len, without_port = 0);
235 :    
236 :     /* Returns if the player has the weapon or not in their pev->weapons field.
237 :     set "setweapon" to 0 to turn the bit off, set to 1 to turn it on. */
238 :     native user_has_weapon(index,weapon,setweapon=-1);
239 :    
240 :     /* Returns id of currently carried weapon. Gets also
241 :     * ammount of ammo in clip and backpack. */
242 :     native get_user_weapon(index,&clip,&ammo);
243 :    
244 :     /* Gets ammo and clip from current weapon. */
245 :     native get_user_ammo(index,weapon,&clip,&ammo);
246 :    
247 :     /* Converts numbers from range 0 - 999 to words. */
248 :     native num_to_word(num,output[],len);
249 :    
250 :     /* Returns team id. When length is greater then 0
251 :     * then a name of team is set. */
252 :     native get_user_team(index, team[]="", len = 0);
253 :    
254 :     /* Returns player playing time in seconds.
255 :     * If flag is set then result is without connection time. */
256 :     native get_user_time(index, flag = 0);
257 :    
258 :     /* Gets ping and loss at current time. */
259 :     native get_user_ping(index, &ping, &loss);
260 :    
261 :     /* Gets origin from player.
262 :     * Modes:
263 :     * 0 - current position.
264 :     * 1 - position from eyes (weapon aiming).
265 :     * 2 - end position from player position.
266 :     * 3 - end position from eyes (hit point for weapon).
267 :     * 4 - position of last bullet hit (only CS). */
268 :     native get_user_origin(index, origin[3], mode = 0);
269 :    
270 :     /* Returns all carried weapons as bit sum. Gets
271 :     * also theirs indexes.
272 :     * Note that num is incremental - if you pass 0, you get
273 :     * 32 weapons towards the total. Afterwards, num will
274 :     * will contain the number of weapons retrieved.
275 :     * However, subsequent calls to get_user_weapons() will
276 :     * return the next batch of weapons, in case the mod
277 :     * supports more than 32 weapons.
278 :     * This means to call get_user_weapons() on the same
279 :     * inputs twice, you must reset num to 0 to get the
280 :     * original output again.
281 :     */
282 :     native get_user_weapons(index,weapons[32],&num);
283 :    
284 :     /* Returns weapon name. */
285 :     native get_weaponname(id,weapon[],len);
286 :    
287 :     /* Returns player name. */
288 :     native get_user_name(index,name[],len);
289 :    
290 :     /* Gets player authid. */
291 :     native get_user_authid(index, authid[] ,len);
292 :    
293 :     /* Returns player userid. */
294 :     native get_user_userid(index);
295 :    
296 :     /* Slaps player with given power. */
297 :     native user_slap(index,power,rnddir=1);
298 :    
299 :     /* Kills player. When flag is set to 1 then death won't decrase frags. */
300 :     native user_kill(index,flag=0);
301 :    
302 :     /* Logs something into the current amx logfile
303 :     * Parameters:
304 :     * string[] - format string
305 :     * ... - optional parameters
306 :     * Return value:
307 :     * always 0 */
308 :     native log_amx(const string[], {Float,Sql,Result,_}:...);
309 :    
310 :     /* Sends message to standard HL logs. */
311 :     native log_message(const message[],{Float,Sql,Result,_}:...);
312 :    
313 :     /* Sends log message to specified file. */
314 :     native log_to_file(const file[],const message[],{Float,Sql,Result,_}:...);
315 :    
316 :     /* Returns number of players put in server.
317 :     * If flag is set then also connecting are counted. */
318 :     native get_playersnum(flag=0);
319 :    
320 :     /* Sets indexes of players.
321 :     * Flags:
322 :     * "a" - don't collect dead players.
323 :     * "b" - don't collect alive players.
324 :     * "c" - skip bots.
325 :     * "d" - skip real players.
326 :     * "e" - match with team.
327 :     * "f" - match with part of name.
328 :     * "g" - ignore case sensitivity.
329 :     * "h" - skip HLTV.
330 :     * Example: Get all alive CTs: get_players(players,num,"ae","CT") */
331 :     native get_players(players[32], &num ,const flags[]="", const team[]="");
332 :    
333 :     /* Gets argument from command. */
334 :     native read_argv(id,output[],len);
335 :    
336 :     /* Gets line of all arguments. */
337 :     native read_args(output[],len);
338 :    
339 :     /* Returns number of arguments (+ one as command). */
340 :     native read_argc();
341 :    
342 :     /* Converts string to sum of bits.
343 :     * Example: "abcd" is a sum of 1, 2, 4 and 8. */
344 :     native read_flags(const flags[]);
345 :    
346 :     /* Converts sum of bits to string.
347 :     * Example: 3 will return "ab". */
348 :     native get_flags(flags,output[],len);
349 :    
350 :     /* Find player.
351 :     * Flags:
352 :     * "a" - with given name.
353 :     * "b" - with given part of name.
354 :     * "c" - with given authid.
355 :     * "d" - with given ip.
356 :     * "e" - with given team name.
357 :     * "f" - don't look in dead players.
358 :     * "g" - don't look in alive players.
359 :     * "h" - skip bots.
360 :     * "i" - skip real players.
361 :     * "j" - return index of last found player.
362 :     * "k" - with given userid.
363 :     * "l" - ignore case sensitivity. */
364 :     native find_player(const flags[], ... );
365 :    
366 :     /* Removes quotes from sentence. */
367 :     native remove_quotes(text[]);
368 :    
369 :     /* Executes command on player. */
370 :     native client_cmd(index,const command[],{Float,Sql,Result,_}:...);
371 :    
372 :     /* This is an emulation of a client command (commands aren't send to client!).
373 :     * It allows to execute some commands on players and bots.
374 :     * Function is excellent for forcing to do an action related to a game (not settings!).
375 :     * The command must stand alone but in arguments you can use spaces. */
376 :     native engclient_cmd(index,const command[],const arg1[]="",const arg2[]="");
377 :    
378 :     /* Executes command on a server console. */
379 :     native server_cmd(const command[],{Float,Sql,Result,_}:...);
380 :    
381 :     /* Sets a cvar to given value. */
382 :     native set_cvar_string(const cvar[],const value[]);
383 :    
384 :     /* If a cvar exists returns 1, in other case 0 */
385 :     native cvar_exists(const cvar[]);
386 :    
387 :     /* Removes a cvar flags (not allowed for amx_version,
388 :     * fun_version and sv_cheats cvars). */
389 :     native remove_cvar_flags(const cvar[],flags = -1);
390 :    
391 :     /* Sets a cvar flags (not allowed for amx_version,
392 :     * fun_version and sv_cheats cvars). */
393 :     native set_cvar_flags(const cvar[],flags);
394 :    
395 :     /* Returns a cvar flags. */
396 :     native get_cvar_flags(const cvar[]);
397 :    
398 :     /* Sets a cvar to given float. */
399 :     native set_cvar_float(const cvar[],Float:value);
400 :    
401 :     /* Gets a cvar float. */
402 :     native Float:get_cvar_float(const cvarname[]);
403 :    
404 :     /* Gets a cvar integer value. */
405 :     native get_cvar_num(const cvarname[]);
406 :    
407 :     /* Sets a cvar with integer value. */
408 :     native set_cvar_num(const cvarname[],value);
409 :    
410 :     /* Reads a cvar value. */
411 :     native get_cvar_string(const cvarname[],output[],iLen);
412 :    
413 :     /* Returns a name of currently played map. */
414 :     native get_mapname(name[],len);
415 :    
416 :     /* Returns time remaining on map in seconds. */
417 :     native get_timeleft();
418 :    
419 :     /* Returns a game time. */
420 :     native Float:get_gametime();
421 :    
422 :     /* Returns maxplayers setting. */
423 :     native get_maxplayers();
424 :    
425 :     /* Returns a name of currently played mod. */
426 :     native get_modname(name[],len);
427 :    
428 :     /* Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S". */
429 :     native get_time(const format[],output[],len);
430 :    
431 :     /* Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S".
432 :     * Last parameter sets time to format. */
433 :     native format_time(output[],len, const format[],time = -1);
434 :    
435 :     /* Returns system time in seconds elapsed since 00:00:00 on January 1, 1970.
436 :     * Offset is given in seconds.*/
437 :     native get_systime(offset = 0);
438 :    
439 :     /* Returns time in input and additionaly fills missing information
440 :     * with current time and date. If time is different than -1 then parsed
441 :     * time is added to given time.
442 :     * Example:
443 :     * parset_time( "10:32:54 04/02/2003", "%H:%M:%S %m:%d:%Y" )
444 :     * For more information see strptime(...) function from C libraries. */
445 :     native parse_time(const input[],const format[], time = -1);
446 :    
447 :     /* Calls function on specified time.
448 :     * Flags:
449 :     * "a" - repeat.
450 :     * "b" - loop task.
451 :     * "c" - do task on time after a map timeleft.
452 :     * "d" - do task on time before a map timelimit. */
453 :     native set_task(Float:time,const function[],id = 0,const parameter[]="",len = 0,const flags[]="", repeat = 0);
454 :    
455 :     /* Removes all tasks with given id. If outside var is
456 :     * set then a task can be removed also when
457 :     * was set in another plugin. */
458 :     native remove_task(id = 0, outside = 0);
459 :    
460 :     /* Changes the time of a task */
461 :     native change_task(id = 0, Float:newTime=1.0, outside = 0);
462 :    
463 :     /* Returns 1 if task under given id exists. */
464 :     native task_exists(id = 0, outside = 0);
465 :    
466 :     /* Sets flags for player. Set flags to -1 if you want to clear all flags.
467 :     * You can use different settings by changing the id, which is from range 0 - 31. */
468 :     native set_user_flags(index,flags=-1,id=0);
469 :    
470 :     /* Gets flags from player. Set index to 0 if you want to read flags from server. */
471 :     native get_user_flags(index,id=0);
472 :    
473 :     /* Removes flags for player. */
474 :     native remove_user_flags(index,flags=-1,id=0);
475 :    
476 :     /* Registers function which will be called from client console.
477 :     * Returns the command ID.
478 :     */
479 :     native register_clcmd(const client_cmd[],const function[],flags=-1, const info[]="");
480 :    
481 :     /* Registers function which will be called from any console.
482 :     * Returns the command ID.
483 :     */
484 :     native register_concmd(const cmd[],const function[],flags=-1, const info[]="");
485 :    
486 :     /* Registers function which will be called from server console.
487 :     * Returns the command ID.
488 :     */
489 :     native register_srvcmd(const server_cmd[],const function[],flags=-1, const info[]="");
490 :    
491 :     /* Gets info about client command. */
492 :     native get_clcmd(index, command[], len1, &flags, info[], len2, flag);
493 :    
494 :     /* Returns number of registered client commands. */
495 :     native get_clcmdsnum(flag);
496 :    
497 :     /* Gets info about server command. */
498 :     native get_srvcmd(index,server_cmd[],len1,&flags, info[],len2, flag);
499 :    
500 :     /* Returns number of registered server commands. */
501 :     native get_srvcmdsnum(flag);
502 :    
503 :     /* Gets info about console command. If id is set to 0,
504 :     then function returns only server cmds, if positive then
505 :     returns only client cmds. in other case returns all console commands. */
506 :     native get_concmd(index,cmd[],len1,&flags, info[],len2, flag, id = -1);
507 :    
508 :     /* Gets the parent plugin id of a console command. */
509 :     native get_concmd_plid(cid, flag_mask, id_type);
510 :    
511 :     /* Returns number of registered console commands. */
512 :     native get_concmdsnum(flag,id = -1);
513 :    
514 :     /* Returns the number of plugin-registered cvars. */
515 :     native get_plugins_cvarsnum();
516 :    
517 :     /* Returns information about a plugin-registered cvar. */
518 :     native get_plugins_cvar(num, name[], namelen, &flags=0, &plugin_id=0, &pcvar_handle=0);
519 :    
520 :     /* Gets unique id of menu. Outside set to 1 allows
521 :     * to catch menus outside a plugin where register_menuid is called. */
522 :     native register_menuid(const menu[], outside=0 );
523 :    
524 :     /* Calls function when player uses specified menu and proper keys. */
525 :     native register_menucmd(menuid,keys, const function[] );
526 :    
527 :     /* Gets what menu the player is watching and what keys for menu he have.
528 :     * When there is no menu the index is 0. If the id is negative then the menu
529 :     * is VGUI in other case the id is from register_menuid() function. */
530 :     native get_user_menu(index,&id,&keys);
531 :    
532 :     /* Forces server to execute sent server command at current time.
533 :     * Very useful for map changes, setting cvars and other activities. */
534 :     native server_exec();
535 :    
536 :     /* Emits sound. Sample must be precached. */
537 :     native emit_sound(index, channel, const sample[], Float:vol, Float:att,flags, pitch);
538 :    
539 :     /* Registers new cvar for HL engine.
540 :     * Returns the cvar pointer for get/set_pcvar functions.
541 :     */
542 :     native register_cvar(const name[],const string[],flags = 0,Float:fvalue = 0.0);
543 :    
544 :     /* Generates random floating point number from a to b. */
545 :     native Float:random_float(Float:a,Float:b);
546 :    
547 :     /* Generates random integer from a to b. */
548 :     native random_num(a,b);
549 :    
550 :     /* Returns id of client message.
551 :     * Example: get_user_msgid("TextMsg"). */
552 :     native get_user_msgid(const name[]);
553 :    
554 :     /* Gets name of client message index. Return value is number of
555 :     * characters copied into name. Returns 0 on invalid msgid. */
556 :     native get_user_msgname(msgid, name[], len);
557 :    
558 :     /* Checks if public variable with given name exists in loaded plugins. */
559 :     native xvar_exists( const name[] );
560 :    
561 :     /* Returns an unique id for public variable specified by name. If such
562 :     * variable doesn't exist then returned value is -1. */
563 :     native get_xvar_id( const name[] );
564 :    
565 :     /* Returns an integer value of a public variable. Id is a value
566 :     * returned by get_xvar_id(...) native. */
567 :     native get_xvar_num( id );
568 :    
569 :     /* Returns a float value of a public variable. Id is a value
570 :     * returned by get_xvar_id(...) native. */
571 :     native Float:get_xvar_float( id );
572 :    
573 :     /* Sets a value of a public variable. Id is a value
574 :     * returned by get_xvar_id(...) native. */
575 :     native set_xvar_num( id, value = 0 );
576 :    
577 :     /* Sets a float value of a public variable. Id is a value
578 :     * returned by get_xvar_id(...) native. */
579 :     native set_xvar_float( id, Float:value = 0.0 );
580 :    
581 :     /* Checks whether a module is loaded. If it is not, the return value is -1, otherwise
582 :     * the return value is the module id. The function is case insensitive. */
583 :     native is_module_loaded(const name[]);
584 :    
585 :     /* Gets info about a module.
586 :     * Parameters:
587 :     * id - the id of the module
588 :     * name[] - The name of the module will be stored here
589 :     * nameLen - maximal length of the name
590 :     * author[] - the author will be stored here
591 :     * authorLen - maximal length of the author
592 :     * version[] - the version of the module will be stored here
593 :     * versionLen - maximal length of the version
594 :     * status - the status of the module will be stored here
595 :     * Return value:
596 :     * id - success
597 :     * -1 - module not found */
598 :     native get_module(id, name[], nameLen, author[], authorLen, version[], versionLen, &status);
599 :    
600 :     /* Returns number of currently registered modules */
601 :     native get_modulesnum();
602 :    
603 :     /* Checks whether a plugin is loaded. If it is not, the return value is -1, otherwise
604 :     * the return value is the plugin id. The function is case insensitive. */
605 :     native is_plugin_loaded(const name[]);
606 :    
607 :     /* Gets info about plugin by given index.
608 :     * Function returns -1 if plugin doesn't exist with given index.
609 :     * Note: the [...] portion should not be used, and is only for backward compatibility.
610 :     * Use index of -1 to use the calling plugin's ID.
611 :     */
612 :     native get_plugin(index,filename[],len1,name[],len2,version[],len3,author[],len4,status[],len5,...);
613 :    
614 :     /* Returns number of all loaded plugins. */
615 :     native get_pluginsnum();
616 :    
617 :     /* Pauses function or plugin so it won't be executed.
618 :     * In most cases param1 is name of function and
619 :     * param2 name of plugin (all depends on flags).
620 :     * Flags:
621 :     * "a" - pause whole plugin.
622 :     * "c" - look outside the plugin (by given plugin name).
623 :     * "d" - set "stopped" status when pausing whole plugin.
624 :     * In this status plugin is unpauseable.
625 :     * Example: pause("ac","myplugin.amxx")
626 :     *
627 :     * Note: There used to be the b and e flags as well,
628 :     * which have been deprecated and are no longer used.
629 :     */
630 :     native pause(const flag[], const param1[]="",const param2[]="");
631 :    
632 :     /* Unpauses function or plugin.
633 :     * Flags:
634 :     * "a" - unpause whole plugin.
635 :     * "c" - look outside the plugin (by given plugin name). */
636 :     native unpause(const flag[], const param1[]="",const param2[]="");
637 :    
638 :     /* Call a function in this / an another plugin by name.
639 :     * Parameters:
640 :     * plugin - plugin filename; if "", the caller plugin is used.
641 :     * If specified, it has to be the exact filename (for example stats.amxx)
642 :     * func - function name
643 :     * Return value:
644 :     * 1 - Success
645 :     * 0 - Runtime error
646 :     * -1 - Plugin not found
647 :     * -2 - Function not found */
648 :     native callfunc_begin(const func[], const plugin[]="");
649 :    
650 :     /* Call a function in this / an another plugin by id.
651 :     * Parameters:
652 :     * plugin - plugin id; the id you would pass to get_plugin
653 :     * If < 0, the current plugin is taken
654 :     * func - function id
655 :     * Return value:
656 :     * 1 - Success
657 :     * -1 - Plugin not found
658 :     * -2 - Function not executable */
659 :     native callfunc_begin_i(func, plugin = -1);
660 :    
661 :     /* Get a function id (for callfunc_begin_i)
662 :     To get the plugin id, use the find_plugin stock
663 :     */
664 :     native get_func_id(const funcName[], pluginId = -1);
665 :    
666 :     /* Push a parameter (integer, string, float)
667 :     * Note that none of these values are const.
668 :     * Anything pushed by intrf, floatrf, array, or str
669 :     * can be modified by the called function.
670 :     */
671 :     native callfunc_push_int(value);
672 :     native callfunc_push_float(Float: value);
673 :     native callfunc_push_intrf(&value);
674 :     native callfunc_push_floatrf(& Float: value);
675 :    
676 :     /* If copyback is 1 (default), any changes are copied back.
677 :     * Note that this will defy the 'const' specifier for push_str(),
678 :     * which is only kept for special backwards compatibility.
679 :     */
680 :     native callfunc_push_str(const VALUE[], bool:copyback=true);
681 :     native callfunc_push_array(const VALUE[], array_size, bool:copyback=true);
682 :    
683 :     /* Make the actual call.
684 :     * Return value of the function called. */
685 :     native callfunc_end();
686 :    
687 :     /* Called on inconsistent file. You can put any text
688 :     * into reason to change an original message. */
689 :     forward inconsistent_file(id,const filename[], reason[64] );
690 :    
691 :     /* Forces the client and server to be running with the same
692 :     * version of the specified file ( e.g., a player model ). */
693 :     native force_unmodified(force_type, const mins[3] , const maxs[3], const filename[]);
694 :    
695 :     /* Calculates the md5 keysum of a string */
696 :     native md5(const szString[], md5buffer[34]);
697 :    
698 :     /* Calculates the md5 keysum of a file */
699 :     native md5_file(const file[], md5buffer[34]);
700 :    
701 :     /* Returns the internal flags set on the called plugin's state
702 :     * If hdr is 1, it will return the pcode flags rather than state flags.
703 :     */
704 :     native plugin_flags(hdr=0);
705 :    
706 :     /* When using modules that aren't part of AMX Mod X base package, do
707 :     * a require_module("modulename") for each of them within the plugin_modules()
708 :     * forward. Module name is the one listed when doing "amxx modules" in server
709 :     * console. */
710 :     forward plugin_modules();
711 :    
712 :     native require_module(const module[]);
713 :    
714 :     native is_amd64_server();
715 :    
716 :     /* Returns 0 on success, like the POSIX specification */
717 :     native mkdir(const dirname[]);
718 :    
719 :     /* Returns plugin id searched by file/name. Returns INVALID_PLUGIN_ID on failure. */
720 :     native find_plugin_byfile(const filename[], ignoreCase=1);
721 :    
722 :     /* This is called before plugin_init and allows you to register natives. */
723 :     forward plugin_natives();
724 :    
725 :     /* Registers a NATIVE. When a plugin uses your native (you should distribute a .inc),
726 :     * the handler will be called with two parameters: the calling plugin id, and the
727 :     * number of parameters.
728 :     * If you set style=1, the method of parameter passing is a tad more efficient.
729 :     * Instead of "id, numParams", you label the native exactly as how the parameters
730 :     * should, in theory, be sent. Then for each byreference parameter, you call
731 :     * param_convert(num). This is theoretically more efficient but quite hacky.
732 :     * The method was discovered by dJeyL, props to him!
733 :     */
734 :     native register_native(const name[], const handler[], style=0);
735 :    
736 :     /* Registers a library. You can put #pragma library <name> in your include files,
737 :     * and plugins that use your include without loading your plugin will get a nice
738 :     * error message.
739 :     */
740 :     native register_library(const library[]);
741 :    
742 :     /* Logs an error in your native, and breaks into the debugger.
743 :     * Acts as if the calling plugin had the error.
744 :     */
745 :     native log_error(error, const fmt[], ...);
746 :    
747 :     // More Dynamic Native System Stuff
748 :     // Each of these natives affects one of the parameters sent to your native.
749 :     // Parameters go from 1 to n, just like in modules, and it is important to
750 :     // remember two things: The parameters are actually coming from another plugin
751 :     // (and just like modules, you must use these special natives).
752 :     // two: you CANNOT call your native from inside your native. This is very bad.
753 :    
754 :     //This function should only be called if you registered with style=1
755 :     //You only need to use it on by-reference parameters.
756 :     native param_convert(num);
757 :    
758 :     // Gets a string from the calling plugin
759 :     native get_string(param, dest[], maxlen);
760 :    
761 :     // Sets a string in the calling plugin
762 :     native set_string(param, dest[], maxlen);
763 :    
764 :     // Gets a normal int or float parameter
765 :     native get_param(param);
766 :     native Float:get_param_f(param);
767 :    
768 :     // Gets/Sets a float or int parameter by reference
769 :     native get_param_byref(param);
770 :     native Float:get_float_byref(param);
771 :     native set_param_byref(param, value);
772 :     native set_float_byref(param, Float:value);
773 :    
774 :     // Copies an array either from the calling plugin to you
775 :     // Or copies an array from you to the calling plugin
776 :     native get_array(param, dest[], size);
777 :     native get_array_f(param, Float:dest[], size);
778 :     native set_array(param, const source[], size);
779 :     native set_array_f(param, const Float:source[], size);
780 :    
781 :     /** The new menu natives */
782 :     //If you set ml to 1, everything will be preformatted
783 :     // with the multi-lingual system.
784 :     //NOTE: ml=1 currently is not enabled.
785 :     //handler[] will be called when someone presses a key on your menu
786 :     native menu_create(const title[], const handler[], ml=0);
787 :    
788 :     //Creates a menu item callback handler.
789 :     //The callback handler is passed the playerid, menuid, and itemid.
790 :     //It can return either ITEM_IGNORE, ITEM_ENABLED, or ITEM_DISABLED.
791 :     native menu_makecallback(const function[]);
792 :    
793 :     //Adds an item to a menu. When displayed, the name will be shown.
794 :     //If the player does not have the access it is disabled.
795 :     //If you set callback, the callback will be called before the item is printed on the screen.
796 :     //this lets you change it in real time depending on conditions.
797 :     native menu_additem(menu, const name[], const command[]="", paccess=0, callback=-1);
798 :    
799 :     //returns how many pages are in a menu
800 :     native menu_pages(menu);
801 :    
802 :     //returns how many items are in a menu
803 :     native menu_items(menu);
804 :    
805 :     //displays a menu to a player
806 :     //page of the menu starts at 0. there are 7 items to a page.
807 :     //back/exit/next/more whatever are automatically added as needed.
808 :     //you cannot use this to show a menu to everyone at once!
809 :     native menu_display(id, menu, page);
810 :    
811 :     //Given a page on a menu and a keypress on that page, returns the item id selected.
812 :     //if the item is less than 0, a special option was chosen (such as MENU_EXIT)
813 :     native menu_find_id(menu, page, key);
814 :    
815 :     //Gets/sets info about a menu option
816 :     native menu_item_getinfo(menu, item, &access, command[], cmdlen, name[]="", namelen=0, &callback);
817 :    
818 :     native menu_item_setname(menu, item, const name[]);
819 :     native menu_item_setcmd(menu, item, const cmd[]);
820 :     native menu_item_setcall(menu, item, callback=-1);
821 :    
822 :     //Destroys a menu - invalidates the handle
823 :     //This is safe, as it will go through the players and make
824 :     // sure they don't have this menu set anymore.
825 :     native menu_destroy(menu);
826 :    
827 :     //Gets info about a player's menu. Returns 1 if the player is viewing a menu.
828 :     //menu will be >0 for a valid oldmenu. newmenu will be != -1 for a valid newmenu.
829 :     native player_menu_info(id, &menu, &newmenu);
830 :    
831 :     //adds a blank line to a menu.
832 :     //if slot is nonzero (default), the blank line will increase
833 :     //the numbering rather than just shifting down.
834 :     native menu_addblank(menu, slot=1);
835 :    
836 :     //Sets a menu property. See amxconst.inc for various menu properties.
837 :     //The third value depends on the property
838 :     native menu_setprop(menu, prop, ...);
839 :    
840 :     //Cancels a player's menu, effectively forcing the player to select MENU_EXIT
841 :     //The menu will still exist on their screen but any results are invalidated,
842 :     //and the callback is invoked.
843 :     native menu_cancel(player);
844 :    
845 :     // Dispatches a client cvar query
846 :     // id: Player id
847 :     // cvar: cvar name
848 :     // resultFunc: public handler function
849 :     // paramLen + params: optional array parameter
850 :     // resultFunc looks like:
851 :     // public callbackCvarValue(id, const cvar[], const value[])
852 :     // or if you use the optional parameter:
853 :     // public callbackCvarValue(id, const cvar[], const value[], const param[])
854 :     native query_client_cvar(id, const cvar[], const resultFunc[], paramlen=0, const params[] = "");
855 :    
856 :    
857 :     /**
858 :     * Allows you to trap error messages that occur in your plugin.
859 :     * You can use this to override the debug messages that occur when your plugin
860 :     * causes some sort of runtime error. Your handler will be called in this style:
861 :     *
862 :     * public error_filter(error_code, bool:debugging, message[])
863 :     * error_code is the AMX_ERR code. debugging is whether or not the plugin is in debug mode.
864 :     * message[] is any message that was sent along with the error.
865 :     * Return PLUGIN_CONTINUE to let the error pass through the filter.
866 :     * Return PLUGIN_HANDLED to block the error from displaying.
867 :     */
868 :     native set_error_filter(const handler[]);
869 :    
870 :     /**
871 :     * Gets a trace handle for the item at the top of the traced call stack.
872 :     * Returns 0 if no debugging information is available.
873 :     */
874 :     native dbg_trace_begin();
875 :    
876 :     /**
877 :     * Gets the next item in a traced call stack. Returns 0 if no more traces exist.
878 :     */
879 :     native dbg_trace_next(trace);
880 :    
881 :     /**
882 :     * Gets the call stack info for a trace.
883 :     */
884 :     native dbg_trace_info(trace, &line, function[], maxLength1, file[], maxLength2);
885 :    
886 :     /**
887 :     * Gets the formatted error string, which looks like "Run time error X: (description)"
888 :     */
889 :     native dbg_fmt_error(buffer[], maxLength);
890 :    
891 :     /**
892 :     * The following two natives are useful for creating cross-mod plugins
893 :     * where instead of #define flags to compile separate versions, you can
894 :     * filter out the natives and modules depending on the current mod.
895 :     * Examples of this usage are in plmenu.sma, which filters out the cstrike module.
896 :     */
897 :    
898 :     /**
899 :     * Sets a native filter. This must be first set in plugin_natives(), but future calls will
900 :     * simply set a new filter.
901 :     * This filter will allow your plugin to load even if its modules aren't loaded. For example,
902 :     * if Fun isn't loaded and you use set_user_frags, your plugin will still load. However, if you
903 :     * attempt to call this native, your filter will intercept it with these parameters:
904 :     *
905 :     * public function native_filter(const name[], index)
906 :     * native - name of native
907 :     * index - index of native
908 :     * trap - 0 if native couldn't be found, 1 if native use was attempted
909 :     *
910 :     * If you return PLUGIN_HANDLED, no error is thrown. If you return PLUGIN_CONTINUE,
911 :     * your plugin will have a run-time-error. To print your own error, or change the default,
912 :     * you can return PLUGIN_HANDLED or return PLUGIN_CONTINUE and use set_error_filter.
913 :     * If you return PLUGIN_CONTINUE when trap is 0, the plugin will ABORT AND FAIL TO LOAD!
914 :     * When trap is 0, it is unsafe to use natives that modify the server or use other plugins.
915 :     */
916 :     native set_native_filter(const handler[]);
917 :    
918 :     /**
919 :     * This function sets a module/library filter. It will let you intercept the automatic requirement
920 :     * of a module and return PLUGIN_CONTINUE to fail load or PLUGIN_HANDLED to imply that load
921 :     * can continue even without the module.
922 :     *
923 :     * This is the most unforgiving of the filter functions. You can ONLY call it during plugin_natives,
924 :     * and any error that occurs is not filtered -- instead your plugin will fail to load as if you
925 :     * returned PLUGIN_CONTINUE.
926 :     *
927 :     * Your handler will be called with this prototype:
928 :     *
929 :     * public module_filter(const library[], LibType:type);
930 :     * library - library or class name of the module that is required
931 :     * libtype - The type of requirement being checked (library/module or class).
932 :     *
933 :     *
934 :     * set_module_filter() returns 0 on success (unlike most natives).
935 :     */
936 :     native set_module_filter(const handler[]);
937 :    
938 :     /**
939 :     * Aborts execution of the current callback. Your script will throw a run time error.
940 :     * You can also specify an optional message.
941 :     * You should NOT call this function inside:
942 :     * - Error or module filters (native filters are safe if trap is 1)
943 :     * - plugin_natives()
944 :     * Note that the plugin's filename is prepending to your message:
945 :     * [myplugin.amxx] MESSAGE
946 :     */
947 :     native abort(error, const fmt[]="", {Float,_}:...);
948 :    
949 :     /**
950 :     * Checks if a specific module is loaded. This is the exact same method AMX Mod X
951 :     * uses to see if a module is required by a plugin. For example:
952 :     * module_exists("cstrike")
953 :     * module_exists("dbi")
954 :     */
955 :     native module_exists(const logtag[]);
956 :    
957 :     /**
958 :     * Checks if a library/class is loaded. This is the newer version of module_exists.
959 :     */
960 :     native LibraryExists(const library[], LibType:type);
961 :    
962 :     /**
963 :     * Returns the next valid hudchannel for a user, from 1-4.
964 :     */
965 :     native next_hudchannel(player);
966 :    
967 :     /**
968 :     * Creates a HUD Synchronization Object. Create one of these
969 :     * for each section of the screen that contains overlapping HUD messages.
970 :     * For example, if you use both sides of the screen to display three messages
971 :     * that can potentially overlap, each side counts as a synchronizable area.
972 :     * You can then use ShowSyncHudMsg() to correctly synchronize displaying the
973 :     * HUD message with any other messages potentially in its class. Note that this
974 :     * does not yet do anything like reserve screen area, its sole purpose is to be
975 :     * able to wipe an old message on an auto-channel and ensure that it will not
976 :     * clear a message from another plugin.
977 :     * The parameters are kept blank for future use.
978 :     */
979 :     native CreateHudSyncObj(num=0, ...);
980 :    
981 :     /**
982 :     * Displays a synchronized HUD message. This will check that your
983 :     * HUD object has its previous display on the screen cleared before
984 :     * it proceeds to write another. It will only do this in the case
985 :     * of that channel not having been cleared already.
986 :     * Target can be 0 for all players or 1-get_maxplayers().
987 :     * You must use set_hudmessage, although the channel parameter is
988 :     * entirely ignored.
989 :     */
990 :     native ShowSyncHudMsg(target, syncObj, const fmt[], ...);
991 :    
992 :     /**
993 :     * Clears the display on a HudSync Object. This is essentially the same
994 :     * thing as: ShowSyncHudMsg(x, y, ""), except doing that would send
995 :     * out two messages and use up another channel. This re-uses the last
996 :     * channel and clears it at the same time.
997 :     * Note: for this you do not have to use set_hudmessage().
998 :     * Note: target can be 0 for all players.
999 :     */
1000 :     native ClearSyncHud(target, syncObj);
1001 :    
1002 :     //no
1003 :     native int3();
1004 :    
1005 :     //Sets your plugin to a failed/error state.
1006 :     //If you use this, your plugin will cease operating.
1007 :     //This is a good idea to fatally, but gracefully, handle errors.
1008 :     //You can set a failed error message.
1009 :     native set_fail_state(const err_msg[]);
1010 :    
1011 :     //Returns the reference address of the variable passed in.
1012 :     //This address is local to the plugin, and not a full CPU address
1013 :     //pass the variable as the first parameter
1014 :     native get_var_addr(...);
1015 :    
1016 :     //Returns the value of an address. This dereferences something returned by
1017 :     // get_var_addr(). Attempting to pass in a value beyond stack or heap limits
1018 :     // will result in AMX_ERR_MEMACCESS.
1019 :     native get_addr_val(addr);
1020 :    
1021 :     //Sets the value of an address. same as above, essentially
1022 :     native set_addr_val(addr, val);
1023 :    
1024 :    
1025 :     /**
1026 :     * Creates a multi-plugin forward.
1027 :     * Stop type must be one of the ET_ values in amxconst.inc
1028 :     * results will be > 0 for success
1029 :     */
1030 :     native CreateMultiForward(const name[], stop_type, ...);
1031 :    
1032 :     /**
1033 :     * Creates a multi-forward plugin that can filter between old/new plugins.
1034 :     * Old plugins are used by the AMX Mod backwards compatibility layer.
1035 :     * Stop type must be one of the ET_ values in amxconst.inc
1036 :     * Forward type must be one of the FORWARD_ values in amxconst.inc.
1037 :     */
1038 :     native CreateMultiForwardEx(const name[], stop_type, forward_type, ...);
1039 :    
1040 :     /**
1041 :     * Creates a forward for one plugin.
1042 :     * Results will be > 0 for success.
1043 :     * id should be an id such as returned by find_plugin_byfile.
1044 :     * Unlike get_plugin(), negative numbers will not work.
1045 :     */
1046 :     native CreateOneForward(plugin_id, const name[], ...);
1047 :    
1048 :     /**
1049 :     * prepares an array. use this and pass the result into
1050 :     * ExecuteForward() instead of the array itself.
1051 :     */
1052 :     native PrepareArray(const array[], size, copyback=0);
1053 :    
1054 :     /**
1055 :     * executes a forward. returns result in ret.
1056 :     * returns 1 for success, 0 for failure.
1057 :     */
1058 :     native ExecuteForward(forward_handle, &ret, {Float,_}:...);
1059 :    
1060 :     /**
1061 :     * Destroys/deallocates any type of forward
1062 :     */
1063 :     native DestroyForward(forward_handle);
1064 :    
1065 :    
1066 :     /* CVAR Pointer natives. Use these for
1067 :     * more optimized CVAR usage.
1068 :     * register_cvar() returns a pointer you can use.
1069 :     */
1070 :    
1071 :     /**
1072 :     * Get a cvar pointer. Returns 0 if not found.
1073 :     */
1074 :     native get_cvar_pointer(const cvar[]);
1075 :    
1076 :     native get_pcvar_flags(pcvar);
1077 :     native set_pcvar_flags(pcvar, flags);
1078 :     native get_pcvar_num(pcvar);
1079 :     native set_pcvar_num(pcvar, num);
1080 :     native Float:get_pcvar_float(pcvar);
1081 :     native set_pcvar_float(pcvar, Float:num);
1082 :     native get_pcvar_string(pcvar, string[], maxlen);
1083 :    
1084 :     /**
1085 :     * Sets a whole array to a certain value.
1086 :     */
1087 :     native arrayset(array[], value, size);
1088 :    
1089 :     /**
1090 :     * Returns the weapon id, otherwise 0 when no id found.
1091 :     * The weapon name is case sensitive, and has the weapon_* form.
1092 :     */
1093 :     native get_weaponid(const name[]);
1094 :    
1095 :     // Keep this always at the bottom of this file
1096 :     #include <message_stocks>

Contact
ViewVC Help
Powered by ViewVC 1.0.4