Skip to content

Commit 6ee1d3d

Browse files
committed
Merge branch 'dev' of https://github.com/CS2Surf/Timer into dev
2 parents 9f71439 + f8e1c96 commit 6ee1d3d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ST-Events/Players.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public HookResult OnPlayerConnect(EventPlayerConnectFull @event, GameEventInfo i
4949
name = playerData.GetString("name");
5050
if (country == "XX" && playerData.GetString("country") != "XX")
5151
country = playerData.GetString("country");
52-
joinDate = playerData.GetInt32("joined");
53-
lastSeen = playerData.GetInt32("lastseen");
52+
joinDate = playerData.GetInt32("join_date");
53+
lastSeen = playerData.GetInt32("last_seen");
5454
connections = playerData.GetInt32("connections");
5555
playerData.Close();
5656

@@ -69,7 +69,7 @@ public HookResult OnPlayerConnect(EventPlayerConnectFull @event, GameEventInfo i
6969
connections = 1;
7070

7171
// Write new player to database
72-
Task<int> newPlayerTask = DB.Write($"INSERT INTO `Player` (`name`, `steam_id`, `country`, `joined`, `lastseen`, `connections`) VALUES ('{MySqlHelper.EscapeString(name)}', {player.SteamID}, '{country}', {joinDate}, {lastSeen}, {connections});");
72+
Task<int> newPlayerTask = DB.Write($"INSERT INTO `Player` (`name`, `steam_id`, `country`, `join_date`, `last_seen`, `connections`) VALUES ('{MySqlHelper.EscapeString(name)}', {player.SteamID}, '{country}', {joinDate}, {lastSeen}, {connections});");
7373
int newPlayerTaskRows = newPlayerTask.Result;
7474
if (newPlayerTaskRows != 1)
7575
throw new Exception($"CS2 Surf ERROR >> OnPlayerConnect -> Failed to write new player to database, this shouldnt happen. Player: {name} ({player.SteamID})");
@@ -123,7 +123,7 @@ public HookResult OnPlayerDisconnect(EventPlayerDisconnect @event, GameEventInfo
123123
else
124124
{
125125
// Update data in Player DB table
126-
Task<int> updatePlayerTask = DB.Write($"UPDATE `Player` SET country = '{playerList[player.UserId ?? 0].Profile.Country}', `lastseen` = {(int)DateTimeOffset.UtcNow.ToUnixTimeSeconds()}, `connections` = `connections` + 1 WHERE `id` = {playerList[player.UserId ?? 0].Profile.ID} LIMIT 1;");
126+
Task<int> updatePlayerTask = DB.Write($"UPDATE `Player` SET country = '{playerList[player.UserId ?? 0].Profile.Country}', `last_seen` = {(int)DateTimeOffset.UtcNow.ToUnixTimeSeconds()}, `connections` = `connections` + 1 WHERE `id` = {playerList[player.UserId ?? 0].Profile.ID} LIMIT 1;");
127127
if (updatePlayerTask.Result != 1)
128128
throw new Exception($"CS2 Surf ERROR >> OnPlayerDisconnect -> Failed to update player data in database. Player: {player.PlayerName} ({player.SteamID})");
129129

0 commit comments

Comments
 (0)