mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-27 14:08:00 +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);
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (refill_bpammo_weapons.value > 1 && info->ammoType >= AMMO_338MAGNUM && info->ammoType <= AMMO_9MM) {
|
||||
pPlayer->m_rgAmmo[info->ammoType] = info->maxRounds;
|
||||
if (refill_bpammo_weapons.value > 1)
|
||||
{
|
||||
CBasePlayerItem *pItem = static_cast<CBasePlayerItem *>(pEntity);
|
||||
|
||||
if (pItem) {
|
||||
pPlayer->GiveAmmo(pItem->iMaxAmmo1(), pItem->pszAmmo1(), pItem->iMaxAmmo1());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1440,11 +1440,10 @@ void EXT_FUNC CBasePlayer::__API_HOOK(GiveDefaultItems)()
|
||||
#endif
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
auto GiveWeapon = [&](int ammo, char* pszWeaponName) {
|
||||
GiveNamedItem(pszWeaponName);
|
||||
const WeaponInfoStruct *pInfo = GetWeaponInfo(pszWeaponName);
|
||||
if (pInfo) {
|
||||
GiveAmmo(refill_bpammo_weapons.value != 0.0f ? pInfo->maxRounds : ammo, pInfo->ammoName2);
|
||||
auto GiveWeapon = [&](int ammo, char *pszWeaponName) {
|
||||
auto pItem = static_cast<CBasePlayerItem *>(GiveNamedItemEx(pszWeaponName));
|
||||
if (pItem) {
|
||||
GiveAmmo(refill_bpammo_weapons.value != 0.0f ? pItem->iMaxAmmo1() : ammo, pItem->pszAmmo1(), pItem->iMaxAmmo1());
|
||||
}
|
||||
};
|
||||
|
||||
@ -2169,7 +2168,13 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Killed)(entvars_t *pevAttacker, int iGib)
|
||||
BuyZoneIcon_Clear(this);
|
||||
|
||||
#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
|
||||
|
||||
SetThink(&CBasePlayer::PlayerDeathThink);
|
||||
@ -4969,6 +4974,11 @@ BOOL IsSpawnPointValid(CBaseEntity *pPlayer, CBaseEntity *pSpot)
|
||||
if (!pSpot->IsTriggered(pPlayer))
|
||||
return FALSE;
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (!kill_filled_spawn.value)
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
CBaseEntity *pEntity = nullptr;
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, pSpot->pev->origin, MAX_PLAYER_USE_RADIUS)))
|
||||
{
|
||||
@ -5656,6 +5666,12 @@ void CBasePlayer::Reset()
|
||||
WRITE_SHORT(0);
|
||||
WRITE_SHORT(m_iTeam);
|
||||
MESSAGE_END();
|
||||
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (CSPlayer()->GetProtectionState() == CCSPlayer::ProtectionSt_Active) {
|
||||
RemoveSpawnProtection();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NOXREF void CBasePlayer::SelectNextItem(int iItem)
|
||||
@ -6135,8 +6151,14 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse)
|
||||
}
|
||||
case 101:
|
||||
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);
|
||||
ALERT(at_console, "Crediting %s with $16000\n", STRING(pev->netname));
|
||||
#endif
|
||||
break;
|
||||
case 102:
|
||||
CGib::SpawnRandomGibs(pev, 1, 1);
|
||||
@ -9778,7 +9800,7 @@ void CBasePlayer::PlayerRespawnThink()
|
||||
if (pev->deadflag < DEAD_DYING)
|
||||
return;
|
||||
|
||||
if (forcerespawn.value > 0 && gpGlobals->time > (CSPlayer()->m_flRespawnPending + forcerespawn.value))
|
||||
if (forcerespawn.value > 0 && gpGlobals->time > CSPlayer()->m_flRespawnPending)
|
||||
{
|
||||
Spawn();
|
||||
pev->button = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user