From cc462c9ccb68e5efb477bbd1cc01c82ddbad9677 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 30 Jan 2005 05:10:42 +0000 Subject: [PATCH] Added cs_user_has_shield from Ronkkrop --- dlls/cstrike/cstrike.cpp | 17 +++++++++++++++++ dlls/cstrike/cstrike.h | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/cstrike/cstrike.cpp b/dlls/cstrike/cstrike.cpp index 41d3b4b5..22abf39d 100755 --- a/dlls/cstrike/cstrike.cpp +++ b/dlls/cstrike/cstrike.cpp @@ -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); diff --git a/dlls/cstrike/cstrike.h b/dlls/cstrike/cstrike.h index f84beaef..5d9ac5c8 100755 --- a/dlls/cstrike/cstrike.h +++ b/dlls/cstrike/cstrike.h @@ -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