From 96102a203576926fdde823fe52aca999c727e891 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 20 Apr 2021 21:34:28 -0500 Subject: [PATCH] Fix broken char last played text --- scripts/server/subaccount.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/server/subaccount.js b/scripts/server/subaccount.js index 4a58611a..0a05a7b2 100644 --- a/scripts/server/subaccount.js +++ b/scripts/server/subaccount.js @@ -191,7 +191,7 @@ function showCharacterSelectToClient(client) { logToConsole(LOG_DEBUG, `[Asshat.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`); let tempSubAccount = getPlayerData(client).subAccounts[0]; let clanName = (tempSubAccount.clan != 0) ? getClanData(tempSubAccount.clan).name : "None"; - let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${getTimeDifferenceDisplay(tempSubAccount.lastLogin, getCurrentUnixTimestamp())} ago` : "Never"; + let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never"; showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, tempSubAccount.skin); //spawnPlayer(client, getServerConfig().characterSelectPedPosition, getServerConfig().characterSelectPedHeading, getPlayerCurrentSubAccount(client).skin, getServerConfig().characterSelectInterior, getServerConfig().characterSelectDimension); @@ -205,8 +205,9 @@ function showCharacterSelectToClient(client) { //let emojiNumbers = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣"]; messagePlayerNormal(client, `You have the following characters. Use /usechar to select one:`, getColourByName("teal")); getPlayerData(client).subAccounts.forEach(function(subAccount, index) { + let tempSubAccount = getPlayerData(client).subAccounts[0]; let clanName = (tempSubAccount.clan != 0) ? getClanData(tempSubAccount.clan).name : "None"; - let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `Last played ${getTimeDifferenceDisplay(tempSubAccount.lastLogin, getCurrentUnixTimestamp())} ago` : "Never played"; + let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never"; messagePlayerNormal(client, `${index+1} • [#BBBBBB]${subAccount.firstName} ${subAccount.lastName} ($${tempSubAccount.cash}, ${lastPlayedText})`); }); logToConsole(LOG_DEBUG, `[Asshat.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`); @@ -357,6 +358,7 @@ function switchCharacterCommand(command, params, client) { getPlayerData(client).switchingCharacter = true; //spawnPlayer(client, getServerConfig().characterSelectPedPosition, getServerConfig().characterSelectPedHeading, getPlayerCurrentSubAccount(client).skin, getServerConfig().characterSelectInterior, getServerConfig().characterSelectDimension); //showCharacterSelectCameraToPlayer(client); + showConnectCameraToPlayer(client); showCharacterSelectToClient(client); }