no message

This commit is contained in:
Felix Geyer 2004-02-15 02:29:51 +00:00
parent 6eb236f8b7
commit 21d870c57a
15 changed files with 997 additions and 245 deletions

View File

@ -0,0 +1,96 @@
/* Vexd Utility backwards compatibility
*
* (c) 2004, the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#include <engine>
stock Entvars_Get_Int(iIndex, iVariable)
return entity_get_int(iIndex, iVariable)
stock Entvars_Set_Int(iIndex, iVariable, iNewValue)
return entity_set_int(iIndex, iVariable, iNewValue)
stock Float:Entvars_Get_Float(iIndex, iVariable)
return entity_get_float(iIndex, iVariable)
stock Entvars_Set_Float(iIndex, iVariable, Float:fNewValue)
return entity_set_float(iIndex, iVariable, fNewValue)
stock Entvars_Get_Vector(iIndex, iVariable, Float:vRetVector[3])
return entity_get_vector(iIndex, iVariable, vRetVector)
stock Entvars_Set_Vector(iIndex, iVariable, Float:vNewVector[3])
return entity_set_vector(iIndex, iVariable, vNewVector)
stock Entvars_Get_Edict(iIndex, iVariable)
return entity_get_edict(iIndex, iVariable)
stock Entvars_Set_Edict(iIndex, iVariable, iNewIndex)
return entity_set_edict(iIndex, iVariable, iNewIndex)
stock Entvars_Get_String(iIndex, iVariable, szReturnValue[], iReturnLen)
return entity_get_string(iIndex, iVariable, szReturnValue, iReturnLen)
stock Entvars_Set_String(iIndex, iVariable, szNewValue[])
return entity_set_string(iIndex, iVariable, szNewValue)
stock Entvars_Get_Byte(iIndex, iVariable)
return entity_get_byte(iIndex, iVariable)
stock Entvars_Set_Byte(iIndex, iVariable, iNewValue)
return entity_set_byte(iIndex, iVariable, iNewValue)
stock CreateEntity(szClassname[])
return create_entity(szClassname[])
stock ENT_SetModel(iIndex, szModel[])
return entity_set_model(iIndex, szModel)
stock ENT_SetOrigin(iIndex, Float:fNewOrigin[3])
return entity_set_origin(iIndex, fNewOrigin)
stock FindEntity(iIndex, szValue[])
return find_entity(iIndex, szValue)
stock RemoveEntity(iIndex)
return remove_entity(iIndex)
stock TraceLn(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3])
return trace_line(iIgnoreEnt, fStart, fEnd, vReturn)
stock TraceNormal(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3])
return trace_normal(iIgnoreEnt, fStart, fEnd, vReturn)
stock VecToAngles(Float:fVector[3], Float:vReturn[3])
return vector_to_angle(fVector, vReturn)
stock Float:VecLength(Float:vVector[3])
return vector_length(vVector)
stock Float:VecDist(Float:vVector[3], Float:vVector2[3])
return vector_distance(vVector, vVector2)
stock MessageBlock(iMessage, iMessageFlags)
return set_msg_block(iMessage, iMessageFlags)
stock GetMessageBlock(iMessage)
return get_msg_block(iMessage)
stock Float:HLTime()
return halflife_time()
stock FakeTouch(iToucher, iTouched)
return fake_touch(iToucher, iTouched)
stock AttachView(iIndex, iTargetIndex)
return attach_view(iIndex, iTargetIndex)
stock SetView(iIndex, ViewType)
return set_view(iIndex, ViewType)
forward vexd_pfntouch(pToucher, pTouched)
forward ServerFrame()

View File

@ -1,12 +1,12 @@
/* AMX Mod X
*
* (c) 2002-2004, OLO
* modified by BAILOPAN, Manip, PM, SniperBeamer
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
// Uncomment if you are not using Steam
/* Uncomment if you are not using Steam */
//#define NO_STEAM
#define ADMIN_IMMUNITY (1<<0) /* flag "a" */
@ -32,11 +32,11 @@
#define ADMIN_MENU (1<<20) /* flag "u" */
#define ADMIN_USER (1<<25) /* flag "z" */
#define FLAG_KICK (1<<0) /* flag "a" */
#define FLAG_TAG (1<<1) /* flag "b" */
#define FLAG_AUTHID (1<<2) /* flag "c" */
#define FLAG_IP (1<<3) /* flag "d" */
#define FLAG_NOPASS (1<<4) /* flag "e" */
#define FLAG_KICK (1<<0) /* flag "a" */
#define FLAG_TAG (1<<1) /* flag "b" */
#define FLAG_AUTHID (1<<2) /* flag "c" */
#define FLAG_IP (1<<3) /* flag "d" */
#define FLAG_NOPASS (1<<4) /* flag "e" */
#define PLUGIN_CONTINUE 0 /* Results returned by public functions */
#define PLUGIN_HANDLED 1 /* stop other plugins */
@ -161,7 +161,7 @@ enum {
/* Render for set_user_rendering() */
enum {
kRenderNormal, /* src */
kRenderNormal = 0, /* src */
kRenderTransColor, /* c*a+dest*(1-a) */
kRenderTransTexture, /* src*a+dest*(1-a) */
kRenderGlow, /* src*a+dest -- No Z buffer checks */
@ -194,6 +194,7 @@ enum {
kRenderFxClampMinScale, /* Keep this sprite from getting very small (SPRITES only!) */
}
/* Type for force_unmodified() */
enum {
force_exactfile = 0, /* File on client must exactly match server's file */
force_model_samebounds, /* For model files only, the geometry must fit in the same bbox */

View File

@ -1,34 +1,33 @@
/* AMX Mod X misc.
*
* (c) 2002-2004, OLO
* modified by BAILOPAN, Manip, PM, SniperBeamer
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
stock bool:cmd_access(id,level,cid,num) {
stock cmd_access(id,level,cid,num) {
if ( ((get_user_flags(id)&level)!=level) && (id!=(is_dedicated_server()?0:1)) ) {
console_print(id,"You have no access to that command")
return false
return 0
}
if (read_argc() < num) {
new hcmd[32], hinfo[128], hflag
get_concmd(cid,hcmd,31,hflag,hinfo,127,level)
console_print(id,"Usage: %s %s",hcmd,hinfo)
return false
return 0
}
return true
return 1
}
stock access(id,level)
return (get_user_flags(id) & level)
/* Flags:
* 1 - obey immunity
* 2 - allow yourself
* 4 - must be alive
* 8 - can't be bot
*/
* 1 - obey immunity
* 2 - allow yourself
* 4 - must be alive
* 8 - can't be bot */
stock cmd_target(id,const arg[],flags = 1) {
new player = find_player("bl",arg)
if (player) {

View File

@ -1,7 +1,7 @@
/* AMX Mod X functions
*
* (c) 2002-2004, OLO
* modified by BAILOPAN, Manip, PM, SniperBeamer
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
@ -14,11 +14,11 @@
#include <vault>
/* Function is called just after server activation.
* Good place for configuration loading, commands and cvars registration. */
* Good place for configuration loading, commands and cvars registration. */
forward plugin_init();
/* Function is called when all plugin_init from plugins
* were called, so all commmands and cvars should be already registered. */
* were called, so all commmands and cvars should be already registered. */
forward plugin_cfg();
/* Function called before plugin unloading (server deactivation) */
@ -37,7 +37,7 @@ forward client_infochanged(id);
forward client_connect(id);
/* Called when client gets valid STEAM id (usually
* between client_connect() and client_putinserver()). */
* between client_connect() and client_putinserver()). */
forward client_authorized(id);
/* Called when client is disconnecting from server. */
@ -53,7 +53,7 @@ forward client_putinserver(id);
native register_plugin(const plugin_name[],const version[],const author[]);
/* Gets info about plugin by given index.
* Function returns -1 if plugin doesn't exist with given index. */
* Function returns -1 if plugin doesn't exist with given index. */
native get_plugin(index,filename[],len1,name[],len2,version[],len3,author[],len4,status[],len5);
/* Returns number of all loaded plugins. */
@ -78,8 +78,8 @@ native set_localinfo(const info[],const value[]);
native get_localinfo(const info[],output[],len);
/* Shows text in MOTD window. When there is no header, the MOTD title
* will be the name of server. If message is filename, then a contents
* of this file will be displayed as MOTD. */
* will be the name of server. If message is filename, then a contents
* of this file will be displayed as MOTD. */
native show_motd(player,const message[],const header[]="");
/* Sends message to player. Set index to 0 to send text globaly. */
@ -95,28 +95,27 @@ native console_print(id,const message[],{Float,_}:...);
native console_cmd(id,const cmd[],{Float,_}:...);
/* Registers event on which a given function will be called
* Flags:
* "a" - global event.
* "b" - specified.
* "c" - send only once when repeated to other players.
* "d" - call if is send to dead player.
* "e" - to alive.
* Examples for conditions:
* "2=c4" - 2nd parameter of message must be sting "c4".
* "3>10" - 3rd parameter must be greater then 10.
* "3!4" - 3rd must be different from 4.
* "2&Buy" - 2nd parameter of message must contain "Buy" substring.
* "2!Buy" - 2nd parameter of message can't contain "Buy" substring. */
* Flags:
* "a" - global event.
* "b" - specified.
* "c" - send only once when repeated to other players.
* "d" - call if is send to dead player.
* "e" - to alive.
* Examples for conditions:
* "2=c4" - 2nd parameter of message must be sting "c4".
* "3>10" - 3rd parameter must be greater then 10.
* "3!4" - 3rd must be different from 4.
* "2&Buy" - 2nd parameter of message must contain "Buy" substring.
* "2!Buy" - 2nd parameter of message can't contain "Buy" substring. */
native register_event(const event[],const function[],const flags[],cond[]="", ... );
/* Registers log event on which the given function will be called
* Examples for conditions:
* "0=World triggered" "1=Game_Commencing"
* "1=say"
* "3=Terrorists_Win"
* "1=entered the game"
* "0=Server cvar"
*/
* Examples for conditions:
* "0=World triggered" "1=Game_Commencing"
* "1=say"
* "3=Terrorists_Win"
* "1=entered the game"
* "0=Server cvar" */
native register_logevent(const function[], argsnum, ... );
/* Sets format for hudmessage. */
@ -129,9 +128,9 @@ native show_hudmessage(index,const message[],{Float,_}:...);
native show_menu(index,keys,const menu[], time = -1);
/* Gets value from client messages.
* When you are asking for string the array and length is needed (read_data(2,name,len)).
* Integer is returned by function (new me = read_data(3)).
* Float is set in second parameter (read_data(3,value)). */
* When you are asking for string the array and length is needed (read_data(2,name,len)).
* Integer is returned by function (new me = read_data(3)).
* Float is set in second parameter (read_data(3,value)). */
native read_data(value, {Float,_}:... );
/* Returns number of values in client message. */
@ -141,18 +140,18 @@ native read_datanum();
native read_logdata(output[],len);
/* Returns number of log arguments.
* Can be called only in plugin_log() forward function. */
* Can be called only in plugin_log() forward function. */
native read_logargc();
/* Gets log argument indexed from 0.
* Can be called only in plugin_log() forward function. */
* Can be called only in plugin_log() forward function. */
native read_logargv(id,output[],len);
/* Parse log data about user ( "Butcher<5><BOT><TERRORIST>" etc. ). */
native parse_loguser(const text[], name[], nlen, &userid = -2, authid[] = "", alen = 0, team[]="", tlen=0);
/* Prints message to server console.
* You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) */
* You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) */
native server_print(const message[], {Float,_}:...);
/* Returns 1 or 0. */
@ -180,13 +179,13 @@ native is_dedicated_server();
native is_linux_server();
/* If player is not attacked function returns 0, in other
* case returns index of attacking player. On second and third
* parameter you may get info about weapon and body hit place. */
* case returns index of attacking player. On second and third
* parameter you may get info about weapon and body hit place. */
native get_user_attacker(index,...);
/* If player doesn't hit at anything function returns 0.0,
* in other case the distance between hit point and player is returned.
* If player is aiming at another player then the id and part of body are set. */
* in other case the distance between hit point and player is returned.
* If player is aiming at another player then the id and part of body are set. */
native Float:get_user_aiming(index,&id,&body,dist=9999);
/* Returns player frags. */
@ -208,7 +207,7 @@ native get_user_index(const name[]);
native get_user_ip(index,ip[],len, without_port = 0);
/* Returns id of currently carried weapon. Gets also
* ammount of ammo in clip and backpack. */
* ammount of ammo in clip and backpack. */
native get_user_weapon(index,&clip,&ammo);
/* Gets ammo and clip from current weapon. */
@ -218,27 +217,27 @@ native get_user_ammo(index,weapon,&clip,&ammo);
native num_to_word(num,output[],len);
/* Returns team id. When length is greater then 0
* then a name of team is set. */
* then a name of team is set. */
native get_user_team(index, team[]="", len = 0);
/* Returns player playing time in seconds.
* If flag is set then result is without connection time. */
* If flag is set then result is without connection time. */
native get_user_time(index, flag = 0);
/* Gets ping and loss at current time. */
native get_user_ping(index, &ping, &loss);
/* Gets origin from player.
* Modes:
* 0 - current position.
* 1 - position from eyes (weapon aiming).
* 2 - end position from player position.
* 3 - end position from eyes (hit point for weapon).
* 4 - position of last bullet hit (only CS). */
* Modes:
* 0 - current position.
* 1 - position from eyes (weapon aiming).
* 2 - end position from player position.
* 3 - end position from eyes (hit point for weapon).
* 4 - position of last bullet hit (only CS). */
native get_user_origin(index, origin[3], mode = 0);
/* Returns all carried weapons as bit sum. Gets
* also theirs indexes. */
* also theirs indexes. */
native get_user_weapons(index,weapons[32],&num);
/* Returns weapon name. */
@ -269,19 +268,19 @@ native log_message(const message[],{Float,_}:...);
native log_to_file(const file[],const message[],{Float,_}:...);
/* Returns number of players put in server.
* If flag is set then also connecting are counted. */
* If flag is set then also connecting are counted. */
native get_playersnum(flag=0);
/* Sets indexes of players.
* Flags:
* "a" - don't collect dead players.
* "b" - don't collect alive players.
* "c" - skip bots.
* "d" - skip real players.
* "e" - match with team.
* "f" - match with part of name.
* "g" - ignore case sensitivity.
* Example: Get all alive CTs: get_players(players,num,"ae","CT") */
* Flags:
* "a" - don't collect dead players.
* "b" - don't collect alive players.
* "c" - skip bots.
* "d" - skip real players.
* "e" - match with team.
* "f" - match with part of name.
* "g" - ignore case sensitivity.
* Example: Get all alive CTs: get_players(players,num,"ae","CT") */
native get_players(players[32], &num ,const flags[]="", const team[]="");
/* Gets argument from command. */
@ -294,27 +293,27 @@ native read_args(output[],len);
native read_argc();
/* Converts string to sum of bits.
* Example: "abcd" is a sum of 1, 2, 4 and 8. */
* Example: "abcd" is a sum of 1, 2, 4 and 8. */
native read_flags(const flags[]);
/* Converts sum of bits to string.
* Example: 3 will return "ab". */
* Example: 3 will return "ab". */
native get_flags(flags,output[],len);
/* Find player.
* Flags:
* "a" - with given name.
* "b" - with given part of name.
* "c" - with given authid.
* "d" - with given ip.
* "e" - with given team name.
* "f" - don't look in dead players.
* "g" - don't look in alive players.
* "h" - skip bots.
* "i" - skip real players.
* "j" - return index of last found player.
* "k" - with given userid.
* "l" - ignore case sensitivity. */
* Flags:
* "a" - with given name.
* "b" - with given part of name.
* "c" - with given authid.
* "d" - with given ip.
* "e" - with given team name.
* "f" - don't look in dead players.
* "g" - don't look in alive players.
* "h" - skip bots.
* "i" - skip real players.
* "j" - return index of last found player.
* "k" - with given userid.
* "l" - ignore case sensitivity. */
native find_player(const flags[], ... );
/* Removes quotes from sentence. */
@ -324,9 +323,9 @@ native remove_quotes(text[]);
native client_cmd(index,const command[],{Float,_}:...);
/* This is an emulation of a client command (commands aren't send to client!).
* It allows to execute some commands on players and bots.
* Function is excellent for forcing to do an action related to a game (not settings!).
* The command must stand alone but in arguments you can use spaces. */
* It allows to execute some commands on players and bots.
* Function is excellent for forcing to do an action related to a game (not settings!).
* The command must stand alone but in arguments you can use spaces. */
native engclient_cmd(index,const command[],arg1[]="",arg2[]="");
/* Executes command on a server console. */
@ -339,11 +338,11 @@ native set_cvar_string(const cvar[],const value[]);
native cvar_exists(const cvar[]);
/* Removes a cvar flags (not allowed for amx_version,
* fun_version and sv_cheats cvars). */
* fun_version and sv_cheats cvars). */
native remove_cvar_flags(const cvar[],flags = -1);
/* Sets a cvar flags (not allowed for amx_version,
* fun_version and sv_cheats cvars). */
* fun_version and sv_cheats cvars). */
native set_cvar_flags(const cvar[],flags);
/* Returns a cvar flags. */
@ -383,39 +382,39 @@ native get_modname(name[],len);
native get_time(const format[],output[],len);
/* Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S".
* Last parameter sets time to format. */
* Last parameter sets time to format. */
native format_time(output[],len, const format[],time = -1);
/* Returns system time in seconds elapsed since 00:00:00 on January 1, 1970.
* Offset is given in seconds.*/
* Offset is given in seconds.*/
native get_systime(offset = 0);
/* Returns time in input and additionaly fills missing information
* with current time and date. If time is different than -1 then parsed
* time is added to given time.
* Example:
* parset_time( "10:32:54 04/02/2003", "%H:%M:%S %m:%d:%Y" )
* For more information see strptime(...) function from C libraries. */
* with current time and date. If time is different than -1 then parsed
* time is added to given time.
* Example:
* parset_time( "10:32:54 04/02/2003", "%H:%M:%S %m:%d:%Y" )
* For more information see strptime(...) function from C libraries. */
native parse_time(const input[],const format[], time = -1);
/* Calls function on specified time.
* Flags:
* "a" - repeat.
* "b" - loop task.
* "c" - do task on time after a map timeleft.
* "d" - do task on time before a map timelimit. */
* Flags:
* "a" - repeat.
* "b" - loop task.
* "c" - do task on time after a map timeleft.
* "d" - do task on time before a map timelimit. */
native set_task(Float:time,const function[],id = 0,parameter[]="",len = 0,flags[]="", repeat = 0);
/* Removes all tasks with given id. If outside var is
* set then a task can be removed also when
* was set in another plugin. */
* set then a task can be removed also when
* was set in another plugin. */
native remove_task(id = 0, outside = 0);
/* Returns 1 if task under given id exists. */
native task_exists(id = 0, outside = 0);
/* Sets flags for player. Set flags to -1 if you want to clear all flags.
* You can use different settings by changing the id, which is from range 0 - 31. */
* You can use different settings by changing the id, which is from range 0 - 31. */
native set_user_flags(index,flags=-1,id=0);
/* Gets flags from player. Set index to 0 if you want to read flags from server. */
@ -446,27 +445,27 @@ native get_srvcmd(index,server_cmd[],len1,&flags, info[],len2, flag);
native get_srvcmdsnum(flag);
/* Gets info about console command. If id is set to 0,
then function returns only server cmds, if positive then
returns only client cmds. in other case returns all console commands. */
* then function returns only server cmds, if positive then
* returns only client cmds. in other case returns all console commands. */
native get_concmd(index,cmd[],len1,&flags, info[],len2, flag, id = -1);
/* Returns number of registered console commands. */
native get_concmdsnum(flag,id = -1);
/* Gets unique id of menu. Outside set to 1 allows
* to catch menus outside a plugin where register_menuid is called. */
* to catch menus outside a plugin where register_menuid is called. */
native register_menuid(const menu[], outside=0 );
/* Calls function when player uses specified menu and proper keys. */
native register_menucmd(menuid,keys, const function[] );
/* Gets what menu the player is watching and what keys for menu he have.
* When there is no menu the index is 0. If the id is negative then the menu
* is VGUI in other case the id is from register_menuid() function. */
* When there is no menu the index is 0. If the id is negative then the menu
* is VGUI in other case the id is from register_menuid() function. */
native get_user_menu(index,&id,&keys);
/* Forces server to execute sent server command at current time.
* Very useful for map changes, setting cvars and other activities. */
* Very useful for map changes, setting cvars and other activities. */
native server_exec();
/* Emits sound. Sample must be precached. */
@ -485,34 +484,34 @@ native Float:random_float(Float:a,Float:b);
native random_num(a,b);
/* Pauses function or plugin so it won't be executed.
* In most cases param1 is name of function and
* param2 name of plugin (all depends on flags).
* Flags:
* "a" - pause whole plugin.
* "b" - pause function.
* "c" - look outside the plugin (by given plugin name).
* "d" - set "stopped" status when pausing whole plugin.
* "e" - set "locked" status when pausing whole plugin.
* In this status plugin is unpauseable.
* Example: pause("ac","myplugin.amx")
* pause("bc","myfunc","myplugin.amx") */
* In most cases param1 is name of function and
* param2 name of plugin (all depends on flags).
* Flags:
* "a" - pause whole plugin.
* "b" - pause function.
* "c" - look outside the plugin (by given plugin name).
* "d" - set "stopped" status when pausing whole plugin.
* "e" - set "locked" status when pausing whole plugin.
* In this status plugin is unpauseable.
* Example: pause("ac","myplugin.amx")
* pause("bc","myfunc","myplugin.amx") */
native pause(flag[], const param1[]="",const param2[]="");
/* Unpauses function or plugin.
* Flags:
* "a" - unpause whole plugin.
* "b" - unpause function.
* "c" - look outside the plugin (by given plugin name). */
* Flags:
* "a" - unpause whole plugin.
* "b" - unpause function.
* "c" - look outside the plugin (by given plugin name). */
native unpause(flag[], const param1[]="",const param2[]="");
/* Returns id of client message.
* Example: get_user_msgid("TextMsg"). */
* Example: get_user_msgid("TextMsg"). */
native get_user_msgid(const name[]);
/* These functinos are used to generate client messages.
* You may generate menu, smoke, shockwaves, thunderlights,
* intermission and many many others messages.
* See HL SDK for more examples. */
* You may generate menu, smoke, shockwaves, thunderlights,
* intermission and many many others messages.
* See HL SDK for more examples. */
native message_begin( dest, msg_type, origin[3]={0,0,0},player=0);
native message_end();
native write_byte( x );
@ -525,32 +524,32 @@ native write_coord( x );
native write_string( x[] );
/* Called on inconsistent file. You can put any text
* into reason to change an original message. */
* into reason to change an original message. */
forward inconsistent_file(id,const filename[], reason[64] );
/* Forces the client and server to be running with the same
* version of the specified file ( e.g., a player model ). */
* version of the specified file ( e.g., a player model ). */
native force_unmodified(force_type, mins[3] , maxs[3], const filename[]);
/* Checks if public variable with given name exists in loaded plugins. */
native xvar_exists( const name[] );
/* Returns an unique id for public variable specified by name. If such
* variable doesn't exist then returned value is -1. */
* variable doesn't exist then returned value is -1. */
native get_xvar_id( const name[] );
/* Returns an integer value of a public variable. Id is a value
* returned by get_xvar_id(...) native. */
* returned by get_xvar_id(...) native. */
native get_xvar_num( id );
/* Returns a float value of a public variable. Id is a value
* returned by get_xvar_id(...) native. */
* returned by get_xvar_id(...) native. */
native Float:get_xvar_float( id );
/* Sets a value of a public variable. Id is a value
* returned by get_xvar_id(...) native. */
* returned by get_xvar_id(...) native. */
native set_xvar_num( id, value = 0 );
/* Sets a float value of a public variable. Id is a value
* returned by get_xvar_id(...) native. */
* returned by get_xvar_id(...) native. */
native set_xvar_float( id, Float:value = 0.0 );

View File

@ -1,51 +1,51 @@
/* CS Stats functions
*
* (c) 2002-2004, OLO
* modified by BAILOPAN, Manip, PM, SniperBeamer
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
/* Gets stats from given weapon index. If wpnindex is 0
* then the stats are from all weapons. If weapon has not been used function
* returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* For body hits fields see amxconst.inc. */
* then the stats are from all weapons. If weapon has not been used function
* returns 0 in other case 1. Fields in stats are:
* 0 - kills
* 1 - deaths
* 2 - headshots
* 3 - teamkilling
* 4 - shots
* 5 - hits
* 6 - damage
* For body hits fields see amxconst.inc. */
native get_user_wstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets round stats from given weapon index.*/
native get_user_wrstats(index,wpnindex,stats[8],bodyhits[8]);
/* Gets overall stats which are stored in file on server
* and updated on every respawn or user disconnect.
* Function returns the position in stats by diff. kills to deaths. */
* and updated on every respawn or user disconnect.
* Function returns the position in stats by diff. kills to deaths. */
native get_user_stats(index,stats[8],bodyhits[8]);
/* Gets round stats of player. */
native get_user_rstats(index,stats[8],bodyhits[8]);
/* Gets stats with which user have killed/hurt his victim. If victim is 0
* then stats are from all victims. If victim has not been hurt, function
* returns 0 in other case 1. User stats are reset on his respawn. */
* then stats are from all victims. If victim has not been hurt, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_vstats(index,victim,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Gets stats with which user have been killed/hurt. If killer is 0
* then stats are from all attacks. If killer has not hurt user, function
* returns 0 in other case 1. User stats are reset on his respawn. */
* then stats are from all attacks. If killer has not hurt user, function
* returns 0 in other case 1. User stats are reset on his respawn. */
native get_user_astats(index,wpnindex,stats[8],bodyhits[8],wpnname[]="",len=0);
/* Resets life, weapon, victims and attackers user stats. */
native reset_user_wstats(index);
/* Gets overall stats which stored in stats.dat file in amx folder
* and updated on every mapchange or user disconnect.
* Function returns next index of stats entry or 0 if no more exists. */
* and updated on every mapchange or user disconnect.
* Function returns next index of stats entry or 0 if no more exists. */
native get_stats(index,stats[8],bodyhits[8],name[],len);
/* Returns number of all entries in stats. */

163
plugins/include/engine.inc Executable file
View File

@ -0,0 +1,163 @@
/* Engine
*
* (c) 2004, the AMX Mod X Development Team
* thanks to Vexd
*
* This file is provided as is (no warranties).
*/
#include <engine_const>
#include <engine_stocks>
/* This is a highly experimental command that will directly hook a message in the engine!
* You can overwrite the message before anything happens and either let the message continue
* or fully block it. Here is how it works:
* If you hook a message, the message is stored but not sent. You have the opportunity to
* not only execute code, but to get/set the contents of the message, before you choose to
* either block it or let it go on its way. The hooked function will be passed a msg_id. */
native register_message(iMsgId, szFunction[]);
/* The get/set _msg commands will utterly fail if used outside a hooked message scope.
* They should never, NEVER, EVER be used unless inside a registered message function.
* There are eight different ways of sending a message, five are ints, two are floats, and one is string.
* These are denoted by iArgType. msg_tid is the message you are hooking. argn is the number
* of the argument. Exceeding the bounds of 1 to get_msg_args() is a bad idea. */
/* Gets number of arguments that were passed to this message */
native get_msg_args(msg_id);
/* Gets the argument type of argument argn */
native get_msg_argtype(msg_id, argn);
/* Gets the value of argn. */
native get_msg_arg_int(msg_id, argn);
native Float:get_msg_arg_float(msg_id, argn);
native get_msg_arg_string(msg_id, argn, szReturn[], iLength);
/* sets the value of argn. */
native set_msg_arg_int(msg_id, argn, argtype, iValue);
native set_msg_arg_float(msg_id, argn, argtype, Float:fValue);
native set_msg_arg_string(msg_id, argn, szString[]);
/* Note, the offsets are passed as linux values, not windows values.
* Although the engine module will automatically calculate the difference,
* you must pass with the +5 linux offset (e.g. if 230 on windows, pass 235 no matter what) */
/* Gets pvPrivateData offset. */
native get_offset(id, offset);
native Float:get_offset_float(id, offset);
native get_offset_short(id, offset);
/* sets pvPrivateData offset. */
native set_offset(id, offset, value);
native set_offset_float(id, offset, Float:value);
native set_offset_short(id, offset);
/* Precaches any file. */
native precache_generic(szFile[]);
/* Sets/gets things in an entities Entvars Struct. */
native entity_get_int(iIndex, iKey);
native entity_set_int(iIndex, iKey, iVal);
native Float:entity_get_float(iIndex, iKey);
native entity_set_float(iIndex, iKey, Float:iVal);
native entity_get_vector(iIndex, iKey, Float:vRetVector[3]);
native entity_set_vector(iIndex, iKey, Float:vNewVector[3]);
native entity_get_edict(iIndex, iKey);
native entity_set_edict(iIndex, iKey, iNewIndex);
native entity_get_string(iIndex, iKey, szReturn[], iRetLen);
native entity_set_string(iIndex, iKey, szNewVal[]);
native entity_get_byte(iIndex, iKey);
native entity_set_byte(iIndex, iKey, iVal);
/* Creates an entity, will return the index of the created entity. ClassName must be valid. */
native create_entity(szClassname[]);
/* Finds an entity in the world, will return -1 if nothing is found */
native find_entity(iIndex, szClass[]);
native find_ent_by_owner(iIndex, szClass[], iOwner);
native find_ent_by_target(iIndex, szClass[]);
native find_ent_by_tname(iIndex, szClass[]);
native find_ent_by_model(iIndex, szClass[], szModel[]);
/* Is entity valid? */
native is_valid_ent(iIndex);
/* Proper origin setting, keeps updated with Half-Life engine. */
native entity_set_origin(iIndex, Float:fNewOrigin[3]);
/* Sets the model of an Entity. */
native entity_set_model(iIndex, szModel[]);
/* Remove an entity from the world. */
native remove_entity(iIndex);
/* Return current number of entities in the map */
native entity_count();
/* Simulate two entities colliding/touching. */
native fake_touch(iToucher, iTouched);
/* Dispatch a KeyValuePair, used for initalizing entities when a map spawns them. */
native DispatchKeyValue(iIndex, szKey[], szValue[]);
/* Runs the GameDLL's DispatchSpawn for an entity, I think it's used with DispatchKeyValue. */
native DispatchSpawn(iIndex);
/* Hurts/Kills players in a sphere, like an explosion, Multiplier determines damage. */
native RadiusDamage(Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier);
/* Gives you a velocity in the direction a player is looking, iVelocity is the multiplier. */
native VelocityByAim(iIndex, iVelocity, Float:vRetValue[3]);
/* Will return the contents of a point (inside map? in sky? outside map? etc.). */
native PointContents(Float:fCheckAt[3]);
/* Trace a line from Start(X, Y, Z) to End(X, Y, Z), will return the point hit in vReturn[3]
* and an entity index if an entity is hit. */
native trace_line(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3]);
/* Traces a line, and returns the normal to the plane hit in vReturn.
* Returns 0 if theres no normal. */
native trace_normal(iIgnoreEnt, Float:fStart[3], Float:fEnd[3], Float:vReturn[3]);
/* Changes a Vector to an Angle vector. */
native vector_to_angle(Float:fVector[3], Float:vReturn[3]);
/* Gets the length of a vector (float[3]). */
native Float:vector_length(Float:vVector[3]);
/* Gets the distance between 2 vectors (float[3]). */
native Float:vector_distance(Float:vVector[3], Float:vVector2[3]);
/* Gets the ID of a grenade. */
native get_grenade_id(id, model[], len, grenadeid = 0);
/* Gets gpGlobals->time from Half-Life */
native Float:halflife_time();
/* Sets map lighting, #OFF to disable. */
native set_lights(const Lighting[]);
// Sets/Gets what engine messages are blocked. */
native set_msg_block(iMessage, iMessageFlags);
native get_msg_block(iMessage);
/* Sets Player's View to entity iTargetIndex. */
native attach_view(iIndex, iTargetIndex);
/* Sets Player's View Mode. */
native set_view(iIndex, ViewType);
/* Called when 2 entities touch. */
forward pfn_touch(ptr, ptd);
/* Called once every server frame. May cause lag. */
forward server_frame();
/* Called when a client types kill in console. */
forward client_kill(id);
/* Forward for PreThink()/PostThink() on a player. */
forward client_PreThink(id);
forward client_PostThink(id);

305
plugins/include/engine_const.inc Executable file
View File

@ -0,0 +1,305 @@
/* Engine Constants
*
* (c) 2004, by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
#define SPEAK_NORMAL 0
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
#define SPEAK_LISTENALL 4
#define CAMERA_NONE 0
#define CAMERA_3RDPERSON 1
#define CAMERA_UPLEFT 2
#define CAMERA_TOPDOWN 3
#define BLOCK_NOT 0
#define BLOCK_ONCE 1
#define BLOCK_SET 2
enum {
ARG_BYTE = 1, /* int */
ARG_CHAR, /* int */
ARG_SHORT, /* int */
ARG_LONG, /* int */
ARG_ANGLE, /* float */
ARG_COORD, /* float */
ARG_STRING, /* string */
ARG_ENTITY, /* int */
}
/* Int */
enum {
EV_INT_gamestate = 0,
EV_INT_oldbuttons,
EV_INT_groupinfo,
EV_INT_iuser1,
EV_INT_iuser2,
EV_INT_iuser3,
EV_INT_iuser4,
EV_INT_weaponanim,
EV_INT_pushmsec,
EV_INT_bInDuck,
EV_INT_flTimeStepSound,
EV_INT_flSwimTime,
EV_INT_flDuckTime,
EV_INT_iStepLeft,
EV_INT_movetype,
EV_INT_solid,
EV_INT_skin,
EV_INT_body,
EV_INT_effects,
EV_INT_light_level,
EV_INT_sequence,
EV_INT_gaitsequence,
EV_INT_modelindex,
EV_INT_playerclass,
EV_INT_waterlevel,
EV_INT_watertype,
EV_INT_spawnflags,
EV_INT_flags,
EV_INT_colormap,
EV_INT_team,
EV_INT_fixangle,
EV_INT_weapons,
EV_INT_rendermode,
EV_INT_renderfx,
EV_INT_button,
EV_INT_impulse,
EV_INT_deadflag,
}
/* Float */
enum {
EV_FL_impacttime = 0,
EV_FL_starttime,
EV_FL_idealpitch,
EV_FL_pitch_speed,
EV_FL_ideal_yaw,
EV_FL_yaw_speed,
EV_FL_ltime,
EV_FL_nextthink,
EV_FL_gravity,
EV_FL_friction,
EV_FL_frame,
EV_FL_animtime,
EV_FL_framerate,
EV_FL_health,
EV_FL_frags,
EV_FL_takedamage,
EV_FL_max_health,
EV_FL_teleport_time,
EV_FL_armortype,
EV_FL_armorvalue,
EV_FL_dmg_take,
EV_FL_dmg_save,
EV_FL_dmg,
EV_FL_dmgtime,
EV_FL_speed,
EV_FL_air_finished,
EV_FL_pain_finished,
EV_FL_radsuit_finished,
EV_FL_scale,
EV_FL_renderamt,
EV_FL_maxspeed,
EV_FL_fov,
EV_FL_flFallVelocity,
EV_FL_fuser1,
EV_FL_fuser2,
EV_FL_fuser3,
EV_FL_fuser4,
}
/* Vector */
enum {
EV_VEC_origin = 0,
EV_VEC_oldorigin,
EV_VEC_velocity,
EV_VEC_basevelocity,
EV_VEC_clbasevelocity,
EV_VEC_movedir,
EV_VEC_angles,
EV_VEC_avelocity,
EV_VEC_punchangle,
EV_VEC_v_angle,
EV_VEC_endpos,
EV_VEC_startpos,
EV_VEC_absmin,
EV_VEC_absmax,
EV_VEC_mins,
EV_VEC_maxs,
EV_VEC_size,
EV_VEC_rendercolor,
EV_VEC_view_ofs,
EV_VEC_vuser1,
EV_VEC_vuser2,
EV_VEC_vuser3,
EV_VEC_vuser4,
}
/* Edict */
enum {
EV_ENT_chain = 0,
EV_ENT_dmg_inflictor,
EV_ENT_enemy,
EV_ENT_aiment,
EV_ENT_owner,
EV_ENT_groundentity,
EV_ENT_pContainingEntity,
EV_ENT_euser1,
EV_ENT_euser2,
EV_ENT_euser3,
EV_ENT_euser4,
}
/* String */
enum {
EV_SZ_classname = 0,
EV_SZ_globalname,
EV_SZ_model,
EV_SZ_target,
EV_SZ_targetname,
EV_SZ_netname,
EV_SZ_message,
EV_SZ_noise,
EV_SZ_noise1,
EV_SZ_noise2,
EV_SZ_noise3,
EV_SZ_viewmodel,
EV_SZ_weaponmodel,
}
/* Byte */
enum {
EV_BYTE_controller1 = 0,
EV_BYTE_controller2,
EV_BYTE_controller3,
EV_BYTE_controller4,
EV_BYTE_blending1,
EV_BYTE_blending2,
}
#define IN_ATTACK (1<<0)
#define IN_JUMP (1<<1)
#define IN_DUCK (1<<2)
#define IN_FORWARD (1<<3)
#define IN_BACK (1<<4)
#define IN_USE (1<<5)
#define IN_CANCEL (1<<6)
#define IN_LEFT (1<<7)
#define IN_RIGHT (1<<8)
#define IN_MOVELEFT (1<<9)
#define IN_MOVERIGHT (1<<10)
#define IN_ATTACK2 (1<<11)
#define IN_RUN (1<<12)
#define IN_RELOAD (1<<13)
#define IN_ALT1 (1<<14)
#define IN_SCORE (1<<15)
#define FL_FLY (1<<0) /* Changes the SV_Movestep() behavior to not need to be on ground */
#define FL_SWIM (1<<1) /* Changes the SV_Movestep() behavior to not need to be on ground (but stay in water) */
#define FL_CONVEYOR (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) /* Don't send entity to local host, it's predicting this entity itself */
#define FL_ONGROUND (1<<9) /* At rest / on the ground */
#define FL_PARTIALGROUND (1<<10) /* not all corners are valid */
#define FL_WATERJUMP (1<<11) /* player jumping out of water */
#define FL_FROZEN (1<<12) /* Player is frozen for 3rd person camera */
#define FL_FAKECLIENT (1<<13) /* JAC: fake client, simulated server side; don't send network messages to them */
#define FL_DUCKING (1<<14) /* Player flag -- Player is fully crouched */
#define FL_FLOAT (1<<15) /* Apply floating force to this entity when in water */
#define FL_GRAPHED (1<<16) /* worldgraph has this ent listed as something that blocks a connection */
#define FL_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19)
#define FL_PROXY (1<<20) /* This is a spectator proxy */
#define FL_ALWAYSTHINK (1<<21) /* Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path) */
#define FL_BASEVELOCITY (1<<22) /* Base velocity has been applied this frame (used to convert base velocity into momentum) */
#define FL_MONSTERCLIP (1<<23) /* Only collide in with monsters who have FL_MONSTERCLIP set */
#define FL_ONTRAIN (1<<24) /* Player is _controlling_ a train, so movement commands should be ignored on client during prediction. */
#define FL_WORLDBRUSH (1<<25) /* Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something) */
#define FL_SPECTATOR (1<<26) /* This client is a spectator, don't run touch functions, etc. */
#define FL_CUSTOMENTITY (1<<29) /* This is a custom entity */
#define FL_KILLME (1<<30) /* This entity is marked for death -- This allows the engine to kill ents at the appropriate time */
#define FL_DORMANT (1<<31) /* Entity is dormant, no updates to client */
#define SOLID_NOT 0 /* no interaction with other objects */
#define SOLID_TRIGGER 1 /* touch on edge, but not blocking */
#define SOLID_BBOX 2 /* touch on edge, block */
#define SOLID_SLIDEBOX 3 /* touch on edge, but not an onground */
#define SOLID_BSP 4 /* bsp clip, touch on edge, block */
#define MOVETYPE_NONE 0 /* never moves */
#define MOVETYPE_ANGLENOCLIP 1
#define MOVETYPE_ANGLECLIP 2
#define MOVETYPE_WALK 3 /* Player only - moving on the ground */
#define MOVETYPE_STEP 4 /* gravity, special edge handling -- monsters use this */
#define MOVETYPE_FLY 5 /* No gravity, but still collides with stuff */
#define MOVETYPE_TOSS 6 /* gravity/collisions */
#define MOVETYPE_PUSH 7 /* no clip to world, push and crush */
#define MOVETYPE_NOCLIP 8 /* No gravity, no collisions, still do velocity/avelocity */
#define MOVETYPE_FLYMISSILE 9 /* extra size to monsters */
#define MOVETYPE_BOUNCE 10 /* Just like Toss, but reflect velocity when contacting surfaces */
#define MOVETYPE_BOUNCEMISSILE 11 /* bounce w/o gravity */
#define MOVETYPE_FOLLOW 12 /* track movement of aiment */
#define MOVETYPE_PUSHSTEP 13 /* BSP model that needs physics/world collisions (uses nearest hull for world collision) */
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
#define CONTENTS_ORIGIN -7 /* removed at csg time */
#define CONTENTS_CLIP -8 /* changed to contents_solid */
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
#define CONTENTS_LADDER -16
#define DMG_GENERIC 0 /* generic damage was done */
#define DMG_CRUSH (1<<0) /* crushed by falling or moving object */
#define DMG_BULLET (1<<1) /* shot */
#define DMG_SLASH (1<<2) /* cut, clawed, stabbed */
#define DMG_BURN (1<<3) /* heat burned */
#define DMG_FREEZE (1<<4) /* frozen */
#define DMG_FALL (1<<5) /* fell too far */
#define DMG_BLAST (1<<6) /* explosive blast damage */
#define DMG_CLUB (1<<7) /* crowbar, punch, headbutt */
#define DMG_SHOCK (1<<8) /* electric shock */
#define DMG_SONIC (1<<9) /* sound pulse shockwave */
#define DMG_ENERGYBEAM (1<<10) /* laser or other high energy beam */
#define DMG_NEVERGIB (1<<12) /* with this bit OR'd in, no damage type will be able to gib victims upon death */
#define DMG_ALWAYSGIB (1<<13) /* with this bit OR'd in, any damage type can be made to gib victims upon death */
#define DMG_DROWN (1<<14) /* Drowning */
/* time-based damage */
#define DMG_TIMEBASED (~(0x3fff)) /* mask for time-based damage */
/* TF Additions */
#define DMG_PARALYZE (1<<15) /* slows affected creature down */
#define DMG_NERVEGAS (1<<16) /* nerve toxins, very bad */
#define DMG_POISON (1<<17) /* blood poisioning */
#define DMG_RADIATION (1<<18) /* radiation exposure */
#define DMG_DROWNRECOVER (1<<19) /* drowning recovery */
#define DMG_ACID (1<<20) /* toxic chemicals or acid burns */
#define DMG_SLOWBURN (1<<21) /* in an oven */
#define DMG_SLOWFREEZE (1<<22) /* in a subzero freezer */
#define DMG_MORTAR (1<<23) /* Hit by air raid (done to distinguish grenade from mortar) */
#define EF_BRIGHTFIELD 1 /* swirling cloud of particles */
#define EF_MUZZLEFLASH 2 /* single frame ELIGHT on entity attachment 0 */
#define EF_BRIGHTLIGHT 4 /* DLIGHT centered at entity origin */
#define EF_DIMLIGHT 8 /* player flashlight */
#define EF_INVLIGHT 16 /* get lighting from ceiling */
#define EF_NOINTERP 32 /* don't interpolate the next frame */
#define EF_LIGHT 64 /* rocket flare glow sprite */
#define EF_NODRAW 128 /* don't draw entity */

