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)
|
|
|
|
return is_valid_ent(id)
|
|
|
|
|
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,_}:...)
|
2004-08-24 21:36:39 +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)
|
|
|
|
return get_offset_int(index, offset, linuxdiff)
|
|
|
|
|
|
|
|
stock set_private_i(index, offset, value, linuxdiff=5)
|
|
|
|
{
|
|
|
|
return set_private_i(index, offset, value, linuxdiff)
|
|
|
|
}
|
|
|
|
|
|
|
|
stock Float:get_private_f(index, offset, linuxdiff=5)
|
|
|
|
{
|
|
|
|
return get_private_f(index, offset, linuxdiff)
|
|
|
|
}
|
|
|
|
|
|
|
|
stock Float:set_private_f(index, offset, Float:value, linuxdiff=5)
|
|
|
|
{
|
|
|
|
return set_private_f(index, offset, value, linuxdiff)
|
|
|
|
}
|
|
|
|
|
|
|
|
stock make_string(value[])
|
2004-08-24 21:36:39 +00:00
|
|
|
return EngFunc(EngFunc_AllocString,value)
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock string(value, ret[])
|
|
|
|
{
|
2004-08-24 21:36:39 +00:00
|
|
|
new szString[128] // gah...
|
|
|
|
EngFunc(EngFunc_SzFromIndex,value,szString,127)
|
|
|
|
copy(ret,szString,127)
|
2004-06-29 19:38:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stock gpgobals_time()
|
|
|
|
return halflife_time()
|
|
|
|
|
|
|
|
stock get_range(ida, idb)
|
2004-09-19 00:52:15 +00:00
|
|
|
return entity_range(ida, idb)
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock supercede()
|
2004-08-24 21:36:39 +00:00
|
|
|
return 0
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock register_clientkill()
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock register_changelvl()
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock register_msgblock(msgName[])
|
|
|
|
return set_msg_block(get_user_msgid(msgName), BLOCK_SET)
|
|
|
|
|
|
|
|
stock register_msgedit(msgName[], cmd[])
|
|
|
|
return register_message(get_user_msgid(msgName), cmd)
|
|
|
|
|
|
|
|
stock register_playback(event, cmd[])
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock get_spwan(type, number=0, Float:ret[3])
|
|
|
|
return ns_get_spawn(type, number, ret)
|
|
|
|
|
|
|
|
stock has_weapon(index, weapon, setweapon=-1)
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_has_weapon(index, weapon, setweapon)
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock gpglobals_v(type, Float:ret[3])
|
|
|
|
{
|
2004-08-24 21:36:39 +00:00
|
|
|
new v_type=0
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
v_type = GL_v_forward
|
|
|
|
case 2:
|
|
|
|
v_type = GL_v_right
|
|
|
|
case 3:
|
|
|
|
v_type = GL_v_up
|
|
|
|
}
|
|
|
|
if (!v_type)
|
|
|
|
return 0
|
|
|
|
return get_global_vector(v_type, ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
stock pev_i(_index,_field)
|
|
|
|
return pev(_index,_field)
|
|
|
|
|
|
|
|
stock set_pev_i(_index, _field, _val)
|
|
|
|
return set_pev(_index,_field,_val)
|
|
|
|
|
|
|
|
stock Float:pev_f(_index,_field)
|
|
|
|
{
|
|
|
|
new Float:f
|
|
|
|
pev(_index,_field,f)
|
|
|
|
return f
|
|
|
|
}
|
|
|
|
stock set_pev_f(_index,_field,Float:_val)
|
|
|
|
return set_pev(_index,_field,_val)
|
|
|
|
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock msg_args()
|
|
|
|
return get_msg_args()
|
|
|
|
|
|
|
|
stock Float:msg_loc(vec)
|
|
|
|
{
|
|
|
|
new Float:Ret[3]
|
|
|
|
get_msg_origin(Ret)
|
|
|
|
if (vec < 0 || vec > 3)
|
|
|
|
return float(0)
|
|
|
|
else
|
|
|
|
return Ret[vec]
|
|
|
|
}
|
|
|
|
|
|
|
|
stock msg_dest()
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock msg_type()
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock msg_name()
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock msg_set_s(number, value[])
|
2004-08-31 05:27:31 +00:00
|
|
|
return set_msg_arg_string(number, get_msg_argtype(number), value)
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock msg_set_f(number, Float:value)
|
2004-08-31 05:27:31 +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)
|
2004-08-31 05:27:31 +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)
|
|
|
|
return get_msg_arg_type(value)
|
|
|
|
|
|
|
|
stock msg_strdata(value)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock msg_data(value, ...)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock get_filename(szFile[], len=-1)
|
|
|
|
{
|
|
|
|
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-08-24 21:36:39 +00:00
|
|
|
stock get_speedchange(id)
|
|
|
|
return ns_get_speedchange(id)
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock set_speedchange(id, speed)
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_set_speedchange(id,speed)
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock get_maxspeed(id)
|
|
|
|
return ns_get_maxspeed(id)
|
|
|
|
|
|
|
|
stock set_player_model(id, model[]="")
|
|
|
|
return ns_set_player_model(id, model)
|
|
|
|
|
|
|
|
stock set_player_skin(id, skin=-1)
|
|
|
|
return ns_set_player_skin(id, skin)
|
|
|
|
|
|
|
|
stock set_player_body(id, body=-1)
|
|
|
|
return ns_set_player_body(id, body)
|
|
|
|
|
|
|
|
stock ns2amx_version()
|
2004-08-24 21:36:39 +00:00
|
|
|
return 0
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock set_kvhandled()
|
|
|
|
return 0
|
|
|
|
|
|
|
|
stock ns2amx_getammo(id,Weapon)
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_get_weap_reserve(id, Weapon)
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_setammo(id,Weapon,Value)
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_set_weap_reserve(id, Weapon, Value)
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_giveitem(id,svClassname[])
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_give_item(id, svClassname)
|
2004-06-29 19:38:03 +00:00
|
|
|
|
|
|
|
stock ns2amx_moveto(idMoved,idDest)
|
|
|
|
{
|
2004-08-24 21:36:39 +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)
|
|
|
|
return ns_get_mask(id,MASK_DIGESTING)
|
|
|
|
|
|
|
|
/* Returns total # of active hives. */
|
|
|
|
stock ns2amx_gethives()
|
|
|
|
return ns_get_build("team_hive",1)
|
|
|
|
|
|
|
|
/* 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)
|
2004-06-29 19:38:03 +00:00
|
|
|
return 1
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
stock ns2amx_nspopup(id,svMessage[190])
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_popup(id, svMessage)
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_setres(id,value)
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_set_res(id, float(value))
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_getenergy(id)
|
2004-08-24 21:36:39 +00:00
|
|
|
return floatround(ns_get_energy(id))
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_setenergy(id,energy)
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_set_energy(id, float(energy))
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_getjpfuel(id)
|
2004-08-24 21:36:39 +00:00
|
|
|
return floatround(ns_get_jpfuel(id))
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock ns2amx_setjpfuel(id,fuel)
|
2004-08-24 21:36:39 +00:00
|
|
|
return ns_set_jpfuel(id, float(fuel))
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock get_mask(id,mask)
|
|
|
|
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)
|
|
|
|
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)
|
|
|
|
return ns_get_special(id,mask)
|
2004-08-24 21:36:39 +00:00
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock get_res(id)
|
2004-08-24 21:36:39 +00:00
|
|
|
return floatround(ns_get_res(id))
|
|
|
|
|
2004-06-29 19:38:03 +00:00
|
|
|
stock get_class(id)
|
|
|
|
return ns_get_class(id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stock is_combat()
|
|
|
|
return ns_is_combat()
|