Skip to content

Commit

Permalink
Update l4d2_hybrid_scoremod_zone
Browse files Browse the repository at this point in the history
- Updated Scoring System to punish Survivors more harshly for losing a survivor. (Treated as if the player was picked up and incapped until they died)
  • Loading branch information
SirPlease committed Jan 15, 2024
1 parent 30a9594 commit 3da1c23
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Binary file modified addons/sourcemod/plugins/optional/l4d2_hybrid_scoremod_zone.smx
Binary file not shown.
27 changes: 25 additions & 2 deletions addons/sourcemod/scripting/l4d2_hybrid_scoremod_zone.sp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ new bool:bTiebreakerEligibility[2];
public Plugin:myinfo =
{
name = "L4D2 Scoremod+",
author = "Visor",
author = "Visor, Sir",
description = "The next generation scoring mod",
version = "2.2.4",
version = "2.2.5",
url = "https://github.com/Attano/L4D2-Competitive-Framework"
};

Expand Down Expand Up @@ -90,6 +90,7 @@ public OnPluginStart()
HookEvent("player_incapacitated", OnPlayerIncapped);
HookEvent("player_hurt", OnPlayerHurt);
HookEvent("revive_success", OnPlayerRevived, EventHookMode_Post);
HookEvent("player_death", OnPlayerDeath);

RegConsoleCmd("sm_health", CmdBonus);
RegConsoleCmd("sm_damage", CmdBonus);
Expand Down Expand Up @@ -285,6 +286,28 @@ public OnPlayerLedgeGrab(Handle:event, const String:name[], bool:dontBroadcast)
iLostTempHealth[InSecondHalfOfRound()] += L4D2Direct_GetPreIncapHealthBuffer(client);
}

public OnPlayerDeath(Event hEvent, const char[] sEventName, bool bDontBroadcast)
{
int victim = GetClientOfUserId(hEvent.GetInt("userid"));
if (IsSurvivor(victim) && !bRoundOver)
{
int incaps = GetEntProp(victim, Prop_Send, "m_currentReviveCount");
int standardPenalty = RoundToFloor((fMapDamageBonus / 100.0) * 5.0 / fTempHpWorth);
int penalty = 0;

for (int loops = 2 - incaps; loops > 0; loops--)
{
penalty += standardPenalty + 30;
}

iLostTempHealth[InSecondHalfOfRound()] += penalty;

#if SM2_DEBUG
PrintToChatAll("\x04[\x01Valid Death\x04] \x03%N \x01had \x03%i \x01incaps and the total penalty is now \x03%i", victim, incaps, penalty);
#endif
}
}

public OnPlayerIncapped(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
Expand Down

0 comments on commit 3da1c23

Please sign in to comment.