182
plugins/include/engine_stocks.inc Executable file
View File

@ -0,0 +1,182 @@
/* Engine Stocks
*
* (c) 2004, AssKicR, Freecode & T(+)rget
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
/* Changes an integer vec to a floating vec */
stock IVecFVec(IVec[3], Float:FVec[3])
{
FVec[0] = float(IVec[0])
FVec[1] = float(IVec[1])
FVec[2] = float(IVec[2])
return 1
}
/* Changes a float vec to an integer vec */
stock FVecIVec(Float:FVec[3], IVec[3])
{
IVec[0] = floatround(FVec[0])
IVec[1] = floatround(FVec[1])
IVec[2] = floatround(FVec[2])
return 1
}
/* Get the Button(s) user is pressing */
stock get_user_button(id)
return entity_get_int(id, EV_INT_button)
stock get_user_oldbutton(id)
return entity_get_int(id, EV_INT_oldbuttons)
/* Get flags an entity is flagged with */
stock get_entity_flags(ent)
return entity_get_int(ent, EV_INT_flags)
/* Get the distance between two entities */
stock get_entity_distance(ent1, ent2)
{
new Float:orig1[3], Float:orig2[3], origin1[3], origin2[3]
entity_get_vector(ent1, EV_VEC_origin, orig1)
for(new a = 0; a < 3; a++)
origin1[a] = floatround(orig1[a])
entity_get_vector(ent2, EV_VEC_origin, orig2)
for(new b = 0; b < 3; b++)
origin2[b] = floatround(orig2[b])
return get_distance(origin1, origin2)
}
/* Get grenade thrown by this user */
stock get_grenade(id)
{
new iGrenade = find_entity(-1, "grenade")
while(iGrenade > 0)
{
if(entity_get_edict(iGrenade, EV_ENT_owner) == id)
return iGrenade
iGrenade = find_entity(iGrenade, "grenade")
}
return 0
}
/* Get origin of a brush entity */
stock get_brush_entity_origin(ent, Float:orig[3])
{
new Float:Min[3], Float:Max[3]
entity_get_vector(ent, EV_VEC_mins, Min)
entity_get_vector(ent, EV_VEC_maxs, Max)
for(new a = 0; a < 3; a++)
orig[a] = (Min[a] + Max[a]) / 2
return orig[0] && orig[1] && orig[2]
}
/* Remove entity by name */
stock remove_entity_name(eName[])
{
new iEntity = FindEntity(-1, eName)
while (iEntity > 0)
{
remove_entity(iEntity)
iEntity = find_entity(-1, eName)
}
return 1
}
/* Get the contents of the point a user is aiming at */
stock ViewContents(id)
{
new origin[3],Float:Orig[3]
get_user_origin( id, origin, 3 )
for(new a = 0; a < 3; a++)
Orig[a] = float(origin[a])
return PointContents( Orig )
}
stock get_speed(ent)
{
new Float:Vel[3], rVel[3]
entity_get_vector(ent, EV_VEC_velocity, Vel)
for(new i = 0; i < 3; i++)
rVel[i] = floatround(Vel[i])
return sqroot(rVel[0] * rVel[0] + rVel[1] * rVel[1] + rVel[2] * rVel[2])
}
/* Creates a death message. */
stock make_deathmsg(killer,victim,headshot,weapon[])
{
message_begin(MSG_ALL,get_user_msgid("DeathMsg"),{0,0,0},0)
write_byte( killer )
write_byte( victim )
write_byte( headshot )
write_string( weapon[] )
message_end()
return 1
}
/* Kills a user without a message. */
stock user_silentkill(index)
{
set_msg_block(get_user_msgid("DeathMsg"),BLOCK_ONCE)
user_kill(index,1)
return 1
}
/* Set endering of an entity */
stock set_rendering(index,fx=kRenderFxNone, r=255,g=255,b=255, render=kRenderNormal,amount=16)
{
Entvars_Set_Int(index,EV_INT_renderfx,fx)
new Float:RenderColor[3]
RenderColor[0] = float(r)
RenderColor[1] = float(g)
RenderColor[2] = float(b)
Entvars_Set_Vector(index,EV_VEC_rendercolor,RenderColor)
Entvars_Set_Int(index,EV_INT_rendermode,render)
Entvars_Set_Float(index,EV_FL_renderamt,float(amount))
return 1
}
/* Set flags on an entity */
stock set_entity_flags(ent,flag,onoff)
{
if ((Entvars_Get_Int(ent,EV_INT_flags)&flag) > 0)
{
if (onoff == 1)
{
return 2
}
else
{
Entvars_Set_Int(ent,EV_INT_flags,Entvars_Get_Int(ent,EV_INT_flags)-flag)
return 1
}
}
else
{
if (onoff == 0)
{
return 2
}
else
{
Entvars_Set_Int(ent,EV_INT_flags,Entvars_Get_Int(ent,EV_INT_flags)+flag)
return 1
}
}
return 0
}

