From ad732d7286dac376ef0bb6c18578a1b58056a4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Wed, 16 Mar 2005 21:00:16 +0000 Subject: [PATCH] *** empty log message *** --- dlls/cstrike/cstrike.cpp | 33 ++++++++++++++++++--------------- plugins/include/cstrike.inc | 5 +++++ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/dlls/cstrike/cstrike.cpp b/dlls/cstrike/cstrike.cpp index 22abf39d..b14da842 100755 --- a/dlls/cstrike/cstrike.cpp +++ b/dlls/cstrike/cstrike.cpp @@ -1200,6 +1200,23 @@ static cell AMX_NATIVE_CALL cs_get_user_stationary(AMX *amx, cell *params) // cs #endif } +static cell AMX_NATIVE_CALL cs_get_user_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; +} + AMX_NATIVE_INFO cstrike_Exports[] = { {"cs_set_user_money", cs_set_user_money}, {"cs_get_user_money", cs_get_user_money}, @@ -1240,6 +1257,7 @@ AMX_NATIVE_INFO cstrike_Exports[] = { {"cs_get_user_stationary", cs_get_user_stationary}, {"cs_get_user_armor", cs_get_user_armor}, {"cs_set_user_armor", cs_set_user_armor}, + {"cs_get_user_shield", cs_get_user_shield}, //------------------- <-- max 19 characters! {NULL, NULL} }; @@ -1308,22 +1326,7 @@ 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() { diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index 4f9170d2..b4908bf8 100755 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -172,6 +172,10 @@ native cs_set_user_tked(index, tk = 1, subtract = 1); */ native cs_get_user_driving(index); +/* Returns 1 if user has a shield, else 0. + */ +native cs_get_user_shield(index); + /* Returns 1 if user is using a stationary gun, else 0. */ native cs_get_user_stationary(index); @@ -228,3 +232,4 @@ native cs_get_no_knives(); * You can still give knives (ie through fun's give_item). */ native cs_set_no_knives(noknives = 0); +