Skip to content

Commit

Permalink
Merge branch 'SirPlease:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
altair-sossai authored Jun 7, 2024
2 parents f3f8b7a + e719e00 commit 2b6fc18
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
Binary file modified addons/sourcemod/plugins/optional/survivor_mvp.smx
Binary file not shown.
34 changes: 9 additions & 25 deletions addons/sourcemod/scripting/survivor_mvp.sp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public Plugin:myinfo =
name = "Survivor MVP notification",
author = "Tabun, Artifacial",
description = "Shows MVP for survivor team at end of round",
version = "0.3.2",
version = "0.3.3",
url = "https://github.com/alexberriman/l4d2_survivor_mvp"
};

Expand All @@ -96,13 +96,12 @@ new Handle: hCountTankDamage = INVALID_HANDLE; // whether we're
new Handle: hCountWitchDamage = INVALID_HANDLE; // whether we're tracking witch damage for MVP-selection
new Handle: hTrackFF = INVALID_HANDLE; // whether we're tracking friendly-fire damage (separate stat)
new Handle: hBrevityFlags = INVALID_HANDLE; // how verbose/brief the output should be:
new Handle: hRUPActive = INVALID_HANDLE; // whether the ready up mod is active

new bool: bCountTankDamage;
new bool: bCountWitchDamage;
new bool: bTrackFF;
new iBrevityFlags;
new bool: bRUPActive;
new bool: bRUPLive;

new String: sClientName[MAXPLAYERS + 1][64]; // which name is connected to the clientId?

Expand Down Expand Up @@ -276,17 +275,6 @@ public OnPluginStart()

if (!(iBrevityFlags & BREV_FF)) { bTrackFF = true; } // force tracking on if we're showing FF

// RUP?
hRUPActive = FindConVar("l4d_ready_enabled");
if (hRUPActive != INVALID_HANDLE)
{
// hook changes for this, and set state appropriately
bRUPActive = GetConVarBool(hRUPActive);
HookConVarChange(hRUPActive, ConVarChange_RUPActive);
} else {
// not loaded
bRUPActive = false;
}
bPlayerLeftStartArea = false;

// Commands
Expand All @@ -297,12 +285,10 @@ public OnPluginStart()
RegConsoleCmd("say_team", Say_Cmd);
}

/*
public OnPluginEnd()
public OnRoundIsLive()
{
// nothing
bRUPLive = true;
}
*/

public OnClientPutInServer(client)
{
Expand Down Expand Up @@ -362,10 +348,6 @@ public ConVarChange_BrevityFlags(Handle:cvar, const String:oldValue[], const Str
} // force tracking on if we're showing FF
}

public ConVarChange_RUPActive(Handle:cvar, const String:oldValue[], const String:newValue[]) {
bRUPActive = StringToInt(newValue) != 0;
}

/*
* map load / round start/end
* ==========================
Expand Down Expand Up @@ -434,6 +416,7 @@ public void ScavRoundStart(Handle:event, const String:name[], bool:dontBroadcast
public RoundStart_Event(Handle:event, const String:name[], bool:dontBroadcast)
{
bPlayerLeftStartArea = false;
bRUPLive = false;

if (!bInRound)
{
Expand Down Expand Up @@ -523,6 +506,7 @@ public RoundEnd_Event(Handle:event, const String:name[], bool:dontBroadcast)
}
}

bRUPLive = false;
tankSpawned = false;
}

Expand Down Expand Up @@ -908,10 +892,10 @@ public PlayerHurt_Event(Handle:event, const String:name[], bool:dontBroadcast)
}

// Otherwise if friendly fire
else if (GetClientTeam(attacker) == TEAM_SURVIVOR && GetClientTeam(victim) == TEAM_SURVIVOR && bTrackFF) // survivor on survivor action == FF
else if (GetClientTeam(attacker) == TEAM_SURVIVOR && GetClientTeam(victim) == TEAM_SURVIVOR && bTrackFF && !L4D_IsPlayerIncapacitated(victim)) // survivor on survivor action == FF
{
if (!bRUPActive || GetEntityMoveType(victim) != MOVETYPE_NONE || !L4D_IsPlayerIncapacitated(victim) || bPlayerLeftStartArea) {
// but don't record while frozen in readyup / before leaving saferoom / victim is incapacitated
if (bRUPLive || bPlayerLeftStartArea) {
// but don't record before readyup ended or before leaving saferoom if readyup is not loaded.
iDidFF[attacker] += damageDone;
iTotalFF += damageDone;
}
Expand Down

0 comments on commit 2b6fc18

Please sign in to comment.