View File

@ -1,20 +1,20 @@
/* Files functions
*
* (c) 2002-2004, OLO
* modified by BAILOPAN, Manip, PM, SniperBeamer
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
/* Reads content from directory.
* Returns index of next element or 0 when end of dir. is reached. */
* Returns index of next element or 0 when end of dir. is reached. */
native read_dir(const dirname[],pos,output[],len,&outlen);
/* Reads line from file. Returns index of next line or 0 when end of file is reached. */
native read_file(const file[],line,text[],len,&txtlen);
/* Writes text to file. Function returns 0 on failure.
* When line is set to -1, the text is added at the end of file. */
* When line is set to -1, the text is added at the end of file. */
native write_file(const file[],const text[],line = -1);
/* Deletes file. Function returns 1 on success, 0 on failure. */
@ -24,7 +24,7 @@ native delete_file(const file[]);
native file_exists(const file[]);
/* Returns a file size in bytes if flag is set to 0.
When flag is set to 1 returns number of lines in the file,
and when flags is 2, function returns 1 if the file ends
with line feed. If file doesn't exist returns -1.*/
* When flag is set to 1 returns number of lines in the file,
* and when flags is 2, function returns 1 if the file ends
* with line feed. If file doesn't exist returns -1. */
native file_size(const file[], flag=0);

