Added cs_user_has_shield from Ronkkrop

This commit is contained in:
David Anderson 2005-01-30 05:10:42 +00:00
parent 3d7987e8d8
commit cc462c9ccb
2 changed files with 22 additions and 1 deletions

View File

@ -1308,6 +1308,23 @@ void PlayerPostThink(edict_t* pPlayer) {
RETURN_META(MRES_IGNORED);
}
static cell AMX_NATIVE_CALL cs_user_has_shield(AMX *amx, cell *params)
{
//Return 1 if user has a shield.
//params[1] = user id
//Check player
CHECK_PLAYER(params[1]);
// Make into edict pointer
edict_t *pPlayer = MF_GetPlayerEdict(params[1]);
if ((int)*((int *)pPlayer->pvPrivateData + OFFSET_SHIELD) & HAS_SHIELD)
return 1;
return 0;
}
void OnAmxxAttach()
{
MF_AddNatives(cstrike_Exports);

View File

@ -60,9 +60,12 @@
*/
#define HAS_SHIELD (1<<24) //16777216
// "player" entities
#if !defined __amd64__
// 32 bit offsets here
#define OFFSET_SHIELD 510 + EXTRAOFFSET
#define OFFSET_ARMORTYPE 112 + EXTRAOFFSET
#define OFFSET_TEAM 114 + EXTRAOFFSET
#define OFFSET_CSMONEY 115 + EXTRAOFFSET
@ -101,7 +104,8 @@
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET
#else
// Amd64 offsets here
//#define OFFSET_ARMORTYPE ??? + EXTRAOFFSET // need to find this one out! :-)
#define OFFSET_SHIELD 559 + EXTRAOFFSET
#define OFFSET_ARMORTYPE 137 + EXTRAOFFSET
#define OFFSET_TEAM 139 + EXTRAOFFSET // +25
#define OFFSET_CSMONEY 140 + EXTRAOFFSET // +25
#define OFFSET_PRIMARYWEAPON 141 + EXTRAOFFSET // +25