From 8d005735ec0a8758964f67beb4025dd1595efd86 Mon Sep 17 00:00:00 2001 From: s1lent Date: Fri, 16 Feb 2018 17:58:12 +0700 Subject: [PATCH] Enhanced rg_remove_item: add new param remove ammunition --- .../amxmodx/scripting/include/reapi_gamedll.inc | 3 ++- reapi/include/cssdk/dlls/API/CSPlayer.h | 1 + reapi/include/cssdk/dlls/regamedll_api.h | 2 +- reapi/msvc/reapi.vcxproj | 13 +++++++++---- reapi/src/natives/natives_misc.cpp | 9 +++++---- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc index 859603c4..92089bef 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc @@ -497,10 +497,11 @@ native rg_internal_cmd(const index, const cmd[], const arg[] = ""); * * @param index Client index * @param item_name Item classname +* @param removeAmmo Remove ammunition * * @return 1 if found and remove, 0 otherwise */ -native rg_remove_item(const index, const item_name[]); +native rg_remove_item(const index, const item_name[], const bool:removeAmmo = false); /* * Sets the amount of ammo in the client's backpack for a specific weapon. diff --git a/reapi/include/cssdk/dlls/API/CSPlayer.h b/reapi/include/cssdk/dlls/API/CSPlayer.h index 7b9b1fb8..5fbc2963 100644 --- a/reapi/include/cssdk/dlls/API/CSPlayer.h +++ b/reapi/include/cssdk/dlls/API/CSPlayer.h @@ -79,6 +79,7 @@ class CCSPlayer: public CCSMonster { virtual bool MakeBomber(); virtual void ResetSequenceInfo(); virtual void StartDeathCam(); + virtual bool RemovePlayerItemEx(const char* pszItemName, bool bRemoveAmmo); CBasePlayer *BasePlayer() const; diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index ddf93e97..34e47699 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -38,7 +38,7 @@ #include #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 5 +#define REGAMEDLL_API_VERSION_MINOR 6 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; diff --git a/reapi/msvc/reapi.vcxproj b/reapi/msvc/reapi.vcxproj index 49df2fee..f9d5fa40 100644 --- a/reapi/msvc/reapi.vcxproj +++ b/reapi/msvc/reapi.vcxproj @@ -66,6 +66,11 @@ + + + + + @@ -371,10 +376,10 @@ Force build to run Pre-Build event - subversion.always.run + build.always.run - subversion.always.run + build.always.run IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\") @@ -419,10 +424,10 @@ Force build to run Pre-Build event - subversion.always.run + build.always.run - subversion.always.run + build.always.run IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)") diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 5b67f13f..e0969b6b 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -988,14 +988,15 @@ cell AMX_NATIVE_CALL rg_internal_cmd(AMX *amx, cell *params) * * @param index Client index * @param item_name Item classname +* @param removeAmmo Remove ammunition * * @return 1 if found and remove, 0 otherwise * -* native rg_remove_item(const index, const item_name[]); +* native rg_remove_item(const index, const item_name[], const bool:removeAmmo = false); */ cell AMX_NATIVE_CALL rg_remove_item(AMX *amx, cell *params) { - enum args_e { arg_count, arg_index, arg_item_name }; + enum args_e { arg_count, arg_index, arg_item_name, arg_remammo }; CHECK_ISPLAYER(arg_index); @@ -1003,8 +1004,8 @@ cell AMX_NATIVE_CALL rg_remove_item(AMX *amx, cell *params) CHECK_CONNECTED(pPlayer, arg_index); char iname[256]; - const char* szItemName = getAmxString(amx, params[arg_item_name], iname); - if (pPlayer->CSPlayer()->RemovePlayerItem(szItemName)) { + const char* pszItemName = getAmxString(amx, params[arg_item_name], iname); + if (pPlayer->CSPlayer()->RemovePlayerItemEx(pszItemName, params[arg_remammo] != 0)) { return TRUE; }