From b79c822fefbbe84b2a39a935ad7cd9632834d9df Mon Sep 17 00:00:00 2001 From: fl0werD Date: Thu, 14 May 2020 12:51:33 +0400 Subject: [PATCH] Add m_bCanShootOverride offset + update SDK (#160) * Add m_bCanShootOverride offset + update SDK --- gradle.properties | 2 +- .../amxmodx/scripting/include/cssdk_const.inc | 1 + .../scripting/include/reapi_gamedll_const.inc | 11 ++++++++- reapi/include/cssdk/dlls/API/CSPlayer.h | 23 +++++++++++++++++-- reapi/include/cssdk/dlls/cdll_dll.h | 1 + reapi/include/cssdk/dlls/regamedll_api.h | 7 +++++- reapi/src/member_list.cpp | 1 + reapi/src/member_list.h | 1 + 8 files changed, 42 insertions(+), 5 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9c1255b..b08fc23 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ majorVersion=5 -minorVersion=12 +minorVersion=13 maintenanceVersion=0 diff --git a/reapi/extra/amxmodx/scripting/include/cssdk_const.inc b/reapi/extra/amxmodx/scripting/include/cssdk_const.inc index b795f55..7b8c269 100644 --- a/reapi/extra/amxmodx/scripting/include/cssdk_const.inc +++ b/reapi/extra/amxmodx/scripting/include/cssdk_const.inc @@ -192,6 +192,7 @@ #define PLAYER_HOLDING_SHIELD (1<<3) #define PLAYER_PREVENT_DUCK (1<<4) #define PLAYER_PREVENT_CLIMB (1<<5) // The player can't climb ladder +#define PLAYER_PREVENT_JUMP (1<<6) /** * Instant damage values for use with the 3rd parameter of the "Damage" client diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 76a540b..9c596f0 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -2541,7 +2541,8 @@ enum CBasePlayer_Members m_iMapVote, /* - * Description: - + * Description: The player can't shoot for freezetime period or during defuse bomb + * @note This member isn't flexible, you can't override it for other behavior, so for this purpose use m_bCanShootOverride * Member type: bool * Get params: get_member(index, member); * Set params: set_member(index, member, bool:value); @@ -4505,6 +4506,14 @@ enum CCSPlayer_Members * Set params: set_member(index, member, value); */ m_iWeaponInfiniteIds, + + /* + * Description: Forcing override for CBasePlayer::m_bCanShoot + * Member type: bool + * Get params: get_member(index, member); + * Set params: set_member(index, member, bool:value); + */ + m_bCanShootOverride, }; /** diff --git a/reapi/include/cssdk/dlls/API/CSPlayer.h b/reapi/include/cssdk/dlls/API/CSPlayer.h index a7abfc7..3367818 100644 --- a/reapi/include/cssdk/dlls/API/CSPlayer.h +++ b/reapi/include/cssdk/dlls/API/CSPlayer.h @@ -31,9 +31,21 @@ #include #include +enum WeaponInfiniteAmmoMode +{ + WPNMODE_INFINITE_CLIP = 1, + WPNMODE_INFINITE_BPAMMO +}; + class CCSPlayer: public CCSMonster { public: - CCSPlayer() : m_bForceShowMenu(false), m_flRespawnPending(0), m_flSpawnProtectionEndTime(0) + CCSPlayer() : + m_bForceShowMenu(false), + m_flRespawnPending(0), + m_flSpawnProtectionEndTime(0), + m_iWeaponInfiniteAmmo(0), + m_iWeaponInfiniteIds(0), + m_bCanShootOverride(false) { m_szModel[0] = '\0'; } @@ -47,7 +59,7 @@ public: virtual void GiveShield(bool bDeploy = true); virtual void DropShield(bool bDeploy = true); virtual void DropPlayerItem(const char *pszItemName); - virtual void RemoveShield(); + virtual bool RemoveShield(); virtual void RemoveAllItems(bool bRemoveSuit); virtual bool RemovePlayerItem(const char* pszItemName); virtual void SetPlayerModel(bool bHasC4); @@ -84,6 +96,11 @@ public: virtual void RemoveSpawnProtection(); virtual bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false); + void Reset(); + + void OnSpawn(); + void OnKilled(); + CBasePlayer *BasePlayer() const; public: @@ -95,6 +112,7 @@ public: }; EProtectionState GetProtectionState() const; + bool CheckActivityInGame(); public: char m_szModel[32]; @@ -104,6 +122,7 @@ public: Vector m_vecOldvAngle; int m_iWeaponInfiniteAmmo; int m_iWeaponInfiniteIds; + bool m_bCanShootOverride; }; // Inlines diff --git a/reapi/include/cssdk/dlls/cdll_dll.h b/reapi/include/cssdk/dlls/cdll_dll.h index 76302d0..15ff9b9 100644 --- a/reapi/include/cssdk/dlls/cdll_dll.h +++ b/reapi/include/cssdk/dlls/cdll_dll.h @@ -71,6 +71,7 @@ const int DEFAULT_FOV = 90; // the default field of view #define PLAYER_HOLDING_SHIELD BIT(3) #define PLAYER_PREVENT_DUCK BIT(4) #define PLAYER_PREVENT_CLIMB BIT(5) // The player can't climb ladder +#define PLAYER_PREVENT_JUMP BIT(6) #define MENU_KEY_1 BIT(0) #define MENU_KEY_2 BIT(1) diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index c689423..b20ddd9 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 13 +#define REGAMEDLL_API_VERSION_MINOR 16 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -464,6 +464,10 @@ typedef IHookChainRegistryClass IReGameHook_CBasePlayer_DropIdlePlayer; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropIdlePlayer; +// CreateWeaponBox hook +typedef IHookChain IReGameHook_CreateWeaponBox; +typedef IHookChainRegistry IReGameHookRegistry_CreateWeaponBox; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -579,6 +583,7 @@ public: virtual IReGameHookRegistry_CBasePlayerWeapon_DefaultReload *CBasePlayerWeapon_DefaultReload() = 0; virtual IReGameHookRegistry_CBasePlayerWeapon_DefaultShotgunReload *CBasePlayerWeapon_DefaultShotgunReload() = 0; virtual IReGameHookRegistry_CBasePlayer_DropIdlePlayer *CBasePlayer_DropIdlePlayer() = 0; + virtual IReGameHookRegistry_CreateWeaponBox *CreateWeaponBox() = 0; }; struct ReGameFuncs_t { diff --git a/reapi/src/member_list.cpp b/reapi/src/member_list.cpp index b5aed26..e9c008e 100644 --- a/reapi/src/member_list.cpp +++ b/reapi/src/member_list.cpp @@ -745,6 +745,7 @@ member_t memberlist_csplayer[] = { CSPL_MEMBERS(m_vecOldvAngle), CSPL_MEMBERS(m_iWeaponInfiniteAmmo), CSPL_MEMBERS(m_iWeaponInfiniteIds), + CSPL_MEMBERS(m_bCanShootOverride), }; member_t memberlist_baseitem[] = { diff --git a/reapi/src/member_list.h b/reapi/src/member_list.h index e416abb..3ef4e59 100644 --- a/reapi/src/member_list.h +++ b/reapi/src/member_list.h @@ -743,6 +743,7 @@ enum CSPlayer_Members m_vecOldvAngle, m_iWeaponInfiniteAmmo, m_iWeaponInfiniteIds, + m_bCanShootOverride, }; enum CBasePlayerItem_Members