From 272b2fc709896fa0262a926d449fcd4019138bc9 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 21 Jun 2016 02:45:37 +0700 Subject: [PATCH] Added hook CBasePlayer::HasRestrictItem --- .../amxmodx/scripting/include/cssdk_const.inc | 66 ++++++++++++++--- .../scripting/include/reapi_gamedll_const.inc | 27 +++---- reapi/include/cssdk/dlls/client.h | 11 --- reapi/include/cssdk/dlls/items.h | 64 +++++++++++++--- reapi/include/cssdk/dlls/player.h | 4 +- reapi/include/cssdk/dlls/regamedll_api.h | 29 +++----- reapi/include/cssdk/dlls/weapons.h | 5 +- reapi/src/hook_callback.cpp | 73 ++++++++----------- reapi/src/hook_callback.h | 10 +-- reapi/src/hook_list.cpp | 6 +- reapi/src/hook_list.h | 8 +- reapi/src/member_list.cpp | 2 + reapi/src/natives/natives_misc.cpp | 2 +- reapi/src/reapi_version.inc | 2 +- 14 files changed, 180 insertions(+), 129 deletions(-) diff --git a/reapi/extra/amxmodx/scripting/include/cssdk_const.inc b/reapi/extra/amxmodx/scripting/include/cssdk_const.inc index 6f87d93..4a59b4b 100644 --- a/reapi/extra/amxmodx/scripting/include/cssdk_const.inc +++ b/reapi/extra/amxmodx/scripting/include/cssdk_const.inc @@ -682,17 +682,6 @@ enum ArmouryItemPack ARMOURY_SMOKEGRENADE }; -enum BuyItemID -{ - BUY_ITEM_VEST = 1, - BUY_ITEM_VESTHELM, - BUY_ITEM_FLASHGREN, - BUY_ITEM_HEGREN, - BUY_ITEM_SMOKEGREN, - BUY_ITEM_NVG, - BUY_ITEM_DEFUSEKIT -}; - enum RewardType { RT_NONE, @@ -1093,3 +1082,58 @@ enum RewardRules RR_TOOK_HOSTAGE, RR_END }; + +enum ItemRestType +{ + ITEM_TYPE_BUYING, // when a player buying items + ITEM_TYPE_TOUCHED, // when the player touches with a weaponbox or armoury_entity + ITEM_TYPE_EQUIPPED // when a entity game_player_equip to player gives item +}; + +// constant items +enum ItemID +{ + ITEM_NONE = -1, + ITEM_SHIELDGUN, + ITEM_P228, + ITEM_GLOCK, + ITEM_SCOUT, + ITEM_HEGRENADE, + ITEM_XM1014, + ITEM_C4, + ITEM_MAC10, + ITEM_AUG, + ITEM_SMOKEGRENADE, + ITEM_ELITE, + ITEM_FIVESEVEN, + ITEM_UMP45, + ITEM_SG550, + ITEM_GALIL, + ITEM_FAMAS, + ITEM_USP, + ITEM_GLOCK18, + ITEM_AWP, + ITEM_MP5N, + ITEM_M249, + ITEM_M3, + ITEM_M4A1, + ITEM_TMP, + ITEM_G3SG1, + ITEM_FLASHBANG, + ITEM_DEAGLE, + ITEM_SG552, + ITEM_AK47, + ITEM_KNIFE, + ITEM_P90, + ITEM_NVG, + ITEM_DEFUSEKIT, + ITEM_KEVLAR, + ITEM_ASSAULT, + ITEM_LONGJUMP, + ITEM_SODACAN, + ITEM_HEALTHKIT, + ITEM_ANTIDOTE, + ITEM_SECURITY, + ITEM_BATTERY, + ITEM_SUIT +}; diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index f4dda52..1f5d93a 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -158,12 +158,6 @@ enum GamedllFunc */ RG_RoundEnd, - /* - * Description: - - * Params: (const index, const WeaponIdType:iWeapon) - */ - RG_CanBuyThis, - /* * Description: - * Params: (const PlayerMove:ppmove, const server) @@ -198,13 +192,7 @@ enum GamedllFunc * Description: - * Params: (const index, VGUIMenu:menuType, const bitsSlots, szOldMenu[], bool:bForceOldMenu) */ - RG_ShowVGUIMenu, - - /* - * Description: - - * Params: (const index, BuyItemID:item) - */ - RG_CanBuyThisItem + RG_ShowVGUIMenu }; enum GamedllFunc_CBaseAnimating @@ -408,7 +396,14 @@ enum GamedllFunc_CBasePlayer * Description: - * Params: (const this, const pszItemName[]) */ - RG_CBasePlayer_DropPlayerItem + RG_CBasePlayer_DropPlayerItem, + + /* + * Description: - + * Params: (const this, ItemID:item, ItemRestType:type) + */ + RG_CBasePlayer_HasRestrictItem + }; enum GamedllFunc_CSGameRules @@ -1730,7 +1725,7 @@ enum CBasePlayer_Members /* * Description: - - * Member type: int + * Member type: enum ArmorType * Get params: get_member(index, member); * Set params: set_member(index, member, value); */ @@ -4239,7 +4234,7 @@ enum CArmoury_Members { /* * Description: - - * Member type: int (or enum's ArmouryItemPack) + * Member type: enum ArmouryItemPack * Get params: ArmouryItemPack:get_member(index, member); * Set params: set_member(index, member, ArmouryItemPack:value); */ diff --git a/reapi/include/cssdk/dlls/client.h b/reapi/include/cssdk/dlls/client.h index 540fc4b..f7f8a55 100644 --- a/reapi/include/cssdk/dlls/client.h +++ b/reapi/include/cssdk/dlls/client.h @@ -53,17 +53,6 @@ enum BuyItemMenuSlot MENU_SLOT_ITEM_SHIELD, }; -enum BuyItemID -{ - BUY_ITEM_VEST = 1, - BUY_ITEM_VESTHELM, - BUY_ITEM_FLASHGREN, - BUY_ITEM_HEGREN, - BUY_ITEM_SMOKEGREN, - BUY_ITEM_NVG, - BUY_ITEM_DEFUSEKIT -}; - #define CS_NUM_SKIN 4 #define CZ_NUM_SKIN 5 diff --git a/reapi/include/cssdk/dlls/items.h b/reapi/include/cssdk/dlls/items.h index 1c4dd14..f6e0fc3 100644 --- a/reapi/include/cssdk/dlls/items.h +++ b/reapi/include/cssdk/dlls/items.h @@ -27,22 +27,66 @@ */ #pragma once +enum ItemRestType +{ + ITEM_TYPE_BUYING, // when a player buying items + ITEM_TYPE_TOUCHED, // when the player touches with a weaponbox or armoury_entity + ITEM_TYPE_EQUIPPED // when a entity game_player_equip to player gives item +}; + // constant items -#define ITEM_HEALTHKIT 1 -#define ITEM_ANTIDOTE 2 -#define ITEM_SECURITY 3 -#define ITEM_BATTERY 4 -#define ITEM_SUIT 5 +enum ItemID +{ + ITEM_NONE = -1, + ITEM_SHIELDGUN, + ITEM_P228, + ITEM_GLOCK, + ITEM_SCOUT, + ITEM_HEGRENADE, + ITEM_XM1014, + ITEM_C4, + ITEM_MAC10, + ITEM_AUG, + ITEM_SMOKEGRENADE, + ITEM_ELITE, + ITEM_FIVESEVEN, + ITEM_UMP45, + ITEM_SG550, + ITEM_GALIL, + ITEM_FAMAS, + ITEM_USP, + ITEM_GLOCK18, + ITEM_AWP, + ITEM_MP5N, + ITEM_M249, + ITEM_M3, + ITEM_M4A1, + ITEM_TMP, + ITEM_G3SG1, + ITEM_FLASHBANG, + ITEM_DEAGLE, + ITEM_SG552, + ITEM_AK47, + ITEM_KNIFE, + ITEM_P90, + ITEM_NVG, + ITEM_DEFUSEKIT, + ITEM_KEVLAR, + ITEM_ASSAULT, + ITEM_LONGJUMP, + ITEM_SODACAN, + ITEM_HEALTHKIT, + ITEM_ANTIDOTE, + ITEM_SECURITY, + ITEM_BATTERY, + ITEM_SUIT +}; class CItem: public CBaseEntity { public: virtual void Spawn() = 0; virtual CBaseEntity *Respawn() = 0; virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; - -public: - void EXPORT ItemTouch(CBaseEntity *pOther) = 0; - void EXPORT Materialize() = 0; }; class CWorldItem: public CBaseEntity { @@ -50,7 +94,7 @@ public: virtual void Spawn() = 0; virtual void KeyValue(KeyValueData *pkvd) = 0; public: - int m_iType; + ItemID m_iType; }; class CItemSuit: public CItem { diff --git a/reapi/include/cssdk/dlls/player.h b/reapi/include/cssdk/dlls/player.h index 8aaede9..3ed9c92 100644 --- a/reapi/include/cssdk/dlls/player.h +++ b/reapi/include/cssdk/dlls/player.h @@ -243,7 +243,7 @@ struct RebuyStruct int m_smokeGrenade; int m_defuser; int m_nightVision; - int m_armor; + ArmorType m_armor; }; enum ThrowDirection @@ -375,7 +375,7 @@ public: int m_iLastZoom; bool m_bResumeZoom; float m_flEjectBrass; - int m_iKevlar; + ArmorType m_iKevlar; bool m_bNotKilled; TeamName m_iTeam; int m_iAccount; diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index 1c76c5e..afc362d 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -33,8 +33,9 @@ #include "player.h" #include "gamerules.h" #include "client.h" +#include "items.h" -#define REGAMEDLL_API_VERSION_MAJOR 3 +#define REGAMEDLL_API_VERSION_MAJOR 4 #define REGAMEDLL_API_VERSION_MINOR 1 // CBasePlayer::Spawn hook @@ -157,6 +158,14 @@ typedef IVoidHookChainRegistryClass IReGameHo typedef IVoidHookChainClass IReGameHook_CBasePlayer_SetClientUserInfoName; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetClientUserInfoName; +// CBasePlayer::HasRestrictItem hook +typedef IHookChainClass IReGameHook_CBasePlayer_HasRestrictItem; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_HasRestrictItem; + +// CBasePlayer::DropPlayerItem hook +typedef IVoidHookChainClass IReGameHook_CBasePlayer_DropPlayerItem; +typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropPlayerItem; + // CBaseAnimating::ResetSequenceInfo hook typedef IVoidHookChainClass IReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; @@ -177,10 +186,6 @@ typedef IVoidHookChainRegistry IReGameHook_RoundEnd; typedef IHookChainRegistry IReGameHookRegistry_RoundEnd; -// CanBuyThis hook -typedef IHookChain IReGameHook_CanBuyThis; -typedef IHookChainRegistry IReGameHookRegistry_CanBuyThis; - // InstallGameRules hook typedef IHookChain IReGameHook_InstallGameRules; typedef IHookChainRegistry IReGameHookRegistry_InstallGameRules; @@ -301,14 +306,6 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_GoToIntermissio typedef IVoidHookChain<> IReGameHook_CSGameRules_BalanceTeams; typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams; -// CanBuyThisItem hook -typedef IHookChain IReGameHook_CanBuyThisItem; -typedef IHookChainRegistry IReGameHookRegistry_CanBuyThisItem; - -// CBasePlayer::DropPlayerItem hook -typedef IVoidHookChainClass IReGameHook_CBasePlayer_DropPlayerItem; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropPlayerItem; - class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -344,13 +341,14 @@ public: virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0; virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0; virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0; + virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem() = 0; + virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0; virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0; virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0; virtual IReGameHookRegistry_PlayerBlind* PlayerBlind() = 0; virtual IReGameHookRegistry_RadiusFlash_TraceLine* RadiusFlash_TraceLine() = 0; virtual IReGameHookRegistry_RoundEnd* RoundEnd() = 0; - virtual IReGameHookRegistry_CanBuyThis* CanBuyThis() = 0; virtual IReGameHookRegistry_InstallGameRules* InstallGameRules() = 0; virtual IReGameHookRegistry_PM_Init* PM_Init() = 0; virtual IReGameHookRegistry_PM_Move* PM_Move() = 0; @@ -382,9 +380,6 @@ public: virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0; virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0; virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0; - - virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem() = 0; - virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0; }; struct ReGameFuncs_t { diff --git a/reapi/include/cssdk/dlls/weapons.h b/reapi/include/cssdk/dlls/weapons.h index c87446a..e17cc27 100644 --- a/reapi/include/cssdk/dlls/weapons.h +++ b/reapi/include/cssdk/dlls/weapons.h @@ -92,8 +92,7 @@ enum ArmouryItemPack ARMOURY_HEGRENADE, ARMOURY_KEVLAR, ARMOURY_ASSAULT, - ARMOURY_SMOKEGRENADE, - ARMOURY_END + ARMOURY_SMOKEGRENADE }; struct ItemInfo @@ -131,7 +130,7 @@ public: virtual void Restart() = 0; virtual void KeyValue(KeyValueData *pkvd) = 0; public: - int m_iItem; + ArmouryItemPack m_iItem; int m_iCount; int m_iInitialCount; bool m_bAlreadyCounted; diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index 5f66288..268f56b 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -274,7 +274,8 @@ CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer { auto original = [chain](int _pthis, int _iPlayerIndex, bool _bSameTeam) { - return indexOfEdict(chain->callNext(getPrivate(_pthis), _iPlayerIndex, _bSameTeam)->pev); + auto pPlayer = chain->callNext(getPrivate(_pthis), _iPlayerIndex, _bSameTeam); + return pPlayer ? indexOfEdict(pPlayer->pev) : 0; }; return getPrivate(callForward(RG_CBasePlayer_Observer_IsValidTarget, original, indexOfEdict(pthis->pev), iPlayerIndex, bSameTeam)); @@ -330,6 +331,36 @@ void CBasePlayer_GiveShield(IReGameHook_CBasePlayer_GiveShield *chain, CBasePlay callVoidForward(RG_CBasePlayer_GiveShield, original, indexOfEdict(pthis->pev), bDeploy); } +void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInfoModel *chain, CBasePlayer *pthis, char *infobuffer, char *szNewModel) +{ + auto original = [chain](int _pthis, char *_infobuffer, char *_szNewModel) + { + chain->callNext(getPrivate(_pthis), _infobuffer, _szNewModel); + }; + + callVoidForward(RG_CBasePlayer_SetClientUserInfoModel, original, indexOfEdict(pthis->pev), infobuffer, szNewModel); +} + +void CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName) +{ + auto original = [chain](int _pthis, char *_infobuffer, char *_szNewName) + { + chain->callNext(getPrivate(_pthis), _infobuffer, _szNewName); + }; + + callVoidForward(RG_CBasePlayer_SetClientUserInfoName, original, indexOfEdict(pthis->pev), infobuffer, szNewName); +} + +bool CBasePlayer_HasRestrictItem(IReGameHook_CBasePlayer_HasRestrictItem *chain, CBasePlayer *pthis, ItemID item, ItemRestType type) +{ + auto original = [chain](int _pthis, ItemID _item, ItemRestType _type) + { + return chain->callNext(getPrivate(_pthis), _item, _type); + }; + + return callForward(RG_CBasePlayer_HasRestrictItem, original, indexOfEdict(pthis->pev), item, type); +} + void CBasePlayer_DropPlayerItem(IReGameHook_CBasePlayer_DropPlayerItem *chain, CBasePlayer *pthis, const char *pszItemName) { auto original = [chain](int _pthis, const char *_pszItemName) @@ -394,26 +425,6 @@ bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarioEventEndRound return callForward(RG_RoundEnd, original, winStatus, event, tmDelay); } -bool CanBuyThis(IReGameHook_CanBuyThis *chain, CBasePlayer *pPlayer, int iWeapon) -{ - auto original = [chain](int _pPlayer, int _iWeapon) - { - return chain->callNext(getPrivate(_pPlayer), _iWeapon); - }; - - return callForward(RG_CanBuyThis, original, indexOfEdict(pPlayer->pev), iWeapon); -} - -bool CanBuyThisItem(IReGameHook_CanBuyThisItem *chain, CBasePlayer *pPlayer, BuyItemID item) -{ - auto original = [chain](int _pPlayer, BuyItemID _item) - { - return chain->callNext(getPrivate(_pPlayer), _item); - }; - - return callForward(RG_CanBuyThisItem, original, indexOfEdict(pPlayer->pev), item); -} - void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server) { auto original = [chain](playermove_t *_ppmove, int _server) @@ -654,26 +665,6 @@ void CSGameRules_BalanceTeams(IReGameHook_CSGameRules_BalanceTeams *chain) callVoidForward(RG_CSGameRules_BalanceTeams, original); } -void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInfoModel *chain, CBasePlayer *pthis, char *infobuffer, char *szNewModel) -{ - auto original = [chain](int _pthis, char *_infobuffer, char *_szNewModel) - { - chain->callNext(getPrivate(_pthis), _infobuffer, _szNewModel); - }; - - callVoidForward(RG_CBasePlayer_SetClientUserInfoModel, original, indexOfEdict(pthis->pev), infobuffer, szNewModel); -} - -void CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName) -{ - auto original = [chain](int _pthis, char *_infobuffer, char *_szNewName) - { - chain->callNext(getPrivate(_pthis), _infobuffer, _szNewName); - }; - - callVoidForward(RG_CBasePlayer_SetClientUserInfoName, original, indexOfEdict(pthis->pev), infobuffer, szNewName); -} - void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain, CBasePlayer *pPlayer, int slot) { auto original = [chain](int _pPlayer, int _slot) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 4f92e2d..88f0073 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -42,7 +42,7 @@ inline AType getApiType(float) { return ATYPE_FLOAT; } inline AType getApiType(const char *) { return ATYPE_STRING; } inline AType getApiType(char []) { return ATYPE_STRING; } inline AType getApiType(CBaseEntity *) { return ATYPE_CLASSPTR; } -inline AType getApiType(edict_t *) { return ATYPE_CLASSPTR; } +inline AType getApiType(edict_t *) { return ATYPE_EDICT; } inline AType getApiType(entvars_t *) { return ATYPE_EVARS; } template @@ -239,8 +239,6 @@ int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver); void PlayerBlind(IReGameHook_PlayerBlind *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, float fadeTime, float fadeHold, int alpha, Vector& color); void RadiusFlash_TraceLine(IReGameHook_RadiusFlash_TraceLine *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, Vector& vecSrc, Vector& vecSpot, TraceResult *ptr); bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarioEventEndRound event, float tmDelay); -bool CanBuyThis(IReGameHook_CanBuyThis *chain, CBasePlayer *pPlayer, int iWeapon); -bool CanBuyThisItem(IReGameHook_CanBuyThisItem *chain, CBasePlayer *pPlayer, BuyItemID item); void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server); void PM_AirMove(IReGameHook_PM_AirMove *chain, int playerIndex); void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain, CBasePlayer *pPlayer, int slot); @@ -278,6 +276,9 @@ void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chai void CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName); void CBasePlayer_AddAccount(IReGameHook_CBasePlayer_AddAccount *chain, CBasePlayer *pthis, int amount, RewardType type, bool bTrackChange); void CBasePlayer_GiveShield(IReGameHook_CBasePlayer_GiveShield *chain, CBasePlayer *pthis, bool bDeploy); +void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInfoModel *chain, CBasePlayer *pthis, char *infobuffer, char *szNewModel); +void CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName); +bool CBasePlayer_HasRestrictItem(IReGameHook_CBasePlayer_HasRestrictItem *chain, CBasePlayer *pthis, ItemID item, ItemRestType type); void CBasePlayer_DropPlayerItem(IReGameHook_CBasePlayer_DropPlayerItem *chain, CBasePlayer *pthis, const char *pszItemName); void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis); @@ -305,9 +306,6 @@ void CSGameRules_ChangeLevel(IReGameHook_CSGameRules_ChangeLevel *chain); void CSGameRules_GoToIntermission(IReGameHook_CSGameRules_GoToIntermission *chain); void CSGameRules_BalanceTeams(IReGameHook_CSGameRules_BalanceTeams *chain); -void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInfoModel *chain, CBasePlayer *pthis, char *infobuffer, char *szNewModel); -void CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName); - extern int g_iClientStartSpeak; extern int g_iClientStopSpeak; diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index fd85a94..252e423 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -6,7 +6,8 @@ inline size_t getFwdParamType(void(*)(Vector&)) { return FP_ARRAY; } inline size_t getFwdParamType(void(*)(PLAYER_ANIM)) { return FP_CELL; } inline size_t getFwdParamType(void(*)(RewardType)) { return FP_CELL; } inline size_t getFwdParamType(void(*)(ScenarioEventEndRound)) { return FP_CELL; } -inline size_t getFwdParamType(void(*)(BuyItemID)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(ItemID)) { return FP_CELL; } +inline size_t getFwdParamType(void(*)(ItemRestType)) { return FP_CELL; } inline size_t getFwdParamType(void(*)(float)) { return FP_FLOAT; } inline size_t getFwdParamType(void(*)(float&)) { return FP_FLOAT; } inline size_t getFwdParamType(void(*)(const char *)) { return FP_STRING; } @@ -77,14 +78,12 @@ hook_t hooklist_gamedll[] = { DLL(PlayerBlind), DLL(RadiusFlash_TraceLine), DLL(RoundEnd), - DLL(CanBuyThis), DLL(PM_Move), DLL(PM_AirMove), DLL(HandleMenu_ChooseAppearance), DLL(HandleMenu_ChooseTeam), DLL(ShowMenu), DLL(ShowVGUIMenu), - DLL(CanBuyThisItem), }; hook_t hooklist_animating[] = { @@ -124,6 +123,7 @@ hook_t hooklist_player[] = { DLL(CBasePlayer_AddAccount), DLL(CBasePlayer_GiveShield), DLL(CBasePlayer_DropPlayerItem), + DLL(CBasePlayer_HasRestrictItem), }; hook_t hooklist_gamerules[] = { diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index 07c944e..fa529f9 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -74,7 +74,6 @@ enum EngineFunc RH_Cvar_DirectSet, // [...] - RH_EngineFunc_End }; enum GamedllFunc @@ -83,7 +82,6 @@ enum GamedllFunc RG_PlayerBlind, RG_RadiusFlash_TraceLine, RG_RoundEnd, - RG_CanBuyThis, RG_PM_Move, RG_PM_AirMove, @@ -91,10 +89,8 @@ enum GamedllFunc RG_HandleMenu_ChooseTeam, RG_ShowMenu, RG_ShowVGUIMenu, - RG_CanBuyThisItem, // [...] - RG_End }; enum GamedllFunc_CBaseAnimating @@ -102,7 +98,6 @@ enum GamedllFunc_CBaseAnimating RG_CBaseAnimating_ResetSequenceInfo = BEGIN_FUNC_REGION(animating), // [...] - RG_CBaseAnimating_End }; enum GamedllFunc_CBasePlayer @@ -140,9 +135,9 @@ enum GamedllFunc_CBasePlayer RG_CBasePlayer_AddAccount, RG_CBasePlayer_GiveShield, RG_CBasePlayer_DropPlayerItem, + RG_CBasePlayer_HasRestrictItem, // [...] - RG_CBasePlayer_End }; enum GamedllFunc_CSGameRules @@ -173,5 +168,4 @@ enum GamedllFunc_CSGameRules RG_CSGameRules_BalanceTeams, // [...] - RG_CSGameRules_End }; diff --git a/reapi/src/member_list.cpp b/reapi/src/member_list.cpp index 7e2baa2..513a477 100644 --- a/reapi/src/member_list.cpp +++ b/reapi/src/member_list.cpp @@ -55,6 +55,8 @@ inline MType getMemberType(_Menu) { return MEMBER_INTEGER; } inline MType getMemberType(MusicState) { return MEMBER_INTEGER; } inline MType getMemberType(Activity) { return MEMBER_INTEGER; } inline MType getMemberType(MONSTERSTATE) { return MEMBER_INTEGER; } +inline MType getMemberType(ArmorType) { return MEMBER_INTEGER; } +inline MType getMemberType(ArmouryItemPack) { return MEMBER_INTEGER; } inline MType getMemberType(short) { return MEMBER_SHORT; } inline MType getMemberType(unsigned short) { return MEMBER_SHORT; } diff --git a/reapi/src/natives/natives_misc.cpp b/reapi/src/natives/natives_misc.cpp index 3e9b729..c0fc935 100644 --- a/reapi/src/natives/natives_misc.cpp +++ b/reapi/src/natives/natives_misc.cpp @@ -950,7 +950,7 @@ cell AMX_NATIVE_CALL rg_set_user_armor(AMX *amx, cell *params) return FALSE; } - int armorType = params[arg_armortype]; + ArmorType armorType = static_cast(params[arg_armortype]); pPlayer->pev->armorvalue = params[arg_armorvalue]; pPlayer->m_iKevlar = armorType; diff --git a/reapi/src/reapi_version.inc b/reapi/src/reapi_version.inc index 3536fdd..8cb21aa 100644 --- a/reapi/src/reapi_version.inc +++ b/reapi/src/reapi_version.inc @@ -4,5 +4,5 @@ #define _reapi_version_included // reapi version -#define REAPI_VERSION_MAJOR 3 +#define REAPI_VERSION_MAJOR 4 #define REAPI_VERSION_MINOR 2