Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cfg/cs2fixes/cs2fixes.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ zr_infect_shake 1 // Whether to shake a player's view on infect
zr_infect_shake_amp 15.0 // Amplitude of shaking effect
zr_infect_shake_frequency 2.0 // Frequency of shaking effect
zr_infect_shake_duration 5.0 // Duration of shaking effect
zr_damage_cash_scale 0.0 // Multiplier on cash given when damaging zombies (0.0 = disabled)

// Leader settings
cs2f_leader_enable 0 // Whether to enable Leader features
Expand Down
9 changes: 9 additions & 0 deletions src/zombiereborn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ CConVar<bool> g_cvarInfectShake("zr_infect_shake", FCVAR_NONE, "Whether to shake
CConVar<float> g_cvarInfectShakeAmplitude("zr_infect_shake_amp", FCVAR_NONE, "Amplitude of shaking effect", 15.0f, true, 0.0f, true, 16.0f);
CConVar<float> g_cvarInfectShakeFrequency("zr_infect_shake_frequency", FCVAR_NONE, "Frequency of shaking effect", 2.0f, true, 0.0f, false, 0.0f);
CConVar<float> g_cvarInfectShakeDuration("zr_infect_shake_duration", FCVAR_NONE, "Duration of shaking effect", 5.0f, true, 0.0f, false, 0.0f);
CConVar<float> g_cvarDamageCashScale("zr_damage_cash_scale", FCVAR_NONE, "Multiplier on cash given when damaging zombies (0.0 = disabled)", 0.0f, true, 0.0f, false, 100.0f);

// meant only for offline config validation and can easily cause issues when used on live server
#ifdef _DEBUG
Expand Down Expand Up @@ -1650,6 +1651,14 @@ void ZR_OnPlayerTakeDamage(CCSPlayerPawn* pVictimPawn, const CTakeDamageInfo* pI
if (pKillerPawn->m_iTeamNum() == CS_TEAM_CT && pVictimPawn->m_iTeamNum() == CS_TEAM_T)
{
auto flClassKnockback = 1.0f;
float flCashScale = g_cvarDamageCashScale.Get();

if(flCashScale > 0)
{
const auto pKillerController = pKillerPawn->GetOriginalController();
int money = pKillerController->m_pInGameMoneyServices->m_iAccount;
pKillerController->m_pInGameMoneyServices->m_iAccount = money + (damage * flCashScale);
}

if (pVictimController->GetZEPlayer())
{
Expand Down