Skip to content

Commit f9354b8

Browse files
authored
Fix plugin returning a null nav area when based on player origin (#897)
* Update l4d2_tankrage.sp current check sometimes returns a null nav area example: c1m1_hotel, teleport to the position "300 5683 2893" the current flow displayed by the plugin outputs "14%" because the "flow" variable is 0, because no nav (pNavArea) was found using "L4D_GetLastKnownArea" is more accurate since it outputs the same value as the "current_flow_distance" game command * Update current.sp current check sometimes returns a null nav area example: c1m1_hotel, teleport to the position "300 5683 2893" the current flow displayed by the plugin outputs "14%" because the "flow" variable is 0, because no nav (pNavArea) was found using "L4D_GetLastKnownArea" is more accurate since it outputs the same value as the "current_flow_distance" game command * Update current.sp removed origin variable * Update l4d2_tankrage.sp removed origin variable * Update l4d2_tankrage.sp updated plugin version * Update current.sp updated plugin version
1 parent 3902532 commit f9354b8

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

addons/sourcemod/scripting/current.sp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public Plugin myinfo =
1414
name = "L4D2 Survivor Progress",
1515
author = "CanadaRox, Visor",
1616
description = "Print survivor progress in flow percents ",
17-
version = "2.0.4",
17+
version = "2.0.5",
1818
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
1919
};
2020

@@ -53,12 +53,11 @@ float GetBossProximity()
5353
*/
5454
float GetMaxSurvivorCompletion()
5555
{
56-
float flow = 0.0, tmp_flow = 0.0, origin[3];
56+
float flow = 0.0, tmp_flow = 0.0;
5757
Address pNavArea;
5858
for (int i = 1; i <= MaxClients; i++) {
5959
if (IsClientInGame(i) && GetClientTeam(i) == TEAM_SURVIVORS && IsPlayerAlive(i)) {
60-
GetClientAbsOrigin(i, origin);
61-
pNavArea = L4D2Direct_GetTerrorNavArea(origin);
60+
pNavArea = L4D_GetLastKnownArea(i);
6261
if (pNavArea != Address_Null) {
6362
tmp_flow = L4D2Direct_GetTerrorNavAreaFlow(pNavArea);
6463
flow = (flow > tmp_flow) ? flow : tmp_flow;
@@ -87,4 +86,4 @@ stock void LoadTranslation(const char[] translation)
8786
SetFailState("Missing translation file %s.txt", translation);
8887

8988
LoadTranslations(translation);
90-
}
89+
}

addons/sourcemod/scripting/l4d2_tankrage.sp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public Plugin myinfo =
2323
name = "L4D2 Tank Rage",
2424
author = "Sir",
2525
description = "Manage Tank Rage when Survivors are running back.",
26-
version = "1.0.1",
26+
version = "1.0.2",
2727
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
2828
};
2929

@@ -172,12 +172,11 @@ int GetBossProximity()
172172

173173
float GetMaxSurvivorCompletion()
174174
{
175-
float flow = 0.0, tmp_flow = 0.0, origin[3];
175+
float flow = 0.0, tmp_flow = 0.0;
176176
Address pNavArea;
177177
for (int i = 1; i <= MaxClients; i++) {
178178
if (IsClientInGame(i) && GetClientTeam(i) == 2 && IsPlayerAlive(i)) {
179-
GetClientAbsOrigin(i, origin);
180-
pNavArea = L4D2Direct_GetTerrorNavArea(origin);
179+
pNavArea = L4D_GetLastKnownArea(i);
181180
if (pNavArea != Address_Null) {
182181
tmp_flow = L4D2Direct_GetTerrorNavAreaFlow(pNavArea);
183182
flow = (flow > tmp_flow) ? flow : tmp_flow;
@@ -226,4 +225,4 @@ stock void LoadTranslation(const char[] translation)
226225
SetFailState("Missing translation file %s.txt", translation);
227226

228227
LoadTranslations(translation);
229-
}
228+
}

0 commit comments

Comments
 (0)