added request at22274

This commit is contained in:
Borja Ferrer 2006-02-13 14:23:43 +00:00
parent 71c023f485
commit 323341f67a
3 changed files with 20 additions and 0 deletions

View File

@ -334,6 +334,19 @@ static cell AMX_NATIVE_CALL ns_set_struct_owner(AMX *amx, cell *params)
return 1; 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[] = { AMX_NATIVE_INFO ns_pdata_natives[] = {
/*****************/ /*****************/
{ "ns_get_res", ns_get_res }, { "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_get_struct_owner", ns_get_struct_owner },
{ "ns_set_struct_owner", ns_set_struct_owner }, { "ns_set_struct_owner", ns_set_struct_owner },
{ "ns_get_hive_ability", ns_get_hive_ability},
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -54,6 +54,8 @@
#define OFFSET_WIN_STRUCTOWNER 324 //81 * 4 #define OFFSET_WIN_STRUCTOWNER 324 //81 * 4
#define OFFSET_LIN_STRUCTOWNER 340 //85 * 4 #define OFFSET_LIN_STRUCTOWNER 340 //85 * 4
#define OFFSET_WIN_HIVEABILITY 6220 //1555 * 4
#define OFFSET_LIN_HIVEABILITY 6240 //1560 * 4
enum enum
{ {

View File

@ -175,6 +175,9 @@ native ns_set_fov(idPlayer,Float:_fov=0.0);
/* Give a player an item. */ /* Give a player an item. */
native ns_give_item(id,const _szClassName[]); 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 */ /* A player's team entvar has changed */
forward client_changeteam(id,newteam,oldteam); forward client_changeteam(id,newteam,oldteam);