Skip to content

Commit

Permalink
Add m_bCanShootOverride offset + update SDK (#160)
Browse files Browse the repository at this point in the history
* Add m_bCanShootOverride offset + update SDK
  • Loading branch information
fl0werD authored May 14, 2020
1 parent 1ef3c5a commit b79c822
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
majorVersion=5
minorVersion=12
minorVersion=13
maintenanceVersion=0
1 change: 1 addition & 0 deletions reapi/extra/amxmodx/scripting/include/cssdk_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
};

/**
Expand Down
23 changes: 21 additions & 2 deletions reapi/include/cssdk/dlls/API/CSPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,21 @@
#include <API/CSPlayerItem.h>
#include <API/CSPlayerWeapon.h>

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';
}
Expand All @@ -47,7 +59,7 @@ class CCSPlayer: public CCSMonster {
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);
Expand Down Expand Up @@ -84,6 +96,11 @@ class CCSPlayer: public CCSMonster {
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:
Expand All @@ -95,6 +112,7 @@ class CCSPlayer: public CCSMonster {
};

EProtectionState GetProtectionState() const;
bool CheckActivityInGame();

public:
char m_szModel[32];
Expand All @@ -104,6 +122,7 @@ class CCSPlayer: public CCSMonster {
Vector m_vecOldvAngle;
int m_iWeaponInfiniteAmmo;
int m_iWeaponInfiniteIds;
bool m_bCanShootOverride;
};

// Inlines
Expand Down
1 change: 1 addition & 0 deletions reapi/include/cssdk/dlls/cdll_dll.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion reapi/include/cssdk/dlls/regamedll_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <API/CSInterfaces.h>

#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 13
#define REGAMEDLL_API_VERSION_MINOR 16

// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
Expand Down Expand Up @@ -464,6 +464,10 @@ typedef IHookChainRegistryClass<bool, class CBasePlayerWeapon, int, int, float,
typedef IHookChainClass<void, class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropIdlePlayer;
typedef IHookChainRegistryClass<void, class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropIdlePlayer;

// CreateWeaponBox hook
typedef IHookChain<class CWeaponBox *, class CBasePlayerItem *, class CBasePlayer *, const char *, Vector &, Vector &, Vector &, float, bool> IReGameHook_CreateWeaponBox;
typedef IHookChainRegistry<class CWeaponBox *, class CBasePlayerItem *, class CBasePlayer *, const char *, Vector &, Vector &, Vector &, float, bool> IReGameHookRegistry_CreateWeaponBox;

class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
Expand Down Expand Up @@ -579,6 +583,7 @@ class IReGameHookchains {
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 {
Expand Down
1 change: 1 addition & 0 deletions reapi/src/member_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down
1 change: 1 addition & 0 deletions reapi/src/member_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,7 @@ enum CSPlayer_Members
m_vecOldvAngle,
m_iWeaponInfiniteAmmo,
m_iWeaponInfiniteIds,
m_bCanShootOverride,
};

enum CBasePlayerItem_Members
Expand Down

0 comments on commit b79c822

Please sign in to comment.