From 9c9960d554ac65b30cfaab9f21a844162d3da912 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Sat, 3 Feb 2024 00:31:47 +0000 Subject: [PATCH] Fix --- src/scripts/hlstats.pl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/scripts/hlstats.pl b/src/scripts/hlstats.pl index 63d09ef..8d1b3cc 100644 --- a/src/scripts/hlstats.pl +++ b/src/scripts/hlstats.pl @@ -1182,14 +1182,6 @@ sub getPlayerInfo $userid = -3; } } - } else { - if ($g_servers{$s_addr}->{play_game} == CS2()) { - # leo - Workaround for bad logging from CS2 where first non-bot player may be assigned userid of `0`. By setting userid > 0, the player object will be created at the end of the function - # E.g. L 02/01/2024 - 21:02:01.253 - "X<0><[U:Y]><>" entered the game - if ($userid == 0) { - $userid = 0.1; - } - } } if ($g_mode eq "NameTrack") { @@ -1300,7 +1292,10 @@ sub getPlayerInfo $player->updateTimestamp(); } } else { - if ($userid != 0) { + # In CS2, the first user is always assigned userid of '0'. Always create a player regardless of its value + # E.g. L 02/01/2024 - 21:02:01.253 - "X<0><[U:Y]><>" entered the game + # For all other games, userid is always above '0' + if ($userid != 0 || $g_servers{$s_addr}->{play_game} == CS2()) { if ($create_player > 0) { my $preIpAddr = ""; if ($g_preconnect->{"$s_addr/$userid/$name"}) {