2004-06-29 19:38:03 +00:00
|
|
|
/* NS2AMX Utility backwards compatibility
|
|
|
|
*
|
|
|
|
* by the AMX Mod X Development Team
|
|
|
|
*
|
|
|
|
* This file is provided as is (no warranties).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined _ns2amx_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _ns2amx_included
|
|
|
|
|
2004-08-24 21:36:39 +00:00
|
|
|
#include <engine> // various engine calls
|
|
|
|
#include <fakemeta> // pev/engfunc/dllfunc/various calls which rely on engfunc/dllfunc
|
|
|
|
#include <ns> // ns specifics
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock is_entity(id)
|
2007-03-05 19:30:40 +00:00
|
|
|
return is_valid_ent(id);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
2004-08-24 21:36:39 +00:00
|
|
|
/* The end of the native is buffered incase the plugin is including an NS_VERSION (no longer supported), ignore it */
|
2004-09-07 09:26:20 +00:00
|
|
|
stock get_build(classname[], value, number=0,{Float,Sql,Result,_}:...)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_build(classname, value, number);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock get_private_i(index, offset, linuxdiff=5)
|
2007-03-05 19:30:40 +00:00
|
|
|
return get_pdata_int(index, offset, linuxdiff);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock set_private_i(index, offset, value, linuxdiff=5)
|
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
return set_pdata_int(index, offset, value, linuxdiff);
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stock Float:get_private_f(index, offset, linuxdiff=5)
|
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
return get_pdata_float(index, offset, linuxdiff);
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
2004-10-24 01:09:07 +00:00
|
|
|
stock set_private_f(index, offset, Float:value, linuxdiff=5)
|
2004-06-29 19:38:03 +00:00
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
return set_pdata_float(index, offset, value, linuxdiff);
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stock make_string(value[])
|
2007-03-05 19:30:40 +00:00
|
|
|
return engfunc(EngFunc_AllocString,value);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock string(value, ret[])
|
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
new szString[128];
|
|
|
|
engfunc(EngFunc_SzFromIndex,value,szString,127);
|
|
|
|
copy(ret,127,szString);
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stock gpgobals_time()
|
2007-03-05 19:30:40 +00:00
|
|
|
return floatround(halflife_time());
|
2004-06-29 19:38:03 +00:00
|
|
|
|
2004-10-18 21:00:25 +00:00
|
|
|
stock Float:get_range(ida, idb)
|
2007-03-05 19:30:40 +00:00
|
|
|
return entity_range(ida, idb);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock supercede()
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock register_clientkill()
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock register_changelvl()
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock register_msgblock(msgName[])
|
2007-03-05 19:30:40 +00:00
|
|
|
return set_msg_block(get_user_msgid(msgName), BLOCK_SET);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock register_msgedit(msgName[], cmd[])
|
2007-03-05 19:30:40 +00:00
|
|
|
return register_message(get_user_msgid(msgName), cmd);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock register_playback(event, cmd[])
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
2004-10-24 01:09:07 +00:00
|
|
|
stock get_spawn(type, number=0, Float:ret[3])
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_spawn(type, number, ret);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock has_weapon(index, weapon, setweapon=-1)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_has_weapon(index, weapon, setweapon);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock gpglobals_v(type, Float:ret[3])
|
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
new v_type=0;
|
2004-08-24 21:36:39 +00:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case 1:
|
2007-03-05 19:30:40 +00:00
|
|
|
v_type = GL_v_forward;
|
2004-08-24 21:36:39 +00:00
|
|
|
case 2:
|
2007-03-05 19:30:40 +00:00
|
|
|
v_type = GL_v_right;
|
2004-08-24 21:36:39 +00:00
|
|
|
case 3:
|
2007-03-05 19:30:40 +00:00
|
|
|
v_type = GL_v_up;
|
2004-08-24 21:36:39 +00:00
|
|
|
}
|
|
|
|
if (!v_type)
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
|
|
|
return get_global_vector(v_type, ret);
|
2004-08-24 21:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stock pev_i(_index,_field)
|
2007-03-05 19:30:40 +00:00
|
|
|
return pev(_index,_field);
|
2004-08-24 21:36:39 +00:00
|
|
|
|
|
|
|
stock set_pev_i(_index, _field, _val)
|
2007-03-05 19:30:40 +00:00
|
|
|
return set_pev(_index,_field,_val);
|
2004-08-24 21:36:39 +00:00
|
|
|
|
|
|
|
stock Float:pev_f(_index,_field)
|
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
new Float:f;
|
|
|
|
pev(_index,_field,f);
|
|
|
|
return f;
|
2004-08-24 21:36:39 +00:00
|
|
|
}
|
|
|
|
stock set_pev_f(_index,_field,Float:_val)
|
2007-03-05 19:30:40 +00:00
|
|
|
return set_pev(_index,_field,_val);
|
2004-08-24 21:36:39 +00:00
|
|
|
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock msg_args()
|
2007-03-05 19:30:40 +00:00
|
|
|
return get_msg_args();
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock Float:msg_loc(vec)
|
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
new Float:Ret[3];
|
|
|
|
get_msg_origin(Ret);
|
2004-06-29 19:38:03 +00:00
|
|
|
if (vec < 0 || vec > 3)
|
2007-03-05 19:30:40 +00:00
|
|
|
return float(0);
|
2004-06-29 19:38:03 +00:00
|
|
|
else
|
2007-03-05 19:30:40 +00:00
|
|
|
return Ret[vec];
|
|
|
|
|
|
|
|
return 0.0; // make compiler happy!
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stock msg_dest()
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_type()
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_name()
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_set_s(number, value[])
|
2007-03-05 19:30:40 +00:00
|
|
|
return set_msg_arg_string(number, value);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_set_f(number, Float:value)
|
2007-03-05 19:30:40 +00:00
|
|
|
return set_msg_arg_float(number, get_msg_argtype(number), value);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_set_i(number, value)
|
2007-03-05 19:30:40 +00:00
|
|
|
return set_msg_arg_int(number, get_msg_argtype(number), value);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_data_type(value)
|
2007-03-05 19:30:40 +00:00
|
|
|
return get_msg_argtype(value);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_strdata(value)
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_data(value, ...)
|
2004-10-05 19:02:15 +00:00
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
return (0*value);
|
2004-10-05 19:02:15 +00:00
|
|
|
}
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock get_filename(szFile[], len=-1)
|
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
new name[16], version[16], author[16], status[16];
|
|
|
|
new res = get_plugin(0, szFile, len, name, 16, version, 16, author, 16, status, 16);
|
|
|
|
return res;
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
2004-08-24 21:36:39 +00:00
|
|
|
stock get_speedchange(id)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_speedchange(id);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock set_speedchange(id, speed)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_speedchange(id,speed);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock get_maxspeed(id)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_maxspeed(id);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock set_player_model(id, model[]="")
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_player_model(id, model);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock set_player_skin(id, skin=-1)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_player_skin(id, skin);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock set_player_body(id, body=-1)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_player_body(id, body);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock ns2amx_version()
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock set_kvhandled()
|
2007-03-05 19:30:40 +00:00
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock ns2amx_getammo(id,Weapon)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_weap_reserve(id, Weapon);
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_setammo(id,Weapon,Value)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_weap_reserve(id, Weapon, Value);
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_giveitem(id,svClassname[])
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_give_item(id, svClassname);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock ns2amx_moveto(idMoved,idDest)
|
|
|
|
{
|
2007-03-05 19:30:40 +00:00
|
|
|
new Float:origin[3];
|
|
|
|
entity_get_vector(idDest, EV_VEC_origin,origin);
|
|
|
|
entity_set_origin(idMoved, origin);
|
|
|
|
return 1;
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
/* Returns whether or not the player has the MASK_DIGESTING flag set. */
|
|
|
|
stock ns2amx_isdigesting(id)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_mask(id,MASK_DIGESTING);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
/* Returns total # of active hives. */
|
|
|
|
stock ns2amx_gethives()
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_build("team_hive",1);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
/* Returns 1 if the two entities are within the given range. */
|
|
|
|
stock ns2amx_inrange(ida,idb,range)
|
|
|
|
{
|
2004-09-19 00:52:15 +00:00
|
|
|
if (entity_range(ida,idb) <= range)
|
2007-03-05 19:30:40 +00:00
|
|
|
return 1;
|
|
|
|
return 0;
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
2004-11-01 17:15:13 +00:00
|
|
|
stock ns2amx_nspopup(id,svMessage[190]) {
|
2007-03-05 19:30:40 +00:00
|
|
|
new szMessage[180];
|
|
|
|
copy(szMessage,179,svMessage);
|
|
|
|
return ns_popup(id, szMessage);
|
2004-11-01 17:15:13 +00:00
|
|
|
}
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_setres(id,value)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_res(id, float(value));
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_getenergy(id)
|
2007-03-05 19:30:40 +00:00
|
|
|
return floatround(ns_get_energy(id));
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_setenergy(id,energy)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_energy(id, float(energy));
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_getjpfuel(id)
|
2007-03-05 19:30:40 +00:00
|
|
|
return floatround(ns_get_jpfuel(id));
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_setjpfuel(id,fuel)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_jpfuel(id, float(fuel));
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock get_mask(id,mask)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_mask(id, mask);
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock set_mask(id,mask,value)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_set_mask(id,mask,value);
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock get_special(id,mask)
|
2005-02-03 20:49:44 +00:00
|
|
|
{
|
|
|
|
if (pev(id,pev_iuser4) & mask)
|
2007-03-05 19:30:40 +00:00
|
|
|
return 1;
|
|
|
|
return 0;
|
2005-02-03 20:49:44 +00:00
|
|
|
}
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock get_res(id)
|
2007-03-05 19:30:40 +00:00
|
|
|
return floatround(ns_get_res(id));
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock get_class(id)
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_get_class(id);
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stock is_combat()
|
2007-03-05 19:30:40 +00:00
|
|
|
return ns_is_combat();
|