added request at30290 (VEN)

fixed cs_get_user_buyzone returning true when user was in bombtarget zone or other specific areas
This commit is contained in:
Borja Ferrer 2006-05-26 18:26:59 +00:00
parent 44a7b62963
commit e6064af9fb
3 changed files with 37 additions and 4 deletions

View File

@ -580,10 +580,29 @@ static cell AMX_NATIVE_CALL cs_get_user_inside_buyzone(AMX *amx, cell *params) /
// Make into edict pointer
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
// This offset is 0 when outside, 1 when inside.
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_MAPZONE) & PLAYER_IN_BUYZONE)
return 1;
return (int)*((int *)pPlayer->pvPrivateData + OFFSET_BUYZONE); // This offset is 0 when outside, 1 when inside.
return 0;
}
static cell AMX_NATIVE_CALL cs_get_user_mapzones(AMX *amx, cell *params) // cs_get_user_mapzones(index); = 1 param
{
// Is user inside a special zone?
// params[1] = user index
// Valid entity should be within range
CHECK_PLAYER(params[1]);
// Make into edict pointer
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
return (int)*((int *)pPlayer->pvPrivateData + OFFSET_MAPZONE);
}
static cell AMX_NATIVE_CALL cs_get_user_plant(AMX *amx, cell *params) // cs_get_user_plant(index); = 1 param
{
// Can user plant a bomb if he has one?
@ -1404,6 +1423,7 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
{"cs_get_user_team", cs_get_user_team},
{"cs_set_user_team", cs_set_user_team},
{"cs_get_user_buyzone", cs_get_user_inside_buyzone},
{"cs_get_user_mapzones", cs_get_user_mapzones},
{"cs_get_user_plant", cs_get_user_plant},
{"cs_set_user_plant", cs_set_user_plant},
{"cs_get_user_defuse", cs_get_user_defusekit},

View File

@ -74,7 +74,7 @@
#define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET
#define OFFSET_VIP 209 + EXTRAOFFSET
#define OFFSET_TK 216 + EXTRAOFFSET // 040926
#define OFFSET_BUYZONE 235 + EXTRAOFFSET
#define OFFSET_MAPZONE 235 + EXTRAOFFSET
#define OFFSET_ISDRIVING 350 + EXTRAOFFSET // 040926
#define OFFSET_STATIONARY 362 + EXTRAOFFSET // 040927 (363 works also!)
@ -115,7 +115,7 @@
#define OFFSET_DEFUSE_PLANT 219 + EXTRAOFFSET // +26
#define OFFSET_VIP 242 + EXTRAOFFSET // +27
#define OFFSET_TK 249 + EXTRAOFFSET // +33 040927
#define OFFSET_BUYZONE 268 + EXTRAOFFSET // +27
#define OFFSET_MAPZONE 268 + EXTRAOFFSET // +27
#define OFFSET_ISDRIVING 386 + EXTRAOFFSET // 040927
#define OFFSET_STATIONARY 400 + EXTRAOFFSET // 040927 (401 works also)
@ -214,6 +214,8 @@
#define PLAYER_IS_VIP (1<<8)
#define PLAYER_IN_BUYZONE (1<<0)
#define TEAM_UNASSIGNED 0
#define TEAM_T 1
#define TEAM_CT 2

View File

@ -257,4 +257,15 @@ native cs_get_armoury_type(index);
* Supported weapons/items: CSW_MP5NAVY, CSW_TMP, CSW_P90, CSW_MAC10, CSW_AK47, CSW_SG552, CSW_M4A1, CSW_AUG, CSW_SCOUT
* CSW_G3SG1, CSW_AWP, CSW_M3, CSW_XM1014, CSW_M249, CSW_FLASHBANG, CSW_HEGRENADE, CSW_VEST, CSW_VESTHELM, CSW_SMOKEGRENADE
*/
native cs_set_armoury_type(index, type);
native cs_set_armoury_type(index, type);
#define CS_MAPZONE_BUY (1<<0)
#define CS_MAPZONE_BOMBTARGET (1<<1)
#define CS_MAPZONE_HOSTAGE_RESCUE (1<<2)
#define CS_MAPZONE_ESCAPE (1<<3)
#define CS_MAPZONE_VIP_SAFETY (1<<4)
/* Returns in bitwise form if the user is in a specific map zone.
* NOTE: If user can't plant (cs_get_user_plant(index) is 0) then cs_get_user_mapzones(index) & CS_MAPZONE_BOMBTARGET will return 0 too.
*/
native cs_get_user_mapzones(index);