2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-29 08:05:36 +03:00

Enhanced rg_remove_item: add new param remove ammunition

This commit is contained in:
s1lent 2018-02-16 17:58:12 +07:00
parent 9e41f5fdbd
commit 8d005735ec
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
5 changed files with 18 additions and 10 deletions

View File

@ -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.

View File

@ -79,6 +79,7 @@ public:
virtual bool MakeBomber();
virtual void ResetSequenceInfo();
virtual void StartDeathCam();
virtual bool RemovePlayerItemEx(const char* pszItemName, bool bRemoveAmmo);
CBasePlayer *BasePlayer() const;

View File

@ -38,7 +38,7 @@
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 5
#define REGAMEDLL_API_VERSION_MINOR 6
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;

View File

@ -66,6 +66,11 @@
<ClInclude Include="..\include\cssdk\dlls\activitymap.h" />
<ClInclude Include="..\include\cssdk\dlls\airtank.h" />
<ClInclude Include="..\include\cssdk\dlls\ammo.h" />
<ClInclude Include="..\include\cssdk\dlls\API\CSEntity.h" />
<ClInclude Include="..\include\cssdk\dlls\API\CSInterfaces.h" />
<ClInclude Include="..\include\cssdk\dlls\API\CSPlayer.h" />
<ClInclude Include="..\include\cssdk\dlls\API\CSPlayerItem.h" />
<ClInclude Include="..\include\cssdk\dlls\API\CSPlayerWeapon.h" />
<ClInclude Include="..\include\cssdk\dlls\basemonster.h" />
<ClInclude Include="..\include\cssdk\dlls\bmodels.h" />
<ClInclude Include="..\include\cssdk\dlls\bot\cs_bot.h" />
@ -371,10 +376,10 @@
<Message>Force build to run Pre-Build event</Message>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>subversion.always.run</Outputs>
<Outputs>build.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>subversion.always.run</Inputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
@ -419,10 +424,10 @@
<Message>Force build to run Pre-Build event</Message>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>subversion.always.run</Outputs>
<Outputs>build.always.run</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>subversion.always.run</Inputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>

View File

@ -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;
}