Skip to content

Commit 27fb3d1

Browse files
authored
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
1 parent 519c9dc commit 27fb3d1

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

addons/sourcemod/scripting/current.sp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ float GetMaxSurvivorCompletion()
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+
}

0 commit comments

Comments
 (0)