mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-15 08:08:07 +03:00
Fix mp_refill_bpammo_weapons not working on default weapons (#177)
* Fix mp_refill_bpammo_weapons not working on default weapons
This commit is contained in:
parent
0f1f4c002f
commit
83341a793e
@ -251,7 +251,7 @@ public:
|
|||||||
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) {}
|
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) {}
|
||||||
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) { return FALSE; }
|
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) { return FALSE; }
|
||||||
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) { return FALSE; }
|
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) { return FALSE; }
|
||||||
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1) { return -1; }
|
virtual int GiveAmmo(int iAmount, const char *szName, int iMax = -1) { return -1; }
|
||||||
virtual float GetDelay() { return 0.0f; }
|
virtual float GetDelay() { return 0.0f; }
|
||||||
virtual int IsMoving() { return (pev->velocity != g_vecZero); }
|
virtual int IsMoving() { return (pev->velocity != g_vecZero); }
|
||||||
virtual void OverrideReset() {}
|
virtual void OverrideReset() {}
|
||||||
|
@ -1585,12 +1585,20 @@ void EXT_FUNC CBasePlayer::__API_HOOK(GiveDefaultItems)()
|
|||||||
{
|
{
|
||||||
RemoveAllItems(FALSE);
|
RemoveAllItems(FALSE);
|
||||||
|
|
||||||
// NOTE: NOTE: It is already does reset inside RemoveAllItems
|
// NOTE: It is already does reset inside RemoveAllItems
|
||||||
#ifndef REGAMEDLL_FIXES
|
#ifndef REGAMEDLL_FIXES
|
||||||
m_bHasPrimary = false;
|
m_bHasPrimary = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef REGAMEDLL_ADD
|
#ifdef REGAMEDLL_ADD
|
||||||
|
auto GiveWeapon = [&](int ammo, char* pszWeaponName) {
|
||||||
|
GiveNamedItem(pszWeaponName);
|
||||||
|
const WeaponInfoStruct *info = GetWeaponInfo(pszWeaponName);
|
||||||
|
if (info) {
|
||||||
|
GiveAmmo(refill_bpammo_weapons.value != 0.0f ? info->maxRounds : ammo, info->ammoName + 5/*ammo_*/);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
switch (m_iTeam)
|
switch (m_iTeam)
|
||||||
{
|
{
|
||||||
case CT:
|
case CT:
|
||||||
@ -1599,8 +1607,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(GiveDefaultItems)()
|
|||||||
GiveNamedItem("weapon_knife");
|
GiveNamedItem("weapon_knife");
|
||||||
}
|
}
|
||||||
if (!HasRestrictItem(ITEM_USP, ITEM_TYPE_EQUIPPED)) {
|
if (!HasRestrictItem(ITEM_USP, ITEM_TYPE_EQUIPPED)) {
|
||||||
GiveNamedItem("weapon_usp");
|
GiveWeapon(m_bIsVIP ? 12 : 24, "weapon_usp");
|
||||||
GiveAmmo(m_bIsVIP ? 12 : 24, "45acp");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1611,8 +1618,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(GiveDefaultItems)()
|
|||||||
GiveNamedItem("weapon_knife");
|
GiveNamedItem("weapon_knife");
|
||||||
}
|
}
|
||||||
if (!HasRestrictItem(ITEM_GLOCK18, ITEM_TYPE_EQUIPPED)) {
|
if (!HasRestrictItem(ITEM_GLOCK18, ITEM_TYPE_EQUIPPED)) {
|
||||||
GiveNamedItem("weapon_glock18");
|
GiveWeapon(40, "weapon_glock18");
|
||||||
GiveAmmo(40, "9mm");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -6561,10 +6567,10 @@ BOOL EXT_FUNC CBasePlayer::__API_HOOK(RemovePlayerItem)(CBasePlayerItem *pItem)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LINK_HOOK_CLASS_CHAIN(int, CBasePlayer, GiveAmmo, (int iCount, char *szName, int iMax), iCount, szName, iMax)
|
LINK_HOOK_CLASS_CHAIN(int, CBasePlayer, GiveAmmo, (int iCount, const char *szName, int iMax), iCount, szName, iMax)
|
||||||
|
|
||||||
// Returns the unique ID for the ammo, or -1 if error
|
// Returns the unique ID for the ammo, or -1 if error
|
||||||
int EXT_FUNC CBasePlayer::__API_HOOK(GiveAmmo)(int iCount, char *szName, int iMax)
|
int EXT_FUNC CBasePlayer::__API_HOOK(GiveAmmo)(int iCount, const char *szName, int iMax)
|
||||||
{
|
{
|
||||||
if (pev->flags & FL_SPECTATOR)
|
if (pev->flags & FL_SPECTATOR)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -336,7 +336,7 @@ public:
|
|||||||
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore);
|
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore);
|
||||||
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem);
|
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem);
|
||||||
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem);
|
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem);
|
||||||
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1);
|
virtual int GiveAmmo(int iAmount, const char *szName, int iMax = -1);
|
||||||
virtual void StartSneaking() { m_tSneaking = gpGlobals->time - 1; }
|
virtual void StartSneaking() { m_tSneaking = gpGlobals->time - 1; }
|
||||||
|
|
||||||
#ifndef REGAMEDLL_FIXES
|
#ifndef REGAMEDLL_FIXES
|
||||||
@ -381,7 +381,7 @@ public:
|
|||||||
void AddPointsToTeam_OrigFunc(int score, BOOL bAllowNegativeScore);
|
void AddPointsToTeam_OrigFunc(int score, BOOL bAllowNegativeScore);
|
||||||
BOOL AddPlayerItem_OrigFunc(CBasePlayerItem *pItem);
|
BOOL AddPlayerItem_OrigFunc(CBasePlayerItem *pItem);
|
||||||
BOOL RemovePlayerItem_OrigFunc(CBasePlayerItem *pItem);
|
BOOL RemovePlayerItem_OrigFunc(CBasePlayerItem *pItem);
|
||||||
int GiveAmmo_OrigFunc(int iAmount, char *szName, int iMax);
|
int GiveAmmo_OrigFunc(int iAmount, const char *szName, int iMax);
|
||||||
void ResetMaxSpeed_OrigFunc();
|
void ResetMaxSpeed_OrigFunc();
|
||||||
void Jump_OrigFunc();
|
void Jump_OrigFunc();
|
||||||
void Duck_OrigFunc();
|
void Duck_OrigFunc();
|
||||||
|
@ -81,7 +81,7 @@ public:
|
|||||||
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
|
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
|
||||||
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
|
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
|
||||||
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
|
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
|
||||||
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1) = 0;
|
virtual int GiveAmmo(int iAmount, const char *szName, int iMax = -1) = 0;
|
||||||
virtual float GetDelay() = 0;
|
virtual float GetDelay() = 0;
|
||||||
virtual int IsMoving() = 0;
|
virtual int IsMoving() = 0;
|
||||||
virtual void OverrideReset() = 0;
|
virtual void OverrideReset() = 0;
|
||||||
|
@ -320,7 +320,7 @@ public:
|
|||||||
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
|
virtual void AddPointsToTeam(int score, BOOL bAllowNegativeScore) = 0;
|
||||||
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
|
virtual BOOL AddPlayerItem(CBasePlayerItem *pItem) = 0;
|
||||||
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
|
virtual BOOL RemovePlayerItem(CBasePlayerItem *pItem) = 0;
|
||||||
virtual int GiveAmmo(int iAmount, char *szName, int iMax = -1) = 0;
|
virtual int GiveAmmo(int iAmount, const char *szName, int iMax = -1) = 0;
|
||||||
virtual void StartSneaking() = 0;
|
virtual void StartSneaking() = 0;
|
||||||
virtual void UpdateOnRemove() = 0;
|
virtual void UpdateOnRemove() = 0;
|
||||||
virtual BOOL IsSneaking() = 0;
|
virtual BOOL IsSneaking() = 0;
|
||||||
|
@ -87,8 +87,8 @@ typedef IHookChainClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGam
|
|||||||
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHookRegistry_CBasePlayer_RemovePlayerItem;
|
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHookRegistry_CBasePlayer_RemovePlayerItem;
|
||||||
|
|
||||||
// CBasePlayer::GiveAmmo hook
|
// CBasePlayer::GiveAmmo hook
|
||||||
typedef IHookChainClass<int, class CBasePlayer, int , char *, int> IReGameHook_CBasePlayer_GiveAmmo;
|
typedef IHookChainClass<int, class CBasePlayer, int , const char *, int> IReGameHook_CBasePlayer_GiveAmmo;
|
||||||
typedef IHookChainRegistryClass<int, class CBasePlayer, int , char *, int> IReGameHookRegistry_CBasePlayer_GiveAmmo;
|
typedef IHookChainRegistryClass<int, class CBasePlayer, int , const char *, int> IReGameHookRegistry_CBasePlayer_GiveAmmo;
|
||||||
|
|
||||||
// CBasePlayer::ResetMaxSpeed hook
|
// CBasePlayer::ResetMaxSpeed hook
|
||||||
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_ResetMaxSpeed;
|
typedef IVoidHookChainClass<class CBasePlayer> IReGameHook_CBasePlayer_ResetMaxSpeed;
|
||||||
|
@ -87,8 +87,8 @@ typedef IHookChainClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGam
|
|||||||
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHookRegistry_CBasePlayer_RemovePlayerItem;
|
typedef IHookChainRegistryClass<BOOL, class CBasePlayer, class CBasePlayerItem *> IReGameHookRegistry_CBasePlayer_RemovePlayerItem;
|
||||||
|
|
||||||
// CBasePlayer::GiveAmmo hook
|
// CBasePlayer::GiveAmmo hook
|
||||||
typedef IHookChainClass<int, class CBasePlayer, int , char *, int> IReGameHook_CBasePlayer_GiveAmmo;
|
typedef IHookChainClass<int, class CBasePlayer, int , const char *, int> IReGameHook_CBasePlayer_GiveAmmo;
|
||||||
typedef IHookChainRegistryClass<int, class CBasePlayer, int , char *, int> IReGameHookRegistry_CBasePlayer_GiveAmmo;
|
typedef IHookChainRegistryClass<int, class CBasePlayer, int , const char *, int> IReGameHookRegistry_CBasePlayer_GiveAmmo;
|
||||||
|
|
||||||
// CBasePlayer::ResetMaxSpeed hook
|
// CBasePlayer::ResetMaxSpeed hook
|
||||||
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_ResetMaxSpeed;
|
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_ResetMaxSpeed;
|
||||||
|
@ -83,8 +83,8 @@ typedef IHookChainClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CReGameHook_CB
|
|||||||
typedef IHookChainRegistryClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CReGameHookRegistry_CBasePlayer_RemovePlayerItem;
|
typedef IHookChainRegistryClassImpl<BOOL, CBasePlayer, CBasePlayerItem *> CReGameHookRegistry_CBasePlayer_RemovePlayerItem;
|
||||||
|
|
||||||
// CBasePlayer::GiveAmmo hook
|
// CBasePlayer::GiveAmmo hook
|
||||||
typedef IHookChainClassImpl<int, CBasePlayer, int , char *, int> CReGameHook_CBasePlayer_GiveAmmo;
|
typedef IHookChainClassImpl<int, CBasePlayer, int , const char *, int> CReGameHook_CBasePlayer_GiveAmmo;
|
||||||
typedef IHookChainRegistryClassImpl<int, CBasePlayer, int , char *, int> CReGameHookRegistry_CBasePlayer_GiveAmmo;
|
typedef IHookChainRegistryClassImpl<int, CBasePlayer, int , const char *, int> CReGameHookRegistry_CBasePlayer_GiveAmmo;
|
||||||
|
|
||||||
// CBasePlayer::ResetMaxSpeed hook
|
// CBasePlayer::ResetMaxSpeed hook
|
||||||
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_ResetMaxSpeed;
|
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_ResetMaxSpeed;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user