mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-02-05 18:20:33 +03:00
Regamefixes (#419)
* use “ItemInfo” instead of “WeaponInfoStruct” * allow to change m_flRespawnPending (respawn delay) by 3rd party plugins * remove spawn protection on kill (or reset) * fix CVar "mp_kill_filled_spawn" (a forgot check) * cheat impulse 101 max money value (by CVar mp_maxmoney")
This commit is contained in:
parent
7607207d32
commit
f8a5c5406e
@ -1550,8 +1550,13 @@ CBaseEntity *EXT_FUNC __API_HOOK(BuyWeaponByWeaponID)(CBasePlayer *pPlayer, Weap
|
|||||||
pPlayer->AddAccount(-info->cost, RT_PLAYER_BOUGHT_SOMETHING);
|
pPlayer->AddAccount(-info->cost, RT_PLAYER_BOUGHT_SOMETHING);
|
||||||
|
|
||||||
#ifdef REGAMEDLL_ADD
|
#ifdef REGAMEDLL_ADD
|
||||||
if (refill_bpammo_weapons.value > 1 && info->ammoType >= AMMO_338MAGNUM && info->ammoType <= AMMO_9MM) {
|
if (refill_bpammo_weapons.value > 1)
|
||||||
pPlayer->m_rgAmmo[info->ammoType] = info->maxRounds;
|
{
|
||||||
|
CBasePlayerItem *pItem = static_cast<CBasePlayerItem *>(pEntity);
|
||||||
|
|
||||||
|
if (pItem) {
|
||||||
|
pPlayer->GiveAmmo(pItem->iMaxAmmo1(), pItem->pszAmmo1(), pItem->iMaxAmmo1());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1440,11 +1440,10 @@ void EXT_FUNC CBasePlayer::__API_HOOK(GiveDefaultItems)()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef REGAMEDLL_ADD
|
#ifdef REGAMEDLL_ADD
|
||||||
auto GiveWeapon = [&](int ammo, char* pszWeaponName) {
|
auto GiveWeapon = [&](int ammo, char *pszWeaponName) {
|
||||||
GiveNamedItem(pszWeaponName);
|
auto pItem = static_cast<CBasePlayerItem *>(GiveNamedItemEx(pszWeaponName));
|
||||||
const WeaponInfoStruct *pInfo = GetWeaponInfo(pszWeaponName);
|
if (pItem) {
|
||||||
if (pInfo) {
|
GiveAmmo(refill_bpammo_weapons.value != 0.0f ? pItem->iMaxAmmo1() : ammo, pItem->pszAmmo1(), pItem->iMaxAmmo1());
|
||||||
GiveAmmo(refill_bpammo_weapons.value != 0.0f ? pInfo->maxRounds : ammo, pInfo->ammoName2);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2169,7 +2168,13 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
|
|||||||
BuyZoneIcon_Clear(this);
|
BuyZoneIcon_Clear(this);
|
||||||
|
|
||||||
#ifdef REGAMEDLL_ADD
|
#ifdef REGAMEDLL_ADD
|
||||||
CSPlayer()->m_flRespawnPending = gpGlobals->time;
|
if (forcerespawn.value > 0) {
|
||||||
|
CSPlayer()->m_flRespawnPending = gpGlobals->time + forcerespawn.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CSPlayer()->GetProtectionState() == CCSPlayer::ProtectionSt_Active) {
|
||||||
|
RemoveSpawnProtection();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SetThink(&CBasePlayer::PlayerDeathThink);
|
SetThink(&CBasePlayer::PlayerDeathThink);
|
||||||
@ -4969,6 +4974,11 @@ BOOL IsSpawnPointValid(CBaseEntity *pPlayer, CBaseEntity *pSpot)
|
|||||||
if (!pSpot->IsTriggered(pPlayer))
|
if (!pSpot->IsTriggered(pPlayer))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_ADD
|
||||||
|
if (!kill_filled_spawn.value)
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
CBaseEntity *pEntity = nullptr;
|
CBaseEntity *pEntity = nullptr;
|
||||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS)))
|
while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS)))
|
||||||
{
|
{
|
||||||
@ -5656,6 +5666,12 @@ void CBasePlayer::Reset()
|
|||||||
WRITE_SHORT(0);
|
WRITE_SHORT(0);
|
||||||
WRITE_SHORT(m_iTeam);
|
WRITE_SHORT(m_iTeam);
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_ADD
|
||||||
|
if (CSPlayer()->GetProtectionState() == CCSPlayer::ProtectionSt_Active) {
|
||||||
|
RemoveSpawnProtection();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
NOXREF void CBasePlayer::SelectNextItem(int iItem)
|
NOXREF void CBasePlayer::SelectNextItem(int iItem)
|
||||||
@ -6135,8 +6151,14 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse)
|
|||||||
}
|
}
|
||||||
case 101:
|
case 101:
|
||||||
gEvilImpulse101 = TRUE;
|
gEvilImpulse101 = TRUE;
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_ADD
|
||||||
|
AddAccount(int(maxmoney.value));
|
||||||
|
ALERT(at_console, "Crediting %s with $%i\n", STRING(pev->netname), int(maxmoney.value));
|
||||||
|
#else
|
||||||
AddAccount(16000);
|
AddAccount(16000);
|
||||||
ALERT(at_console, "Crediting %s with $16000\n", STRING(pev->netname));
|
ALERT(at_console, "Crediting %s with $16000\n", STRING(pev->netname));
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 102:
|
case 102:
|
||||||
CGib::SpawnRandomGibs(pev, 1, 1);
|
CGib::SpawnRandomGibs(pev, 1, 1);
|
||||||
@ -9778,7 +9800,7 @@ void CBasePlayer::PlayerRespawnThink()
|
|||||||
if (pev->deadflag < DEAD_DYING)
|
if (pev->deadflag < DEAD_DYING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (forcerespawn.value > 0 && gpGlobals->time > (CSPlayer()->m_flRespawnPending + forcerespawn.value))
|
if (forcerespawn.value > 0 && gpGlobals->time > CSPlayer()->m_flRespawnPending)
|
||||||
{
|
{
|
||||||
Spawn();
|
Spawn();
|
||||||
pev->button = 0;
|
pev->button = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user