From e34120803d8a0ab67f2db87eece36607b0d0832b Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Tue, 1 May 2007 21:38:39 +0000 Subject: [PATCH] Implemented request amb242: added cs_get/set_user_hostagekills() natives --- dlls/cstrike/cstrike/cstrike.cpp | 34 ++++++++++++++++++++++- dlls/cstrike/cstrike/cstrike.h | 1 + dlls/cstrike/cstrike/msvc7/cstrike.vcproj | 2 +- plugins/include/cstrike.inc | 6 ++++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/dlls/cstrike/cstrike/cstrike.cpp b/dlls/cstrike/cstrike/cstrike.cpp index ce1b50f2..532de2b9 100755 --- a/dlls/cstrike/cstrike/cstrike.cpp +++ b/dlls/cstrike/cstrike/cstrike.cpp @@ -1575,6 +1575,35 @@ static cell AMX_NATIVE_CALL cs_set_user_lastactivity(AMX *amx, cell *params) return 1; } + +static cell AMX_NATIVE_CALL cs_get_user_hostagekills(AMX *amx, cell *params) +{ + //Return number of hostages that user has killed + + //Check player + CHECK_PLAYER(params[1]); + + // Make into edict pointer + edict_t *pPlayer = MF_GetPlayerEdict(params[1]); + + return *((int *)pPlayer->pvPrivateData + OFFSET_HOSTAGEKILLS); +} + +static cell AMX_NATIVE_CALL cs_set_user_hostagekills(AMX *amx, cell *params) +{ + //Set number of hostages that user has killed + + //Check player + CHECK_PLAYER(params[1]); + + // Make into edict pointer + edict_t *pPlayer = MF_GetPlayerEdict(params[1]); + + *((int *)pPlayer->pvPrivateData + OFFSET_HOSTAGEKILLS) = params[2]; + + return 1; +} + static cell AMX_NATIVE_CALL cs_get_hostage_lastuse(AMX *amx, cell *params) { //Return time that the hostage was last used @@ -1689,6 +1718,8 @@ static cell AMX_NATIVE_CALL not_on_64(AMX* amx, cell* params) } #define cs_get_user_lastactivity not_on_64 #define cs_set_user_lastactivity not_on_64 +#define cs_get_user_hostagekills not_on_64 +#define cs_set_user_hostagekills not_on_64 #define cs_get_hostage_lastuse not_on_64 #define cs_set_hostage_lastuse not_on_64 #define cs_get_hostage_nextuse not_on_64 @@ -1749,6 +1780,8 @@ AMX_NATIVE_INFO cstrike_Exports[] = { {"cs_set_user_submodel", cs_set_user_submodel}, {"cs_get_user_lastactivity", cs_get_user_lastactivity}, {"cs_set_user_lastactivity", cs_set_user_lastactivity}, + {"cs_get_user_hostagekills", cs_get_user_hostagekills}, + {"cs_set_user_hostagekills", cs_set_user_hostagekills}, {"cs_get_hostage_lastuse", cs_get_hostage_lastuse}, {"cs_set_hostage_lastuse", cs_set_hostage_lastuse}, {"cs_get_hostage_nextuse", cs_get_hostage_nextuse}, @@ -1756,7 +1789,6 @@ AMX_NATIVE_INFO cstrike_Exports[] = { {"cs_get_c4_explode_time", cs_get_c4_explode_time}, {"cs_set_c4_explode_time", cs_set_c4_explode_time}, - //------------------- <-- max 19 characters! {NULL, NULL} }; diff --git a/dlls/cstrike/cstrike/cstrike.h b/dlls/cstrike/cstrike/cstrike.h index a051e71c..1eaf93ab 100755 --- a/dlls/cstrike/cstrike/cstrike.h +++ b/dlls/cstrike/cstrike/cstrike.h @@ -75,6 +75,7 @@ #define OFFSET_DEFUSE_PLANT 193 + EXTRAOFFSET #define OFFSET_VIP 209 + EXTRAOFFSET #define OFFSET_TK 216 + EXTRAOFFSET // 040926 + #define OFFSET_HOSTAGEKILLS 217 + EXTRAOFFSET #define OFFSET_MAPZONE 235 + EXTRAOFFSET #define OFFSET_ISDRIVING 350 + EXTRAOFFSET // 040926 #define OFFSET_STATIONARY 362 + EXTRAOFFSET // 040927 (363 works also!) diff --git a/dlls/cstrike/cstrike/msvc7/cstrike.vcproj b/dlls/cstrike/cstrike/msvc7/cstrike.vcproj index 52159e0c..090d6915 100755 --- a/dlls/cstrike/cstrike/msvc7/cstrike.vcproj +++ b/dlls/cstrike/cstrike/msvc7/cstrike.vcproj @@ -192,7 +192,7 @@ Name="Pawn Includes" Filter=""> + RelativePath="..\..\..\..\plugins\include\cstrike.inc"> diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index 1b59cc64..7e77745c 100755 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -314,6 +314,12 @@ native Float:cs_get_user_lastactivity(index); native cs_set_user_lastactivity(index, Float:value); +/* Gets or sets the number of hostages that a user has killed. + */ +native cs_get_user_hostagekills(index); + +native cs_set_user_hostagekills(index, value); + /* Gets or sets the time that the hostage was last used. */ native Float:cs_get_hostage_lastuse(index);