From 722cd230653413213aec6cf0411eb999c98780f9 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sat, 21 Aug 2004 21:55:57 +0000 Subject: [PATCH] Added NS module incs --- plugins/include/ns.inc | 176 +++++++++++++++++ plugins/include/ns2amxx.inc | 95 --------- .../{ns2amxx_const.inc => ns_const.inc} | 187 +++++++----------- 3 files changed, 248 insertions(+), 210 deletions(-) create mode 100755 plugins/include/ns.inc delete mode 100755 plugins/include/ns2amxx.inc rename plugins/include/{ns2amxx_const.inc => ns_const.inc} (61%) diff --git a/plugins/include/ns.inc b/plugins/include/ns.inc new file mode 100755 index 00000000..25cf83ec --- /dev/null +++ b/plugins/include/ns.inc @@ -0,0 +1,176 @@ +/* NS module functions + * - + * (c) 2004, Steve Dudenhoeffer + * This file is provided as is (no warranties). + */ + +#if defined NS_INC + #endinput +#endif +#define NS_INC + + +#include + + +/* Called whenever the client's class is changed. The classes given match get_class() output */ +forward client_changeclass(id,newclass,oldclass); + +/* Called whenever the client build's a structure. If type is 1, it's a marine structure, if type is 2, it's alien. */ +forward client_built(idPlayer,idStructure,type,impulse); + +/* Returns if the map's combat or not. */ +native ns_is_combat(); + +/* Sends a popup to a player. Set target to 0 to send to everybody. Message length is 188 characters. The last parameter, if set to 1, will only display when the player has cl_autohelp set to 1. */ +native ns_popup(target,szMsg[180],ah=0) + +/* Sets a player model. Omit the second parameter to return to default. + Note: This does *not* change back on death, team switch, gestations, etc. */ +native ns_set_player_model(id,szModel[]=""); + +/* Sets a player's skin. Omit second parameter to return to default. + Note: This does *not* change back on death, team switch, gestations, etc. */ +native ns_set_player_skin(id,skin=-1); + +/* Sets a player's body. Omit second parameter to return to default. + Note: This does *not* change back on death, team switch, gestations, etc. */ +native ns_set_player_body(id,body=-1); + +/* Sets a player's speedchange. Omit the second parameter to return to default */ +native ns_set_speedchange(id,speedchange=0); + +/* Returns a player's current speedchange. */ +native ns_get_speedchange(id); + +/* Returns a player's max speed before the speed change is factored in. */ +native ns_get_maxspeed(id); + +/* Returns whether or not this mask is set from the entity's iuser4 field. Use the "mask" enum for reference. */ +native ns_get_mask(id,mask); + +/* Sets or removes the mask from the entity's iuser4 field. Set "value" to 1 to turn the mask on, 0 to turn it off. */ +native ns_set_mask(id,mask,value); + +/* Returns built/unbuilt structures. + If: + builtOnly is 1 (default): + Only fully built structures are counted. + builtOnly is 0: + Any structure meeting the classname is counted. + + Number is 0 (default): + The total number of matching structures is returned. + Number is any other value: + The index of the #th matching structure is returned. +*/ +native ns_get_build(classname[],builtOnly=1,Number=0); + +/* Returns if the player has the weapon or not in their pev->weapons field. + set "setweapon" to 0 to turn the bit off, set to 1 to turn it on. Or omit it to just return the value. */ +native ns_has_weapon(id,NSWeapon:weapon,setweapon=-1); + +/* Gets spawn point for specified team (type). + If: + Team is equal to 0: + Ready room spawns are returned. + Team is greater than 0: + Spawns for the team are returned. + + Number is equal to 0: + Total number of spawns is returned. + Number is greater than 0: + The location of the specified spawn is returned. +*/ +native ns_get_spawn(team,number=0,Float:ret[3]); + +/* Configures display of the custom menus. This display is _very_ similar to set_hudmessage() */ +native ns_set_menu(id,r=NSMENU_R,g=NSMENU_G,b=NSMENU_B,Float:x=NSMENU_X,Float:y=NSMENU_Y, effects=0, Float:fadeintime=0.0, Float:fadeouttime=0.0,channel1=NSMENU_CHAN1,channel2=NSMENU_CHAN2); + +/* Displays a custom menu. It will execute command(id,keys) when the menu is pressed. */ +native ns_show_menu(id,szCommand[],szText[],keys,time); + +/* Returns the class of the player. Look in the classes enum in ns_const.inc for the value's meaning. */ +native ns_get_class(id); + +/* Returns a player's percentage of JP fuel */ +native Float:ns_get_jpfuel(id); + +/* Sets a player's percentage of JP fuel */ +native ns_set_jpfuel(id,Float:fuel); + +/* Returns a player's percentage of adrenaline (alien) */ +native Float:ns_get_energy(id); + +/* Sets a player's percentage of adrenaline */ +native ns_set_energy(id,Float:energy); + +/* Returns a player's resources. (alien only) */ +native Float:ns_get_res(id); + +/* Sets a player's resources. (alien only) */ +native ns_set_res(id,Float:res); + +/* Returns a player's experience (combat only) */ +native Float:ns_get_exp(id); + +/* Sets a player's experience (combat only) */ +native ns_set_exp(id,Float:exp); + +/* Gets a player's point spent value in combat */ +native ns_get_points(id); + +/* Sets a player's point spent value in combat */ +native ns_set_points(id,points); + +/* Gets a weapon's damage (use the weapon index, not the player) */ +native Float:ns_get_weap_dmg(idWeapon); + +/* Sets a weapon's damage (use the weapon index, not the player) */ +native ns_set_weap_dmg(idWeapon,Float:damage); + +/* Gets a weapon's range (use the weapon index, not the player) */ +native Float:ns_get_weap_range(idWeapon); + +/* Sets a weapon's range (use the weapon index, not the player) */ +native ns_set_weap_range(idWeapon,Float:range); + +/* Gets a weapon's clip ammo (use the weapon index, not the player) */ +native ns_get_weap_clip(idWeapon); + +/* Sets a weapon's clip ammo (use the weapon index, not the player) */ +native ns_set_weap_clip(idWeapon,clipsize); + +/* Gets the player's weapon reserve for the specified type of weapon. + Look in ns_const.inc for the weapon enum. */ +native ns_get_weap_reserve(id,weapon); + +/* Sets the player's weapon reserve for the specified type of weapon. + Look in ns_const.inc for the weapon enum. */ +native ns_set_weap_reserve(id,weapon,ammo); + +/* Gets a player's score. Note: score from level is automatically factored into the scoreboard display in combat. */ +native ns_get_score(idPlayer); + +/* Sets a player's score. Note: score from level is automatically factored into the scoreboard display in combat. */ +native ns_set_score(idPlayer,score); + +/* Gets a player's death count. */ +native ns_get_deaths(idPlayer); + +/* Sets a player's death count. */ +native ns_set_deaths(idPlayer,numdeaths); + +/* Gets a player's icon value (from the scoreboard) is a bitmask. Use enum "icons" for values. Returns -1 for unauthed */ +native ns_get_icon(idPlayer); + +/* Sets a player's icon value. */ +native ns_set_icon(idPlayer,iconvalue); + +/* Gets the trait type tied to the hive. Look at the hivetrait enum for the values. */ +native ns_get_hive_trait(idHive); + +/* Sets the trait type tied to the hive. Look at the hivetrait enum for the values. */ +native ns_set_hive_trait(idHive,trait); + +native ns_set_fov(idPlayer,Float:_fov=0.0); diff --git a/plugins/include/ns2amxx.inc b/plugins/include/ns2amxx.inc deleted file mode 100755 index ecc981d3..00000000 --- a/plugins/include/ns2amxx.inc +++ /dev/null @@ -1,95 +0,0 @@ -/* NS2AMX.INC - * Declares all natives/forwards for the ns2amxx module. - * version 0.2 - */ -#if defined __ns2amxx__ - #endinput -#endif -#define __ns2amxx__ 02 -#include - -/* Returns the number of specified entities in map if value is 0 - otherwise it returns the index of the #th entity of that class. */ -native ns_get_ent(classname[],Value); - -/* Same as get_ent, but only returns fully built structures (if Value > 0) */ -native ns_get_build(classname[],Value,Number=0); - -/* Get's spawn point for specified team (type). */ -native ns_get_spawn(type,number=0,Float:ret[3]); - -/* Returns 1 if the map is combat, 0 otherwise. */ -native ns_is_combat() - -/* Used to change the speed of players. Since this can vary, a static speed isn't set. - Rather, the module will add the speedchange to the player's maxspeed every frame. - Set speedchange to a negative value to slow the player down. */ -native ns_get_speedchange(id) -native ns_set_speedchange(id,speed) -native ns_get_maxspeed(id) - -/* Forces a player to spawn. I would not use this while the player's deadflags = 1 or 0. - Only use when the player is dead with deadflags of 2 or higher. - For class, use the fields specified in the NS Mini SDK (1=marine,3=skulk,4=gorge,5=lerk,6=fade,7=onos) */ -native ns_spawn_player(id,class=1,health=100,armor=25) - -/* Configures display of the custom menus. This display is _very_ similar to set_hudmessage() */ -native ns_set_menu(id,r=NSMENU_R,g=NSMENU_G,b=NSMENU_B,x=NSMENU_X,y=NSMENU_Y, effects=0, Float:fadeintime=0.0, Float:fadeouttime=0.0,channel1=4,channel2=3) - -/* Displays a custom menu. It will execute command(id,keys) when the menu is pressed. */ -native ns_show_menu(id,szCommand[],szText[],keys,time) - -/* Forces ns2amx to set the player's model/skin/body to the specified each frame. - Note that the model will not go back to standard when the player dies/changes classes. - Your plugin will have to tell the module to stop using the custom model. - Leave the second parameter out of any of these commands to force the module to go back to standard. */ -native ns_set_player_model(id,szModel[]="") -native ns_set_player_skin(id,skin=-1) -native ns_set_player_body(id,body=-1) - -native ns_getammo(id,Weapon); - -native ns_setammo(id,Weapon,Value); - -native ns_giveitem(id,svClassname[]); - - -native ns_moveto(idMoved,idDest) - -native ns_isdigesting(id); - -native ns_nspopup(id,svMessage[190]); - -native ns_setres(id,value); - -native ns_getenergy(id); - -native ns_setenergy(id,energy); - -native ns_getjpfuel(id); - -native ns_setjpfuel(id,fuel); - -native ns_get_mask(id,mask); - -native ns_set_mask(id,mask,value); - -native ns_get_special(id,mask); - -native ns_get_res(id); - -native ns_get_class(id); - -stock ns_gethives() -{ - return ns_get_build("team_hive",1) -} - -stock ns_inrange(ida,idb,range) -{ - if (entity_get_range(ida,idb) <= range) - { - return 1 - } - return 0 -} \ No newline at end of file diff --git a/plugins/include/ns2amxx_const.inc b/plugins/include/ns_const.inc similarity index 61% rename from plugins/include/ns2amxx_const.inc rename to plugins/include/ns_const.inc index 95183683..168d6e09 100755 --- a/plugins/include/ns2amxx_const.inc +++ b/plugins/include/ns_const.inc @@ -1,17 +1,14 @@ -/* NS2AMXDEFINES.INC - * Various enums and definitions required for the ns2amx module. - * Version 1.0 +/* NS module constants + * - + * (c) 2004, Steve Dudenhoeffer + * This file is provided as is (no warranties). */ -#if defined __ns2amxxdefines__ - #endinput + +#if defined NS_CONST_INC + #endinput #endif -#define __ns2amxxdefines__ 02 - -// Set this to either 3 or 2. If set to two, it will do NS 2.01 offsets. -// If set to 3, it will do the most recent NS 3.0 offsets. -#define NS_VERSION 3 - +#define NS_CONST_INC // These values are customizable (for the custom menus) // If your menu uses the default menu scheme, then it will use this. @@ -21,102 +18,10 @@ #define NSMENU_G 200 #define NSMENU_B 100 +#define NSMENU_CHAN1 2 +#define NSMENU_CHAN2 3 - - -#if NS_VERSION == 3 -#define PRIVATE_ALIEN_RES 0x190 -#define PRIVATE_AMMO_LMG 0xE6 -#define PRIVATE_AMMO_PISTOL 0xE7 -#define PRIVATE_AMMO_SHOTGUN 0xE8 -#define PRIVATE_AMMO_HMG 0xE9 -#define PRIVATE_AMMO_GL 0xEA - -//Thanks, voogru -#define PRIVATE_LEVELS_SPENT_WIN 0x62D -#define PRIVATE_EXPERIENCE_WIN 0x615 -#define PRIVATE_LEVELS_SPENT_LINUX 0x62D -#define PRIVATE_EXPERIENCE_LINUX 0x612 - -#else - -#define PRIVATE_ALIEN_RES 0x18E -#define PRIVATE_AMMO_LMG 0xE6 -#define PRIVATE_AMMO_PISTOL 0xE7 -#define PRIVATE_AMMO_SHOTGUN 0xE8 -#define PRIVATE_AMMO_HMG 0xE9 -#define PRIVATE_AMMO_GL 0xEA -#endif - -// Used for anglevector() -#define ANGLEVECTOR_FORWARD 1 -#define ANGLEVECTOR_RIGHT 2 -#define ANGLEVECTOR_UP 3 - -// used for gpglobals_return() -#define GPGLOBALS_FORWARD 1 -#define GPGLOBALS_RIGHT 2 -#define GPGLOBALS_UP 3 - -// Used for get_class -#define CLASS_UNKNOWN 0 -#define CLASS_SKULK 1 -#define CLASS_GORGE 2 -#define CLASS_LERK 3 -#define CLASS_FADE 4 -#define CLASS_ONOS 5 -#define CLASS_MARINE 6 -#define CLASS_JETPACK 7 -#define CLASS_HEAVY 8 -#define CLASS_COMMANDER 9 -#define CLASS_GESTATE 10 -#define CLASS_DEAD 11 -#define CLASS_NOTEAM 12 -// used for trace_hull -#define HULL_POINT 0 -#define HULL_HUMAN 1 -#define HULL_LARGE 2 -#define HULL_HEAD 3 - - // Taken from the NS mini SDK -enum -{ - WEAPON_NONE = 0, - WEAPON_CLAWS, - WEAPON_SPIT, - WEAPON_SPORES, - WEAPON_SPIKE, - WEAPON_BITE, - WEAPON_BITE2, - WEAPON_SWIPE, - WEAPON_WEBSPINNER, - WEAPON_METABOLIZE, - WEAPON_PARASITE, - WEAPON_BLINK, - WEAPON_DIVINEWIND, - WEAPON_KNIFE, - WEAPON_PISTOL, - WEAPON_MG, - WEAPON_SHOTGUN, - WEAPON_HMG, - WEAPON_WELDER, - WEAPON_MINE, - WEAPON_GRENADE_GUN, - WEAPON_LEAP, - WEAPON_CHARGE, - WEAPON_UMBRA, - WEAPON_PRIMALSCREAM, - WEAPON_BILEBOMB, - WEAPON_ACIDROCKET, - WEAPON_HEALINGSPRAY, - WEAPON_HANDGRENADE, - WEAPON_STOMP, - WEAPON_DEVOUR, - WEAPON_MAX -} -#define WEAPON_BABBLER WEAPON_HANDGRENADE -// A few of the AvHSpecials.h iuser4 flags, modified for ease-of-use... -enum +enum masks { MASK_NONE = 0, MASK_SIGHTED = 1, @@ -171,12 +76,64 @@ enum } -#if !defined NULL -#define NULL 0 -#endif -#if !defined FALSE -#define FALSE 0 -#endif -#if !defined TRUE -#define TRUE 1 -#endif + +enum classes +{ + CLASS_UNKNOWN = 0, + CLASS_SKULK, + CLASS_GORGE, + CLASS_LERK, + CLASS_FADE, + CLASS_ONOS, + CLASS_MARINE, + CLASS_JETPACK, + CLASS_HEAVY, + CLASS_COMMANDER, + CLASS_GESTATE, + CLASS_DEAD, + CLASS_NOTEAM +} + +enum weapons +{ + WEAPON_NONE = 0, + WEAPON_CLAWS, + WEAPON_SPIT, + WEAPON_SPORES, + WEAPON_SPIKE, + WEAPON_BITE, + WEAPON_BITE2, + WEAPON_SWIPE, + WEAPON_WEBSPINNER, + WEAPON_METABOLIZE, + WEAPON_PARASITE, + WEAPON_BLINK, + WEAPON_DIVINEWIND, + WEAPON_KNIFE, + WEAPON_PISTOL, + WEAPON_LMG, + WEAPON_SHOTGUN, + WEAPON_HMG, + WEAPON_WELDER, + WEAPON_MINE, + WEAPON_GRENADE_GUN, + WEAPON_LEAP, + WEAPON_CHARGE, + WEAPON_UMBRA, + WEAPON_PRIMALSCREAM, + WEAPON_BILEBOMB, + WEAPON_ACIDROCKET, + WEAPON_HEALINGSPRAY, + WEAPON_GRENADE, + WEAPON_STOMP, + WEAPON_DEVOUR, + WEAPON_MAX +} + +enum hivetraits +{ + HIVETRAIT_NONE = 0, + HIVETRAIT_DC = 92, + HIVETRAIT_SC = 93, + HIVETRAIT_MC = 94 +} \ No newline at end of file