View File

@ -47,8 +47,8 @@ native Float:floatfract(Float:value);
native floatround(Float:value, floatround_method:method=floatround_round);
/* Compare two integers. If the two elements are equal, return 0.
* If the first argument is greater than the second argument, return 1,
* If the first argument is less than the second argument, return -1. */
* If the first argument is greater than the second argument, return 1,
* If the first argument is less than the second argument, return -1. */
native floatcmp(Float:fOne, Float:fTwo);
/* Return the square root of the input value, same as floatpower(value, 0.5) */
@ -61,7 +61,7 @@ native Float:floatpower(Float:value, Float:exponent);
native Float:floatlog(Float:value, Float:base=10.0);
/* Return the sine, cosine or tangent.
* The input angle may be in radian, degrees or grades. */
* The input angle may be in radian, degrees or grades. */
native Float:floatsin(Float:value, anglemode:mode=radian);
native Float:floatcos(Float:value, anglemode:mode=radian);
native Float:floattan(Float:value, anglemode:mode=radian);

View File

@ -1,35 +1,27 @@
/* Fun functions
*
* (c) 2002-2004, OLO
* modified by BAILOPAN, Manip, PM, SniperBeamer
*
* This file is provided as is (no warranties).
*/
*
* (c) 2004, the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
/* Sets who can listen who. Function returns 0
* if for some reasons this setting can't be done. */
native set_user_listening(receiver,sender,listen);
/* (untested) Returns 1 if receiver hears sender via voice communication. */
native get_client_listen(receiver, sender);
/* Returns 1 if receiver hears sender via voice communication. */
native get_user_listening(receiver,sender);
/* (untested) Sets who can listen who. Function returns 0 if for some reasons this setting can't be done. */
native set_client_listen(receiver, sender, listen);
/* Sets player godmode. If you want to disable godmode set only first parameter. */
native set_user_godmode(index,godmode = 0);
native set_user_godmode(index, godmode = 0);
/* Returns 1 if godmode is set. */
/* (untested) Returns 1 if godmode is set. */
native get_user_godmode(index);
/* Sets player noclip. If you want to disable noclip set only first parameter. */
native set_user_noclip(index,noclip = 0);
/* Returns 1 if noclip is set. */
native get_user_noclip(index);
/* Sets player frags. */
native set_user_frags(index,frags);
/* Sets player frags. Doesn't autoupdate scoreboard, as Olo's version didn't. Fix? */
native set_user_frags(index, frags);
/* Sets player armor. */
native set_user_armor(index,armor);
native set_user_armor(index, armor);
/* Sets player health. */
native set_user_health(index, health);
@ -38,46 +30,61 @@ native set_user_health(index, health);
native set_user_origin(index, origin[3]);
/* Sets player rendering mode. */
native set_user_rendering(index,fx = kRenderFxNone, r=255,g=255,b=255, render = kRenderNormal,amount=16);
native set_user_rendering(index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16);
/* Gives item to player, name of item can start
* with weapon_, ammo_ and item_. This event
* is announced with proper message to all players. */
native give_item(index,const item[]);
* with weapon_, ammo_ and item_. This event
* is announced with proper message to all players. */
native give_item(index, const item[]);
/* Sets hit zones for player. This event is announced
* with proper message to all players.
* Parts of body are as bits:
* 2 - head
* 4 - chest
* 8 - stomach
* 16 - left arm
* 32 - right arm
* 64 - left leg
* 128 - right leg*/
native set_user_hitzones(index=0,target=0,body=255);
/* (not yet implemented, don't know how to use native)
* Sets hit zones for player. This event is announced
* with proper message to all players.
* Parts of body are as bits:
* 2 - head
* 4 - chest
* 8 - stomach
* 16 - left arm
* 32 - right arm
* 64 - left leg
* 128 - right leg */
native set_hitzones(body = 255);
/* Returns hit zones for player. */
native get_user_hitzones(index,target);
/* backwards compatibility */
stock set_user_hitzones(index=0,target=0,body=255)
return set_hitzones(body)
/* Makes that player spawns. This event is announced
* with proper message to all players. */
native user_spawn(index);
/* Get current hitzones. */
native get_hitzones();
/* backwards compatibility */
stock get_user_hitzones(index,target)
return get_hitzones()
/* Sets users max. speed. */
native set_user_maxspeed(index,Float:speed=-1.0);
native set_user_maxspeed(index, Float:speed = -1.0);
/* Returns users max. speed. */
native Float:get_user_maxspeed(index);
/* Sets users gravity. */
native set_user_gravity(index,Float:gravity=1.0);
native set_user_gravity(index, Float:gravity = 1.0);
/* Returns users gravity. */
native Float:get_user_gravity(index);
native get_user_gravity(index);
/* Gives money to user. */
native set_user_money(index,money,flash=1);
native set_user_money(index, money, flash = 1);
/* Returns users money. */
native get_user_money(index);
/* Spawns entity. */
native spawn(index);
/* backwards compatibility */
stock user_spawn(index)
return spawn(index)
/* CS: Set deaths(should be removed to CS module later) (doesn't update info right away? fix later?) */
native set_user_deaths_cs(index, newdeaths);

