From 323341f67a33456dcdb5fbc73ae8c828c97151fa Mon Sep 17 00:00:00 2001 From: Borja Ferrer Date: Mon, 13 Feb 2006 14:23:43 +0000 Subject: [PATCH] added request at22274 --- dlls/ns/ns/NPData.cpp | 15 +++++++++++++++ dlls/ns/ns/ns_const.h | 2 ++ plugins/include/ns.inc | 3 +++ 3 files changed, 20 insertions(+) diff --git a/dlls/ns/ns/NPData.cpp b/dlls/ns/ns/NPData.cpp index ec88c04b..0577d8ec 100755 --- a/dlls/ns/ns/NPData.cpp +++ b/dlls/ns/ns/NPData.cpp @@ -334,6 +334,19 @@ static cell AMX_NATIVE_CALL ns_set_struct_owner(AMX *amx, cell *params) return 1; } +static cell AMX_NATIVE_CALL ns_get_hive_ability(AMX *amx, cell *params) +{ + int id = params[1]; + int abilitynum = params[2]; + if (id < 1 || id > gpGlobals->maxClients) + return 0; + + CPlayer *player = GET_PLAYER_I(id); + int result = get_private(player->edict, OFFSET_WIN_HIVEABILITY, OFFSET_LIN_HIVEABILITY); + + return (abilitynum > 0) ? (result >= abilitynum - 1) : result; +} + AMX_NATIVE_INFO ns_pdata_natives[] = { /*****************/ { "ns_get_res", ns_get_res }, @@ -369,6 +382,8 @@ AMX_NATIVE_INFO ns_pdata_natives[] = { { "ns_get_struct_owner", ns_get_struct_owner }, { "ns_set_struct_owner", ns_set_struct_owner }, + { "ns_get_hive_ability", ns_get_hive_ability}, + { NULL, NULL } }; diff --git a/dlls/ns/ns/ns_const.h b/dlls/ns/ns/ns_const.h index 954f36c4..a2078cf8 100755 --- a/dlls/ns/ns/ns_const.h +++ b/dlls/ns/ns/ns_const.h @@ -54,6 +54,8 @@ #define OFFSET_WIN_STRUCTOWNER 324 //81 * 4 #define OFFSET_LIN_STRUCTOWNER 340 //85 * 4 +#define OFFSET_WIN_HIVEABILITY 6220 //1555 * 4 +#define OFFSET_LIN_HIVEABILITY 6240 //1560 * 4 enum { diff --git a/plugins/include/ns.inc b/plugins/include/ns.inc index f2fef6a7..51027dbc 100755 --- a/plugins/include/ns.inc +++ b/plugins/include/ns.inc @@ -175,6 +175,9 @@ native ns_set_fov(idPlayer,Float:_fov=0.0); /* Give a player an item. */ native ns_give_item(id,const _szClassName[]); +/* Returns if a player has the hive ability number, if ability is 0 it will return the number of active hives */ +native ns_get_hive_ability(idPlayer, ability=0); + /* A player's team entvar has changed */ forward client_changeteam(id,newteam,oldteam);