View File

@ -1,14 +1,14 @@
/* MySQL functions
*
* (c) Copyright 2002-2004, dJeyL
* modified by BAILOPAN, Manip, PM, SniperBeamer
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
/* Opens connection. If already such exists then that will be used.
* Function returns sql id to use with other sql natives.
* Host can be plain ip or with port seperated with ':' char. */
* Function returns sql id to use with other sql natives.
* Host can be plain ip or with port seperated with ':' char. */
native mysql_connect(host[],user[],pass[],dbname[],error[],maxlength);
/* Uses an existing connection (sql) to perform a new query (query) (might close previous query if any). */

View File

@ -1,29 +1,29 @@
/* Strings manipulation
*
* (c) 2002-2004, OLO
* modified by BAILOPAN, Manip, PM, SniperBeamer
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
/* Checks if source contains string. On success function
* returns position in source, on failure returns -1. */
* returns position in source, on failure returns -1. */
native contain(const source[],const string[]);
/* Checks if source contains string with case ignoring. On success function
* returns position in source, on failure returns -1. */
* returns position in source, on failure returns -1. */
native containi(const source[],const string[]);
/* Replaces given string to another in given text. */
native replace(text[],len,const what[],const with[]);
/* Adds one string to another. Last parameter different from 0, specifies
* how many chars we want to add. Function returns number of all merged chars. */
* how many chars we want to add. Function returns number of all merged chars. */
native add(dest[],len,const src[],max=0);
/* Fills string with given format and parameters.
* Function returns number of copied chars.
* Example: format(dest,"Hello %s. You are %d years old","Tom",17). */
* Function returns number of copied chars.
* Example: format(dest,"Hello %s. You are %d years old","Tom",17). */
native format(output[] ,len ,const format[] , {Float,_}:...);
/* Gets parameters from function as formated string. */
@ -38,29 +38,29 @@ native str_to_num(const string[]);
native strtonum(const string[]);
/* Checks if two strings equal. If len var is set
* then there are only c chars comapred. */
* then there are only c chars comapred. */
native equal(const a[],const b[],c=0);
/* Checks if two strings equal with case ignoring.
* If len var is set then there are only c chars comapred. */
* If len var is set then there are only c chars comapred. */
native equali(const a[],const b[],c=0);
/* Copies one string to another. By len var
* you may specify max. number of chars to copy. */
* you may specify max. number of chars to copy. */
native copy(dest[],len,const src[]);
/* Copies one string to another until char ch is found.
* By len var you may specify max. number of chars to copy. */
* By len var you may specify max. number of chars to copy. */
native copyc(dest[],len,const src[],ch);
/* Sets string with given character. */
native setc(src[],len,ch);
/* Gets parameters from text.
* Example: to split text: "^"This is^" the best year",
* call function like this: parse(text,arg1,len1,arg2,len2,arg3,len3,arg4,len4)
* and you will get: "This is", "the", "best", "year"
* Function returns number of parsed parameters. */
* Example: to split text: "^"This is^" the best year",
* call function like this: parse(text,arg1,len1,arg2,len2,arg3,len3,arg4,len4)
* and you will get: "This is", "the", "best", "year"
* Function returns number of parsed parameters. */
native parse(const text[], ... );
/* Converts all chars in string to lower case. */

View File

@ -1,14 +1,14 @@
/* Vault
*
* (c) 2002-2004, OLO
* modified by BAILOPAN, Manip, PM, SniperBeamer
* modified by the AMX Mod X Development Team
*
* This file is provided as is (no warranties).
*/
/* Reads a data from given key.
* If len is set to zero then get_vaultdata
* returns value as an number. */
* If len is set to zero then get_vaultdata
* returns value as an number. */
native get_vaultdata(const key[], data[] = "", len = 0);
/* Sets a data under given key. */